aws / aws/aws-encryption-sdk-javascript
Raw AES Keyring zeros out passed in unwrappedMasterKey
- 主要言語
- TypeScript
- スター
- 260
- フォーク
- 68
- 平均マージ
- 22時間 19分
- マージ済み PR(30日)
- 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