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

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

CVE-2026-103604 is a denial of service vulnerability in Bouncy Castle bc-csharp that allows attackers to exhaust CPU resources through crafted X.509 names. This post explains its technical details, affected versions, 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-103604 Overview

CVE-2026-103604 is an algorithmic complexity vulnerability in the Legion of the Bouncy Castle bc-csharp library before version 2.7.0. The flaw resides in X.509 distinguished name string conversion routines, specifically X509Name.ToString and IetfUtilities.ValueToString. A remote unauthenticated attacker can trigger quadratic CPU work by submitting a certificate, Certificate Revocation List (CRL), certification request, or other structure whose attribute values contain many characters requiring escaping. Applications that log, display, or compare such names are exposed to denial of service through CPU exhaustion.

Critical Impact

Remote unauthenticated attackers can exhaust CPU resources on any .NET application that parses attacker-controlled X.509 names using vulnerable bc-csharp versions.

Affected Products

  • Legion of the Bouncy Castle bc-csharp versions prior to 2.7.0
  • .NET applications performing X.509 certificate, CRL, or CSR parsing with bc-csharp
  • PKIX path validation workflows evaluating directoryName name constraints via IetfUtilities.RdnAreEqual

Discovery Timeline

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

Technical Details for CVE-2026-103604

Vulnerability Analysis

The vulnerability is an Algorithmic Complexity Attack classified under [CWE-407]. When bc-csharp converts an X.509 distinguished name attribute value to its string representation, it must escape reserved characters such as commas and leading or trailing spaces with a backslash. The implementation inserts each escaping backslash directly into the buffer being scanned. Because subsequent iterations re-scan the growing buffer, the total work grows quadratically with the length of the input value.

An attacker supplying a single long attribute value composed of characters that require escaping forces the parser into O(n²) behavior. On modern hardware, inputs of only tens of kilobytes can produce multi-second CPU stalls, and larger inputs scale accordingly to produce sustained denial of service conditions on worker threads.

Root Cause

The root cause is unbounded in-place buffer rewriting during escape processing in X509Name.ToString and IetfUtilities.ValueToString. Each escape insertion mutates the scanned buffer rather than appending to a separate output builder, so loop iteration count scales with cumulative length rather than original input length. The result is quadratic time complexity on attacker-controlled data.

Attack Vector

Exploitation requires no authentication and no user interaction. Any code path that converts an attacker-supplied X.509 name to a string is reachable, including certificate logging, administrative UI display, and PKIX validation of directoryName name constraints. Common exposed surfaces include TLS termination services, S/MIME processors, code-signing verifiers, and PKI management tools built on bc-csharp.

An attacker can deliver a crafted certificate during a TLS handshake, submit a malicious CSR to an enrollment endpoint, or publish a hostile CRL. The vulnerability manifests server-side as sustained CPU consumption on the thread parsing the structure. See the Bouncy Castle advisory for the vendor's technical description.

Detection Methods for CVE-2026-103604

Indicators of Compromise

  • Sustained single-threaded CPU saturation in .NET processes correlating with inbound TLS, LDAP, or PKI-related traffic
  • Unusually large X.509 attribute values (hundreds of KB or more) observed in certificates, CRLs, or CSRs reaching the application
  • Thread stacks blocked inside Org.BouncyCastle.Asn1.X509.X509Name.ToString or IetfUtilities.ValueToString during profiling

Detection Strategies

  • Inventory .NET assemblies and resolve dependencies on BouncyCastle.Cryptography or Portable.BouncyCastle with versions below 2.7.0.
  • Deploy inbound inspection to flag X.509 structures containing attribute values that exceed reasonable length thresholds or contain high densities of escape-triggering characters.
  • Instrument process-level CPU and latency telemetry around certificate validation entry points to detect quadratic time spikes.

Monitoring Recommendations

  • Alert on repeated handshake failures or request timeouts coinciding with elevated CPU on TLS-facing services.
  • Capture Software Bill of Materials (SBOM) data continuously to flag reintroduction of vulnerable bc-csharp versions.
  • Correlate web application firewall (WAF) and reverse-proxy logs for anomalous payload sizes submitted to certificate enrollment or upload endpoints.

How to Mitigate CVE-2026-103604

Immediate Actions Required

  • Upgrade bc-csharp to version 2.7.0 or later across all affected applications and container images.
  • Rebuild and redeploy any statically linked or vendored copies of Bouncy Castle components.
  • Audit application code for calls to X509Name.ToString and IetfUtilities.RdnAreEqual on untrusted input.

Patch Information

The fix is included in bc-csharp 2.7.0. Review the upstream fix in the GitHub commit and the vendor CVE wiki page for implementation details.

Workarounds

  • Enforce strict upper bounds on the size of incoming certificates, CRLs, and CSRs at the network edge.
  • Reject X.509 attribute values exceeding a defensible length (for example, 1 KB) before passing structures to Bouncy Castle parsers.
  • Isolate certificate parsing in bounded worker threads with CPU time limits to contain impact until patching completes.
bash
# Upgrade bc-csharp via NuGet to the fixed version
dotnet add package BouncyCastle.Cryptography --version 2.7.0

# Verify the resolved version in the project
dotnet list package --include-transitive | grep -i bouncycastle

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.