Skip to content

asn1: limit nesting depth in OpenSSL::ASN1.decode#1060

Open
rhenium wants to merge 1 commit into
ruby:masterfrom
rhenium:ky/asn1-decode-limit-recursion
Open

asn1: limit nesting depth in OpenSSL::ASN1.decode#1060
rhenium wants to merge 1 commit into
ruby:masterfrom
rhenium:ky/asn1-decode-limit-recursion

Conversation

@rhenium
Copy link
Copy Markdown
Member

@rhenium rhenium commented May 29, 2026

Feeding a deeply nested constructed encoding to OpenSSL::ASN1.decode, .decode_all, or .traverse can cause unbounded recursion and result in raising SystemStackError instead of OpenSSL::ASN1::ASN1Error.

Add an explicit nesting depth limit of 200 levels. This is an arbitrary limit and not configurable, but it should be sufficient for typical use cases.

Fixes https://hackerone.com/reports/3662125

Feeding a deeply nested constructed encoding to OpenSSL::ASN1.decode,
.decode_all, or .traverse can cause unbounded recursion and result in
raising SystemStackError instead of OpenSSL::ASN1::ASN1Error.

Add an explicit nesting depth limit of 200 levels. This is an arbitrary
limit and not configurable, but it should be sufficient for typical use
cases.

Fixes https://hackerone.com/reports/3662125
@rhenium rhenium force-pushed the ky/asn1-decode-limit-recursion branch from 1fe4d7d to 85a6263 Compare May 29, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant