Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkey: use RSTRING_LENINT() instead of casting to int #460

Merged
merged 1 commit into from Sep 28, 2021

Conversation

rhenium
Copy link
Member

@rhenium rhenium commented Sep 28, 2021

RSTRING_LENINT() checks the range of int and raises an exception as
necessary. OpenSSL::PKey::EC#dsa_verify_asn1 currently does not do this,
and giving a too big string to it can trigger a surprising behavior:

ec.dsa_verify_asn1(digest, signature)               #=> true
ec.dsa_verify_asn1(digest, signature + "x" * 2**32) #=> true

Reference: https://hackerone.com/reports/1246050

RSTRING_LENINT() checks the range of int and raises an exception as
necessary. OpenSSL::PKey::EC#dsa_verify_asn1 currently does not do this,
and giving a too big string to it can trigger a surprising behavior:

    ec.dsa_verify_asn1(digest, signature)               #=> true
    ec.dsa_verify_asn1(digest, signature + "x" * 2**32) #=> true

Reference: https://hackerone.com/reports/1246050
@rhenium rhenium merged commit 6880dba into ruby:maint-2.1 Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant