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-17508 Overview
CVE-2026-17508 affects Bouncy Castle for Java versions prior to 1.86, where several password-based key derivation function (KDF) entry points accept cost parameters from untrusted input without enforcing upper bounds. An attacker who supplies a crafted PKCS#8, PKCS#12, BCFKS, or OpenSSH v1 private key artifact can force the library to perform arbitrary amounts of work before any password or integrity check runs. The flaw is classified as CWE-770: Allocation of Resources Without Limits or Throttling and extends the bounding work begun in Bouncy Castle 1.85 for CVE-2026-15055.
Critical Impact
A small malicious input can trigger extended CPU and memory consumption inside the KDF, enabling denial-of-service against any Java service that parses untrusted keystores, PKCS#12 containers, or OpenSSH private keys using Bouncy Castle.
Affected Products
- Bouncy Castle for Java before 1.86
- Bouncy Castle for Java LTS before 2.73.13
- Bouncy Castle for Java FIPS (BC-FJA): bcpkix-fips before 1.0.13, 2.0.13, and 2.1.13
Discovery Timeline
- 2026-10-02 - CVE-2026-17508 published to NVD
- 2026-10-02 - Last updated in NVD database
Technical Details for CVE-2026-17508
Vulnerability Analysis
The vulnerability spans four distinct code paths in Bouncy Castle's password-based cryptography. Each path reads cost parameters from attacker-controlled encoded structures and feeds them directly to the KDF without validating that the resulting work factor is reasonable.
The RFC 9579 PBMAC1 MAC calculator builders (JcePBMac1CalculatorBuilder and PKCS12PBEUtils.createPBMac1Calculator, reached from PKCS12PfxPdu.isMacValid) read the PBKDF2 iteration count and derived-key length straight out of PBMAC1Params. Because the PFX MAC has not yet been verified when these values are consumed, an attacker can specify an arbitrarily large iteration count or key length.
The scrypt guards in the PKCS#8 and PKCS#12 decryptors previously bounded only the cost parameter N and block size r. The scratch buffer, however, scales with r * p, so an unbounded parallelization parameter p evades the configured memory ceiling. The raw JCA PBKDF2 provider (org.bouncycastle.jcajce.provider.symmetric.PBEPBKDF2) and the bcrypt round count read from an encrypted OpenSSH v1 private key's own kdfoptions are similarly unbounded.
Root Cause
The root cause is missing input validation on KDF cost parameters sourced from untrusted ASN.1 or OpenSSH structures. Password-based decryption and MAC verification protocols require the cost parameters to be processed before the password or MAC can authenticate the input, so the parser must apply bounds itself.
Attack Vector
An attacker delivers a crafted keystore, PKCS#12 PFX, BCFKS keystore, PBMAC1-protected object, or OpenSSH v1 private key to a service that invokes a vulnerable Bouncy Castle API. User interaction, such as importing a key file, is typically required. The targeted process then executes an extended PBKDF2, scrypt, or bcrypt derivation, consuming CPU and memory.
// Patch excerpt: pkix/src/main/java/org/bouncycastle/openssl/jcajce/JceOpenSSLPKCS8DecryptorProviderBuilder.java
// Bound the scrypt parallelization parameter p in the PKCS8/PKCS12 cost guards
BigInteger n = params.getCostParameter();
BigInteger r = params.getBlockSize();
BigInteger p = params.getParallelizationParameter();
if (n == null || r == null || p == null
|| n.signum() <= 0 || r.signum() <= 0 || p.signum() <= 0
|| n.bitLength() > 31 || r.bitLength() > 31 || p.bitLength() > 31)
{
throw new IOException("invalid scrypt parameters");
}
Source: GitHub Commit 20ed9e203cae
// Patch excerpt: pkix/src/main/java/org/bouncycastle/pkcs/util/PKCS12Util.java
// A PBMAC1 MAC key is 20-64 bytes; anything beyond this is rejected as abusive.
private static final BigInteger MAX_KEY_LENGTH = BigInteger.valueOf(1024);
public static int validateKeyLength(BigInteger keyLength)
{
if (keyLength == null || keyLength.signum() <= 0)
{
throw new IllegalStateException("keyLength must be positive");
}
if (keyLength.compareTo(MAX_KEY_LENGTH) > 0)
{
throw new IllegalStateException("keyLength " + keyLength + " greater than " + MAX_KEY_LENGTH);
}
return BigIntegers.intValueExact(keyLength);
}
Source: GitHub Commit 442393bf187c
Detection Methods for CVE-2026-17508
Indicators of Compromise
- Java processes that pin CPU cores for extended durations immediately after parsing a PKCS#12, BCFKS, PBMAC1, or OpenSSH v1 artifact.
- Spikes in Java heap or native memory consumption inside bcprov, bcpkix, or bcpkix-fips call stacks containing Scrypt, PBKDF2, or BCrypt frames.
- Repeated failed keystore or private-key import attempts from the same source identity.
Detection Strategies
- Build a software bill of materials (SBOM) query that flags bcprov-jdk*, bcpkix-jdk*, and bcpkix-fips artifacts at versions below the fixed releases.
- Add runtime stack-trace sampling for workloads that import external keystores to catch long-running Scrypt.generate, PKCS5S2ParametersGenerator, or BCrypt.generate invocations.
- Correlate inbound file uploads containing PKCS#12 or OpenSSH key material with downstream JVM resource saturation events.
Monitoring Recommendations
- Alert on JVM CPU utilization exceeding baseline for more than 30 seconds following any keystore load API call.
- Track the frequency of PKCS12PfxPdu.isMacValid and JceOpenSSLPKCS8DecryptorProviderBuilder.build invocations per source.
- Log and review any invalid scrypt parameters, keyLength must be positive, or similar bound-rejection exceptions after patching to identify active probing.
How to Mitigate CVE-2026-17508
Immediate Actions Required
- Upgrade Bouncy Castle to 1.86 (standard), 2.73.13 (LTS), or the appropriate FIPS release (1.0.13, 2.0.13, or 2.1.13).
- Audit application code paths that accept externally supplied keystores, PFX files, or OpenSSH private keys and gate them behind authenticated workflows.
- Apply resource quotas or timeouts to any thread that invokes Bouncy Castle KDF entry points.
Patch Information
The fixes are published across the Bouncy Castle repository in commits 20ed9e203cae, 442393bf187c, 480d878aa6f7, 766a31026ac2, 882fdab53f6c, and e72bc0681ff4. Project documentation is maintained in the Bouncy Castle CVE-2026-17508 wiki entry. Each patched entry point now validates cost parameters before performing derivation, matching the caps already applied elsewhere in the tree.
Workarounds
- Reject or pre-parse untrusted key material in a sandboxed process with strict CPU and memory cgroups enforcement.
- Use the new org.bouncycastle.openssh.max_rounds system property to constrain bcrypt rounds consumed from OpenSSH v1 private keys.
- Where feasible, restrict acceptable keystore formats to those produced internally and reject caller-supplied PBMAC1 iteration counts above application-defined limits.
# Configuration example: cap bcrypt rounds when loading OpenSSH v1 private keys
java -Dorg.bouncycastle.openssh.max_rounds=16 \
-jar your-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

