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-103600 Overview
CVE-2026-103600 is an uncontrolled recursion vulnerability [CWE-674] in the ASN.1 parser of Legion of the Bouncy Castle bc-csharp versions before 2.7.0. The affected classes Asn1InputStream and Asn1StreamParser recursively parse each nested constructed element without any depth bound. A remote unauthenticated attacker can submit a crafted ASN.1 payload containing deeply nested constructed elements and crash the process. Approximately 2,000 nesting levels, encoded in roughly 8 KB of Distinguished Encoding Rules (DER), exhaust the default 1.5 MB .NET thread stack on Windows. The resulting StackOverflowException cannot be caught in managed code and terminates the host process.
Critical Impact
Any .NET application that parses untrusted ASN.1 data, including X.509 certificates, Certificate Revocation Lists (CRLs), CMS/PKCS#7, PKCS#8/PKCS#12, OCSP responses, and TLS Certificate messages, is exposed to unauthenticated remote denial of service.
Affected Products
- Legion of the Bouncy Castle Inc. bc-csharp versions prior to 2.7.0
- .NET applications consuming Org.BouncyCastle.Asn1.Asn1InputStream
- .NET applications consuming Org.BouncyCastle.Asn1.Asn1StreamParser
Discovery Timeline
- 2026-10-02 - CVE-2026-103600 published to NVD
- 2026-10-02 - Last updated in NVD database
Technical Details for CVE-2026-103600
Vulnerability Analysis
The flaw resides in the ASN.1 streaming parser implementation. Each constructed ASN.1 element, such as a SEQUENCE or SET, is handled by issuing a further recursive call into the parser. The implementation does not track or cap the recursion depth, so the attacker controls the call stack depth directly through the input encoding. On Windows, the .NET main-thread stack defaults to 1.5 MB, and about 2,000 nesting levels are sufficient to overflow it. Because StackOverflowException is a corrupted-state exception, the Common Language Runtime (CLR) terminates the entire process rather than allowing a try/catch to recover.
On threads provisioned with larger stacks, the parser does not crash immediately. Instead, parse time grows quadratically with nesting depth. The advisory reports roughly 9 seconds of CPU time to parse a 64 KB input, enabling an algorithmic complexity attack suitable for sustained CPU exhaustion.
Root Cause
The root cause is the absence of a depth counter in Asn1InputStream and Asn1StreamParser. Both classes delegated parsing of child elements to a new parser instance or a nested invocation without passing a decreasing depth budget. The fix introduces an explicit MaxDepth property, enforced through a DecrementDepth helper that throws Asn1Exception when the depth is exhausted.
Attack Vector
Exploitation requires only the ability to deliver ASN.1-encoded bytes to a vulnerable parser. No authentication or user interaction is needed. Realistic entry points include TLS handshakes that present a crafted certificate chain, OCSP response processing, S/MIME or CMS message validation, PKCS#12 keystore imports, and certificate upload endpoints. Both definite-length DER and indefinite-length Basic Encoding Rules (BER) forms are exploitable.
// Patch excerpt - crypto/src/asn1/Asn1InputStream.cs
public class Asn1InputStream
: FilterStream
{
+ public static readonly string MaxDepthProperty = "Org.BouncyCastle.Asn1.MaxDepth";
public static readonly string MaxLimitProperty = "Org.BouncyCastle.Asn1.MaxLimit";
+ internal static int DecrementDepth(int parentDepth)
+ {
+ if (parentDepth <= 0)
+ throw new Asn1Exception("maximum nested construction level reached");
+ return parentDepth - 1;
+ }
+ internal static int FindDepth()
+ {
+ if (int.TryParse(Platform.GetEnvironmentVariable(MaxDepthProperty), out int maxDepth))
+ return System.Math.Max(0, maxDepth);
+
+ return 32;
+ }
Source: bc-csharp commit 89c81b0
Detection Methods for CVE-2026-103600
Indicators of Compromise
- Unhandled System.StackOverflowException crashes in processes that use bc-csharp for certificate, CMS, or OCSP parsing.
- Windows Error Reporting entries referencing Org.BouncyCastle.Asn1.Asn1InputStream or Asn1StreamParser in the faulting stack.
- Sustained near-100% CPU on a single thread while parsing an inbound certificate chain or signed message.
Detection Strategies
- Inspect inbound TLS handshakes and uploaded PKCS artifacts for ASN.1 payloads whose nesting depth exceeds 32 constructed levels.
- Alert on repeated application process restarts that correlate with inbound requests carrying ASN.1 content types such as application/pkcs7-mime or application/ocsp-response.
- Baseline normal parse times for certificate validation code paths and flag outliers in the multi-second range on sub-100 KB inputs.
Monitoring Recommendations
- Enable .NET process crash telemetry and ship it to a central Security Information and Event Management (SIEM) platform for correlation.
- Monitor web application firewall and reverse-proxy logs for abnormally large or structurally anomalous X.509, CMS, or OCSP payloads.
- Track the installed version of BouncyCastle.Cryptography across build artifacts and running hosts to confirm remediation coverage.
How to Mitigate CVE-2026-103600
Immediate Actions Required
- Upgrade BouncyCastle.Cryptography to version 2.7.0 or later across all .NET services, libraries, and container images.
- Audit dependency graphs for transitive consumers of bc-csharp and rebuild downstream packages against the fixed release.
- Restart long-running processes after the upgrade to ensure the patched assembly is loaded.
Patch Information
The upstream fix is tracked in the bc-csharp CVE-2026-103600 wiki entry. The initial remediation adds the Org.BouncyCastle.Asn1.MaxDepth property, defaulting to 32 constructed levels, and enforces it through DecrementDepth (commit 89c81b0). A follow-up commit raises the default depth to 64 for broader compatibility with real-world certificates (commit b99f4e3):
// crypto/src/asn1/Asn1InputStream.cs
if (int.TryParse(Platform.GetEnvironmentVariable(MaxDepthProperty), out int maxDepth))
return System.Math.Max(0, maxDepth);
- return 32;
+ return 64;
}
Source: bc-csharp commit b99f4e3
Workarounds
- If upgrading immediately is not possible, place a validating proxy or application-layer filter in front of ASN.1-accepting endpoints to reject payloads whose constructed nesting exceeds application requirements.
- Enforce strict maximum sizes on uploaded certificates, PKCS#12 keystores, and CMS messages to limit the attack surface for the quadratic-time variant.
- After upgrading, tune the Org.BouncyCastle.Asn1.MaxDepth environment variable to the lowest value compatible with the application's legitimate inputs.
# Set a conservative ASN.1 nesting depth for .NET services
export Org_BouncyCastle_Asn1_MaxDepth=32
# PowerShell equivalent on Windows
[Environment]::SetEnvironmentVariable("Org.BouncyCastle.Asn1.MaxDepth", "32", "Machine")
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

