aws / aws/aws-encryption-sdk-javascript

Raw AES Keyring zeros out passed in unwrappedMasterKey

Đang mở
#970 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
TypeScript
Star
260
Fork
68
Merge trung bình
22 giờ 19 phút
Pull request đã merge (30 ngày)
2

Mô tả

### 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/ )

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Đọc mã của trình quản lý vật liệu trong modules/material-management/src/cryptographic_material.ts quanh các dòng 823-838, sau đó kiểm tra hàm khởi tạo của Raw AES keyring trong modules/raw-aes-keyring-node/src/raw_aes_keyring_node.ts quanh dòng 63. Xác nhận rằng hàm khởi tạo tạo một bản sao phòng thủ của unwrappedMasterKey do khách hàng cung cấp để việc xử lý vật liệu sau đó không ghi số 0 vào buffer của bên gọi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
cryptography
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.