Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-97873 Overview
CVE-2026-97873 is a resource exhaustion vulnerability in Bouncy Castle for Java before version 1.86 and Bouncy Castle for Java LTS before 2.73.13. The flaw affects the raw JCA provider's legacy PBES1 (PKCS#5 scheme 1) and PKCS#12 PBE families. These implementations ran password-based key derivation using an iteration count taken from untrusted input without any upper bound. An attacker who supplies crafted PKCS#12 or PBE-encoded material can dictate an arbitrary amount of CPU work before any verification occurs. The weakness is classified as [CWE-770] Allocation of Resources Without Limits or Throttling.
Critical Impact
Attackers can trigger pre-authentication CPU exhaustion by submitting PKCS#12 or PBE-encoded data with an inflated iteration count, denying service to applications that decrypt attacker-supplied key material.
Affected Products
- Bouncy Castle for Java before 1.86
- Bouncy Castle for Java LTS before 2.73.13
- Applications using javax.crypto.EncryptedPrivateKeyInfo.getKeySpec() with BC to decrypt PKCS#12 PBE-protected private keys
Discovery Timeline
- 2026-10-03 - CVE-2026-97873 published to NVD
- 2026-10-06 - Last updated in NVD database
Technical Details for CVE-2026-97873
Vulnerability Analysis
The vulnerability resides in the Bouncy Castle JCA provider's handling of password-based encryption parameters. The AlgorithmParameters implementations for PKCS12PBE (and its object identifier aliases) and PBKDF1 accepted any iteration count parsed from an encoded PKCS12PBEParams or PBEParameter structure. The parser narrowed the value to a Java int using intValue() without rejecting out-of-range or negative counts. Every Cipher, Mac, and SecretKeyFactory in these PBE families then performed key derivation using whatever count the parameters supplied. Because PBE parameters typically travel inside unauthenticated containers, the derivation runs before any integrity check can detect manipulation.
Root Cause
The root cause is missing validation of the iteration count in both the parameter parse path and the derivation path. The code trusted the encoded value, applied intValue() to narrow a potentially large BigInteger, and forwarded the result to the key derivation function. No upper bound was enforced, and negative values were not rejected. The existing org.bouncycastle.pbe.max_iteration_count property (default 10,000,000) that bounded PBKDF2 under CVE-2026-17508 was not applied to the legacy PBES1 or PKCS#12 PBE families.
Attack Vector
An attacker crafts a PKCS#12 bag or PBE-encoded blob with an iteration count set to a maximal int value. When a victim application calls EncryptedPrivateKeyInfo.getKeySpec() or any Bouncy Castle Cipher, Mac, or SecretKeyFactory in the affected families to process the material, the provider executes the full derivation loop. This consumes CPU cycles proportional to the attacker-controlled count. The attack requires no authentication and can be delivered through any channel that accepts PBE-protected key material.
// Patch excerpt: core/src/main/java/org/bouncycastle/util/Properties.java
// Expanded scope of the PBE_MAX_ITERATION_COUNT bound to cover legacy PBE families.
public static final String BCFKS_MAX_SCRYPT_MEMORY = "org.bouncycastle.bcfks.max_scrypt_memory";
/**
* Upper bound on the PBKDF2 iteration count honoured when BC takes that count from an
* untrusted encoding: decrypting a PBES2-protected PKCS#8 / PEM private key or PKCS#12
* bag, verifying an RFC 9579 PBMAC1, unwrapping a CMS password recipient, and the raw JCA
* PBKDF2 provider (both the SecretKeyFactory derivation and the AlgorithmParameters parse
* a Cipher performs for PBES2). In each case the key-derivation parameters travel inside
* an unauthenticated container, so an unbounded count makes processing attacker-supplied
* material a CPU-exhaustion vector. Default 10,000,000 - the count RFC 8018 sec. 4.2 names
* as possibly appropriate for especially critical keys, so generous enough for deliberately
* strong settings. Read via asInteger(String, int).
*/
public static final String PBE_MAX_ITERATION_COUNT = "org.bouncycastle.pbe.max_iteration_count";
Source: Bouncy Castle commit 766a310
Detection Methods for CVE-2026-97873
Indicators of Compromise
- Java application threads exhibiting sustained CPU utilization inside org.bouncycastle.crypto.generators key derivation classes.
- Timeouts or thread-pool exhaustion on endpoints that accept PKCS#12 uploads, encrypted private keys, or PBE-protected payloads.
- Inbound PKCS#12 or EncryptedPrivateKeyInfo structures whose decoded iteration count exceeds reasonable application defaults (typically 100,000).
Detection Strategies
- Inventory running Java services for the Bouncy Castle provider version and flag any instance below 1.86 or LTS 2.73.13.
- Instrument PBE processing paths with timing metrics so that derivations exceeding expected latency are logged for review.
- Inspect ingestion points that accept key material and parse the iterationCount field before passing data to the JCA provider.
Monitoring Recommendations
- Alert on sustained single-thread CPU saturation in JVMs that handle untrusted cryptographic material.
- Monitor web application firewall and reverse proxy logs for request latency anomalies on endpoints that accept certificates or key stores.
- Track exceptions and property-bound rejections tied to org.bouncycastle.pbe.max_iteration_count after patching to confirm the control is active.
How to Mitigate CVE-2026-97873
Immediate Actions Required
- Upgrade Bouncy Castle for Java to 1.86 or Bouncy Castle for Java LTS to 2.73.13 across all affected services.
- Audit application code paths that invoke EncryptedPrivateKeyInfo.getKeySpec() or any PBE-family Cipher, Mac, or SecretKeyFactory with externally supplied data.
- Set a conservative value for the org.bouncycastle.pbe.max_iteration_count system property aligned with your application's legitimate maximum.
Patch Information
The fix is delivered in Bouncy Castle for Java 1.86 and Bouncy Castle for Java LTS 2.73.13. The patch extends the existing org.bouncycastle.pbe.max_iteration_count property (default 10,000,000) to cover the PBES1 and PKCS#12 PBE families. The AlgorithmParameters parse now rejects counts beyond the int range rather than silently narrowing them, and derivations reject negative or over-limit values. See the upstream commit and the Bouncy Castle CVE-2026-97873 wiki entry.
Workarounds
- Reject or pre-validate PBE-protected material at the application layer before handing it to Bouncy Castle, enforcing a strict upper bound on the iteration count.
- Isolate cryptographic parsing in a sandboxed worker with CPU and wall-clock limits so a single request cannot starve the main service.
- Switch unauthenticated ingestion flows away from legacy PBES1 and PKCS#12 PBE in favor of PBES2 configurations whose parameters you control.
# Enforce a stricter per-JVM iteration ceiling until patched builds are deployed
java -Dorg.bouncycastle.pbe.max_iteration_count=200000 -jar application.jar
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

