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

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

CVE-2026-63572 is a denial of service flaw in Bouncy Castle bc-csharp that allows attackers to cause CPU exhaustion through PKCS#12 files with extreme iteration counts. This article covers technical details, affected versions, impact assessment, and mitigation strategies.

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

CVE-2026-63572 is a denial-of-service vulnerability in the Legion of the Bouncy Castle bc-csharp cryptographic library before version 2.7.0. The flaw resides in PKCS#12 (PFX) keystore loading via Pkcs12Store.Load and Pkcs12Utilities.ConvertToDefiniteLength. An attacker who supplies a crafted PKCS#12 file can specify an iteration count close to 2^31 in the MacData or in the PBE parameters of an encrypted SafeContents or shrouded key bag. Because the library accepts the count without an upper bound and runs key derivation before the MAC or password can be validated, the parser performs billions of pseudo-random function iterations, exhausting CPU resources. The weakness is classified as [CWE-770: Allocation of Resources Without Limits or Throttling].

Critical Impact

Any application that loads attacker-controlled PKCS#12 files using bc-csharp before 2.7.0 can be rendered unresponsive through CPU exhaustion, with no authentication required.

Affected Products

  • Legion of the Bouncy Castle bc-csharp versions prior to 2.7.0
  • Applications invoking Org.BouncyCastle.Pkcs.Pkcs12Store.Load
  • Applications invoking Org.BouncyCastle.Pkcs.Pkcs12Utilities.ConvertToDefiniteLength

Discovery Timeline

  • 2026-10-02 - CVE-2026-63572 published to NVD
  • 2026-10-02 - Last updated in NVD database

Technical Details for CVE-2026-63572

Vulnerability Analysis

The vulnerability affects the PKCS#12 keystore parsing pipeline in bc-csharp. PKCS#12 files carry iteration counts used by Password-Based Encryption (PBE) and MAC computation. These counts drive how many times the underlying key derivation function (PKCS#5 PBKDF) is executed. The library reads these counts directly from the ASN.1 structure as an integer and feeds them to the key derivation routine without validating an upper bound.

Two API surfaces are affected: Pkcs12Store.Load, which parses and validates a PFX file for keystore use, and Pkcs12Utilities.ConvertToDefiniteLength, which re-encodes a PFX from BER to definite-length encoding. Both paths dereference untrusted iteration counts from file-controlled fields including MacData, encrypted SafeContents, and shrouded key bags.

Root Cause

The root cause is missing input validation on the iteration count parameter. The parsing code called IntValueExact on an ASN.1 integer sourced directly from the PFX and used the resulting value verbatim. An attacker can set the count close to Int32.MaxValue (approximately 2^31). Because key derivation runs before MAC verification or password checking, the attacker does not need a valid password or MAC to trigger the loop. A separate issue, CVE-2026-63575, covers zero or negative counts.

Attack Vector

Exploitation requires an attacker to deliver a malicious PKCS#12 file to a service that parses it. Typical attack surfaces include certificate upload endpoints, mutual TLS enrollment, keystore import workflows, code-signing pipelines, and automated certificate rotation tools. User interaction is required per the CVSS v4.0 vector (UI:P). Once loaded, a single request can pin a CPU core for an extended period, and repeated submissions amplify impact into a service outage.

text
// Patch excerpt: crypto/src/security/PbeUtilities.cs
// Cap PKCS#5 v1.5 PBE iteration count on PKCS#8 decrypt
            {
                PbeParameter pbeParams = PbeParameter.GetInstance(pbeParameters);
                salt = pbeParams.Salt.GetOctets();
-                iterationCount = pbeParams.IterationCountObject.IntValueExact;
+                iterationCount = CheckPbeIterationCount(pbeParams.IterationCountObject);
                keyBytes = PbeParametersGenerator.Pkcs5PasswordToBytes(password);
            }

Source: GitHub Commit 54ea0b17

text
// Patch excerpt: crypto/src/pkcs/Pkcs12Utilities.cs
// PKCS12: Validate iteration counts; introduces DefaultMaxIterations and
// a configurable property "Org.BouncyCastle.Pkcs12.MaxIterations"
+        private static readonly int DefaultMaxIterations = 5000000;
+
+        internal static readonly string MaxIterationsProperty = "Org.BouncyCastle.Pkcs12.MaxIterations";

Source: GitHub Commit 7c0ed15f

Detection Methods for CVE-2026-63572

Indicators of Compromise

  • PKCS#12 (.p12, .pfx) uploads whose MacData iteration count or PBE parameter iteration count approaches Int32.MaxValue (approximately 2,147,483,647).
  • Service processes consuming sustained 100% CPU on a single core immediately after a PFX import or certificate upload operation.
  • Repeated client submissions of PFX blobs from the same source triggering abnormal processing latency.

Detection Strategies

  • Inspect inbound PKCS#12 files at ingress and parse the ASN.1 structure to extract iteration counts before handing the file to bc-csharp.
  • Baseline normal PFX processing time for your application and alert on parse operations that exceed a reasonable threshold such as a few seconds.
  • Audit dependency manifests (packages.config, *.csproj, paket.dependencies) for BouncyCastle.Cryptography versions earlier than 2.7.0.

Monitoring Recommendations

  • Enable per-request CPU time metrics on endpoints that accept certificates or keystores and alert on outliers.
  • Log the identity, source IP, and file hash for every PKCS#12 import operation to support forensic correlation.
  • Monitor application worker-thread saturation and queue depth around certificate processing services.

How to Mitigate CVE-2026-63572

Immediate Actions Required

  • Upgrade bc-csharp (NuGet package BouncyCastle.Cryptography) to version 2.7.0 or later across all applications.
  • Enumerate every code path that calls Pkcs12Store.Load or Pkcs12Utilities.ConvertToDefiniteLength on untrusted input.
  • Rate-limit and authenticate endpoints that accept PKCS#12 uploads to reduce the blast radius of repeated submissions.

Patch Information

The fix is distributed across multiple commits in the bcgit/bc-csharp repository and shipped in release 2.7.0. The remediation introduces a DefaultMaxIterations cap of 5,000,000 in Pkcs12Utilities and a configurable Org.BouncyCastle.Pkcs12.MaxIterations property. A new CheckPbeIterationCount helper validates counts in PbeUtilities before invoking key derivation. See the GitHub CVE-2026-63572 Wiki, GitHub Commit 7c0ed15f, and GitHub Commit 54ea0b17 for the full set of changes.

Workarounds

  • Pre-validate PKCS#12 files with an independent ASN.1 parser and reject any file whose iteration counts exceed an organizational maximum, for example 5,000,000.
  • Isolate PFX parsing in a sandboxed worker process with strict CPU time and memory limits so an abusive file cannot degrade the main application.
  • Restrict PKCS#12 ingestion to authenticated administrators only until the upgrade is deployed.
bash
# After upgrading to bc-csharp 2.7.0, lower the iteration cap via the
# documented property (default is 5,000,000) when a stricter bound is desired.
export Org_BouncyCastle_Pkcs12_MaxIterations=600000

# Verify the installed package version in a .NET project
dotnet list package | grep -i BouncyCastle.Cryptography

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.