-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CVE‐2026‐13506
Title: Lazy ASN.1 sequence forcing resets nesting-depth guard.
Issue affecting: BC before 1.85, BC-LTS before 2.73.12, BC-FJA before bc-fips 1.0.2.7, 2.0.2 and 2.1.3.
Fixed versions: BC 1.85, BC-LTS 2.73.12, BC-FJA bc-fips 1.0.2.7, 2.0.2 and 2.1.3.
Platform affected: Java 8 and later.
In Bouncy Castle's ASN.1 layer, LazyEncodedSequence.force() creates a fresh ASN1InputStream with a re-initialised nesting-depth counter rather than inheriting the remaining depth from the parse that produced it, and the lazy SEQUENCE branch never calls createSubStream()/decrementDepth(). X509CRLHolder and the BC CertificateFactory CRL path enable lazy evaluation, and TBSCertList stores revokedCertificates as an unforced lazy sequence. An attacker who can supply a ~40-50KB DER CRL whose revokedCertificates is a chain of ~10,000 nested SEQUENCEs causes hashCode()/equals()/toDERObject()/getEncoded()/isSignatureValid() to recurse one Java frame per level with a fresh depth budget each time. The result is a StackOverflowError that is typically uncaught and kills the handling thread, yielding a denial of service.
The fix was introduced in commit 77454da9b3dc.