Skip to main content
Vulnerability Database/CVE-2026-63578

CVE-2026-63578: Bouncy Castle bc-csharp DOS Vulnerability

CVE-2026-63578 is a denial of service flaw in Bouncy Castle bc-csharp that allows CPU exhaustion through malicious encrypted private keys. This post explains its technical details, affected versions, impact, and mitigation steps.

Published:

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-63578 Overview

CVE-2026-63578 is a resource allocation flaw in the Legion of the Bouncy Castle bc-csharp cryptographic library prior to version 2.7.0. The vulnerability resides in PbeUtilities.GenerateCipherParameters, which processes password-based private-key decryption without bounding the iteration count supplied by the untrusted encrypted key. An attacker who can provide a crafted PKCS#8 EncryptedPrivateKeyInfo or ENCRYPTED PRIVATE KEY PEM file can set the iteration count close to 2^31, triggering a key derivation that exhausts CPU resources before any password or data validation runs. The issue is tracked under [CWE-770: Allocation of Resources Without Limits or Throttling].

Critical Impact

Remote attackers can cause sustained CPU exhaustion and denial of service in any application that decrypts attacker-supplied encrypted private keys using affected bc-csharp versions.

Affected Products

  • Legion of the Bouncy Castle bc-csharp versions prior to 2.7.0
  • Applications using PKCS#5 PBES1 and PBES2 (PBKDF2) decryption paths
  • Applications using PKCS#12 PBE algorithms and CMS password recipients (CmsPbeKey)

Discovery Timeline

  • 2026-10-02 - CVE-2026-63578 published to the National Vulnerability Database (NVD)
  • 2026-10-06 - Last updated in NVD database

Technical Details for CVE-2026-63578

Vulnerability Analysis

The flaw lies in how bc-csharp handles the iteration count parameter embedded in password-based encryption (PBE) structures. When decrypting an encrypted private key, PbeUtilities.GenerateCipherParameters reads the iteration count directly from the algorithm parameters inside the encrypted blob. These parameters are unauthenticated and fully attacker controlled. The library then invokes the key derivation function (KDF) using that count before verifying the password or decrypting the payload. An iteration count near 2^31 forces the KDF to perform billions of pseudo-random function iterations, saturating a CPU core for an extended period.

Because the key derivation runs before any authenticity check, no valid password is required to trigger the condition. Supplying a malformed or random payload with a large iteration count is sufficient. Repeated submissions amplify the impact into a denial-of-service condition against services that routinely process user-supplied encrypted keys, such as certificate ingestion endpoints, CMS message processors, and automated signing systems.

Root Cause

The root cause is missing input validation on an untrusted ASN.1 field. The decoder trusts the iteration count encoded in PbeParameter and PBKDF2-params structures and passes it to PbeParametersGenerator without an upper bound. CWE-770 applies: a bounded resource is allocated from an unbounded, attacker-controlled integer. Related issues CVE-2026-63572 (PKCS#12 loading via Pkcs12Store) and CVE-2026-63575 (zero or negative counts in PKCS#12 algorithms) cover adjacent decoding paths.

Attack Vector

Exploitation requires an attacker to deliver an encrypted private key to a vulnerable application. The attacker crafts a PKCS#8 EncryptedPrivateKeyInfo or PEM-encoded ENCRYPTED PRIVATE KEY with an iteration count close to 0x7FFFFFFF. Any attempt by the application to decrypt the structure invokes the KDF with that count, consuming CPU for minutes or longer per request. User interaction (uploading or importing the key) is required, consistent with the published CVSS metrics.

text
// Patch excerpt: crypto/src/security/PbeUtilities.cs
{
    PbeParameter pbeParams = PbeParameter.GetInstance(pbeParameters);
    salt = pbeParams.Salt.GetOctets();
-   iterationCount = pbeParams.IterationCountObject.IntValueExact;
+   iterationCount = CheckPbeIterationCount(pbeParams.IterationCountObject);
    keyBytes = PbeParametersGenerator.Pkcs5PasswordToBytes(password);
}

Source: bc-csharp commit 54ea0b1. The fix routes the raw ASN.1 integer through CheckPbeIterationCount, which enforces an upper bound before the KDF executes.

Detection Methods for CVE-2026-63578

Indicators of Compromise

  • Sustained single-core CPU saturation in .NET processes that invoke Org.BouncyCastle.Security.PbeUtilities or Org.BouncyCastle.Cms.CmsPbeKey.
  • Thread stacks parked in PbeParametersGenerator.GenerateDerivedParameters or Pkcs5S2ParametersGenerator for extended periods.
  • Inbound requests containing EncryptedPrivateKeyInfo or ENCRYPTED PRIVATE KEY PEM blobs with ASN.1 iteration count fields approaching 0x7FFFFFFF.

Detection Strategies

  • Perform application-layer inspection of uploaded PEM and DER key material to extract and threshold the PBE iteration count prior to handing it to the decoder.
  • Instrument the Bouncy Castle call path with timing probes that flag any single GenerateCipherParameters invocation exceeding a reasonable duration (for example, 2 seconds).
  • Audit dependency manifests (packages.config, .csproj, paket.dependencies) for BouncyCastle.Cryptography versions earlier than 2.7.0.

Monitoring Recommendations

  • Alert on process-level CPU anomalies correlated with HTTP endpoints that accept certificate or key uploads.
  • Capture Windows ETW or Linux perf traces for managed stacks containing BouncyCastle symbols during CPU spikes.
  • Forward web application firewall and reverse-proxy logs showing repeated large PEM uploads from a single source for correlation.

How to Mitigate CVE-2026-63578

Immediate Actions Required

  • Upgrade the BouncyCastle.Cryptography NuGet package to version 2.7.0 or later across all .NET projects.
  • Inventory applications that call PbeUtilities.CreateEngine, PbeUtilities.GenerateCipherParameters, or CmsPbeKey, and prioritize patching services exposed to untrusted input.
  • Rate-limit endpoints that accept encrypted private keys and enforce authentication before invoking cryptographic decoding.

Patch Information

The fix is distributed in bc-csharp 2.7.0. Key commits introduce iteration-count validation and PKCS#12 hardening: bc-csharp commit 54ea0b1 caps PKCS#5 v1.5 PBE iteration counts on PKCS#8 decrypt, and bc-csharp commit 7c0ed15 validates PKCS#12 iteration counts and introduces the Org.BouncyCastle.Pkcs12.MaxIterations property with a default limit of 5,000,000. Refer to the CVE-2026-63578 advisory wiki for the full change set.

Workarounds

  • Pre-parse incoming PBE structures and reject any iteration count above a conservative threshold such as 5,000,000 before passing data to Bouncy Castle.
  • Isolate key-decryption operations in a sandboxed worker process with strict CPU time limits enforced by the operating system or container runtime.
  • Require authenticated sessions and per-user quotas on endpoints that accept encrypted key material to blunt repeated abuse.
bash
# Upgrade bc-csharp to the patched release
dotnet add package BouncyCastle.Cryptography --version 2.7.0

# Optional runtime cap for PKCS#12 iteration counts
export DOTNET_ENVIRONMENT_VAR_Org_BouncyCastle_Pkcs12_MaxIterations=1000000

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

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.