Skip to content

[FIPS 3.x] Address Reported Bug Findings#3005

Merged
skmcgrail merged 5 commits intoaws:fips-2024-09-27from
skmcgrail:fips-2024-09-27-patches
Feb 18, 2026
Merged

[FIPS 3.x] Address Reported Bug Findings#3005
skmcgrail merged 5 commits intoaws:fips-2024-09-27from
skmcgrail:fips-2024-09-27-patches

Conversation

@skmcgrail
Copy link
Copy Markdown
Member

This PR contains 5 bug fixes for various issues in AWS-LC. We would like to thank Joshua Rogers (https://joshua.hu/) of AISLE Research Team (https://aisle.com/) for reporting these issues.

Commits

1. 1-byte OOB read in EVP_PKEY_asn1_find_str length calculation

Fixes an off-by-one out-of-bounds read in the EVP_PKEY_asn1_find_str length calculation.

2. pkcs8: cap ciphertext length before allocating in pkcs8_pbe_decrypt

pkcs8_pbe_decrypt() allocates OPENSSL_malloc(in_len) where in_len is influenced by ASN.1 OCTET STRING lengths. The existing INT_MAX check only guards EVP_DecryptUpdate's int parameter and occurs after the allocation. This fix caps the ciphertext length before allocating.

3. evp: disable EVP_PKEY_derive for KEM method

EVP_PKEY_kem_pkey_meth incorrectly assigned out->derive to pkey_hkdf_derive, causing ctx->data type confusion (KEM_PKEY_CTX vs HKDF_PKEY_CTX) when callers invoke EVP_PKEY_derive on a KEM context. This fix sets out->derive to NULL so the operation fails as unsupported.

4. Reject zero-sized digests in HKDF EVP_PKEY

Rejects digests with EVP_MD_size <= 0 when configuring HKDF and when deriving, preventing divide-by-zero in HKDF_expand if an XOF digest is selected.

5. Reject XOF digests in DH_compute_key_hashed

DH_compute_key_hashed passes an uninitialized out_len to EVP_Digest. For XOF digests, EVP_DigestFinalXOF interprets *out_size as an input length, which can cause an out-of-bounds write to the caller-provided buffer. This fix rejects XOF digests and initializes out_len to the fixed digest size.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

skmcgrail and others added 5 commits February 18, 2026 00:42
We would like to thank Joshua Rogers (https://joshua.hu/) of AISLE Research Team (https://aisle.com/) for reporting this issue.

(cherry picked from commit 921c646)
pkcs8_pbe_decrypt() allocates OPENSSL_malloc(in_len) where in_len is derived
from attacker-influenced ASN.1 OCTET STRING lengths. The existing INT_MAX
check only guards EVP_DecryptUpdate’s int parameter and occurs after the
allocation.

We would like to thank Joshua Rogers (https://joshua.hu/) of AISLE Research Team (https://aisle.com/) for reporting this issue.

(cherry picked from commit e17506c)
EVP_PKEY_kem_pkey_meth incorrectly assigned out->derive to pkey_hkdf_derive,
causing ctx->data type confusion (KEM_PKEY_CTX vs HKDF_PKEY_CTX) when callers
invoke EVP_PKEY_derive on a KEM context. Set out->derive to NULL so the
operation fails as unsupported rather than dispatching into HKDF.

We would like to thank Joshua Rogers (https://joshua.hu/) of AISLE Research Team (https://aisle.com/) for reporting this issue.

(cherry picked from commit dcd1690)
Reject digests with EVP_MD_size <= 0 when configuring HKDF and when deriving,
preventing divide-by-zero in HKDF_expand if an XOF digest is selected.

We would like to thank Joshua Rogers (https://joshua.hu/) of AISLE Research Team (https://aisle.com/) for reporting this issue.

(cherry picked from commit 8a43348)
DH_compute_key_hashed passes an uninitialized out_len to EVP_Digest.
For XOF digests, EVP_DigestFinalXOF interprets *out_size as an input length,
which can cause an out-of-bounds write to the caller-provided buffer.
Reject XOF digests and initialize out_len to the fixed digest size.

We would like to thank Joshua Rogers (https://joshua.hu/) of AISLE Research Team (https://aisle.com/) for reporting this issue.

(cherry picked from commit 110f184)
@skmcgrail skmcgrail merged commit 9d3a632 into aws:fips-2024-09-27 Feb 18, 2026
62 of 118 checks passed
@skmcgrail skmcgrail deleted the fips-2024-09-27-patches branch February 18, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants