aws / aws/aws-encryption-sdk-javascript

Raw AES Keyring zeros out passed in unwrappedMasterKey

未关闭
#970 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
TypeScript
星标
260
派生
68
平均合并
22 小时 19 分钟
30 天内合并 PR
2

描述

### Problem:

The materials manager zeros out the dataKey in the processing of creating wrapping key material during construction:
https://github.com/aws/aws-encryption-sdk-javascript/blob/6b1d1a6cd62d56dfb47eb9b70307b5f9083e5e10/modules/material-management/src/cryptographic_material.ts#L823-L838

This is normally good practice. However in the case where the buffer has been passed in by the customer via Keyring creation, for example in the Raw AES Keyring case, this leads to surprising behavior.

The Raw AES Keyrings does not make a defensive copy of the key material before creating this material: https://github.com/aws/aws-encryption-sdk-javascript/blob/master/modules/raw-aes-keyring-node/src/raw_aes_keyring_node.ts#L63

And thus the "unwrappedMasterKey" that the customer passed in looks like it gets "consumed." This is surprising to the customer, especially since our docs have no indication of this behavior.

### Solution:

The Raw AES Keyring should make a defensive copy of the "unwrappedMasterKey" in it's constructor. It is the responsibility of the customer to zero out the "unwrappedMasterKey" in their application after creation of the Keyring if it is no longer needed, in order to minimize the time the data key exists in plaintext in memory.

### Out of scope:

Is there anything the solution will intentionally NOT address?

[//]: # (NOTE: If you believe this might be a security issue, please email aws-security@amazon.com instead of creating a GitHub issue. For more details, see the AWS Vulnerability Reporting Guide: https://aws.amazon.com/security/vulnerability-reporting/ )

贡献指南

打开贡献指南

调研方向

阅读 modules/material-management/src/cryptographic_material.ts 中第823-838行附近的材料管理器代码,然后检查 modules/raw-aes-keyring-node/src/raw_aes_keyring_node.ts 中第63行附近的 Raw AES keyring 构造函数。确认该构造函数会防御性地复制客户提供的 unwrappedMasterKey,从而使后续的材料处理不会将调用方的缓冲区清零。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
cryptography
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。