Description
In Bouncy Castle for Java before 1.86, the opt-in key-size validation on CMS key-transport recipients, org.bouncycastle.cms.jcajce.JceKeyTransRecipient.setKeySizeValidation(true), never ran for a message using RFC 9709 content-encryption key derivation (id-alg-cek-hkdf-sha256). The branch that should have selected the actual content-encryption algorithm carried in the key derivation AlgorithmIdentifier's parameters compared the encrypted-key byte array against the id-alg-cek-hkdf-sha256 object identifier, a comparison between a byte array and an ASN1ObjectIdentifier that is false for every possible input, so the check fell through to a key-size lookup on the outer wrapper OID. That OID identifies a key-derivation construction rather than a cipher and has no registered key size, so the size comparison was skipped entirely. A key-transport EnvelopedData or AuthEnvelopedData whose transported, HKDF-derived content-encryption key did not match the key size of the advertised content-encryption algorithm was therefore accepted even with validation explicitly enabled, silently defeating the only mechanism the API offers for enforcing recovered key size. The recipient now dispatches on the content-encryption AlgorithmIdentifier's algorithm OID, so validation checks the recovered key against the inner content-encryption algorithm. Messages with a matching key size, non-HKDF messages, and recipients that do not enable validation are unaffected. This issue also affects Bouncy Castle for Java FIPS (BC-FJA) before bcpkix-fips 2.0.13 (2.0.X series) and 2.1.13 (2.1.X series).
Published: 2026-10-03
Score: 6.9 Medium
EPSS: n/a
KEV: No
Impact: Cryptographic key validation bypass
Action: Apply patch
AI Analysis

Impact

The vulnerability resides in the key‑size validation logic of Bouncy Castle’s CMS key‑transport recipient when an RFC 9709 HKDF‑derived key is used. The library performs an unnecessary comparison between a byte array of the encrypted key and an ASN1ObjectIdentifier, which always evaluates to false. Consequently, the fallback key‑size check is performed against the outer wrapper OID rather than the inner content‑encryption algorithm. Because that OID does not define a key size, the size comparison is skipped entirely, allowing a key whose length does not match the advertised algorithm to be accepted even when validation is explicitly enabled. This flaw represents a cryptographic key‑validation bypass that can compromise confidentiality by permitting the use of invalid key sizes.

Affected Systems

The affected products are Bouncy Castle for Java (BC‑JAVA) before version 1.86 and Bouncy Castle for FIPS (BC‑FJA) before bcpkix‑fips 2.0.13 and 2.1.13. Any application that imports CMS or AuthEnvelopedData and relies on the library’s key‑size validation for RFC 9709 HKDF content‑encryption keys is potentially impacted.

Risk and Exploitability

With a CVSS score of 6.9 the vulnerability is considered moderate. No EPSS data is available, and it is not listed in the CISA KEV catalog. Exploitation requires the attacker to craft a CMS‑wrapped message containing an HKDF‑derived key whose length does not match the advertised algorithm and deliver it to a target that uses the vulnerable library with key‑size validation turned on. The attack surface is limited to applications that explicitly enable this validation. Once exploited, the flaw undermines the cryptographic integrity of the message stream.

Generated by OpenCVE AI on October 3, 2026 at 09:52 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to Bouncy Castle for Java 1.86 or newer and Bouncy Castle FIPS bcpkix‑fips 2.0.13 or 2.1.13 to incorporate the fixed key‑size validation logic.
  • When an upgrade is not feasible, disable key‑size validation for RFC 9709 HKDF key‑transport recipients by avoiding JceKeyTransRecipient.setKeySizeValidation(true).
  • Add custom validation to compare the recovered key length with the inner content‑encryption algorithm’s key size if possible, ensuring alignment before processing the message.

Generated by OpenCVE AI on October 3, 2026 at 09:52 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Sat, 03 Oct 2026 08:45:00 +0000

Type Values Removed Values Added
Description In Bouncy Castle for Java before 1.86, the opt-in key-size validation on CMS key-transport recipients, org.bouncycastle.cms.jcajce.JceKeyTransRecipient.setKeySizeValidation(true), never ran for a message using RFC 9709 content-encryption key derivation (id-alg-cek-hkdf-sha256). The branch that should have selected the actual content-encryption algorithm carried in the key derivation AlgorithmIdentifier's parameters compared the encrypted-key byte array against the id-alg-cek-hkdf-sha256 object identifier, a comparison between a byte array and an ASN1ObjectIdentifier that is false for every possible input, so the check fell through to a key-size lookup on the outer wrapper OID. That OID identifies a key-derivation construction rather than a cipher and has no registered key size, so the size comparison was skipped entirely. A key-transport EnvelopedData or AuthEnvelopedData whose transported, HKDF-derived content-encryption key did not match the key size of the advertised content-encryption algorithm was therefore accepted even with validation explicitly enabled, silently defeating the only mechanism the API offers for enforcing recovered key size. The recipient now dispatches on the content-encryption AlgorithmIdentifier's algorithm OID, so validation checks the recovered key against the inner content-encryption algorithm. Messages with a matching key size, non-HKDF messages, and recipients that do not enable validation are unaffected. This issue also affects Bouncy Castle for Java FIPS (BC-FJA) before bcpkix-fips 2.0.13 (2.0.X series) and 2.1.13 (2.1.X series).
Title CMS key-transport recipient key-size validation never runs for RFC 9709 HKDF-derived keys
Weaknesses CWE-697
References
Metrics cvssV4_0

{'score': 6.9, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N/U:Amber'}


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: bcorg

Published:

Updated: 2026-10-03T08:30:26.982Z

Reserved: 2026-08-08T00:06:07.401Z

Link: CVE-2026-71892

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-10-03T09:17:05.913

Modified: 2026-10-03T09:17:05.913

Link: CVE-2026-71892

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-03T10:00:14Z

Weaknesses