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

Invalid range check in DSA signature verification #286

Closed
koto opened this issue Feb 9, 2015 · 6 comments
Closed

Invalid range check in DSA signature verification #286

koto opened this issue Feb 9, 2015 · 6 comments
Labels

Comments

@koto
Copy link
Contributor

koto commented Feb 9, 2015

r and s parameters in DSA should satisfy the condition: 0 < r′ < q and 0 < s′ < q, see e.g. FIPS 186-4 4.7.

Instead you're checking 0 <= r′ <= q and 0 <= s′ <= q (https://github.com/openpgpjs/openpgpjs/blob/master/src/crypto/public_key/dsa.js#L105-L111)

Edited: This vulnerability was found by Daniel Bleichenbacher of Google.

@koto
Copy link
Contributor Author

koto commented Feb 9, 2015

Combined with the fact that the modular inverse implementation returns 0 when the inverse does not exist this allows for easy, universal DSA signature verification bypass.

@tanx
Copy link
Member

tanx commented Feb 9, 2015

Good catch @koto, thanks.

I spoke with @toberndo and we'll try to fix this asap.

@koto
Copy link
Contributor Author

koto commented Feb 9, 2015

My suggested fix is to
a) correct the ranges check and
b) assert that the modular inverse is NOT 0.

@tanx tanx added the Security label Feb 9, 2015
@koto
Copy link
Contributor Author

koto commented Feb 10, 2015

To note, this vulnerability was found by Daniel Bleichenbacher of Google, I'm merely reporting this.

@tanx
Copy link
Member

tanx commented Feb 10, 2015

Noted. Tell Daniel thanks and that he is owed a beer by whiteout :)

@koto
Copy link
Contributor Author

koto commented Feb 10, 2015

I created a pull request with the fix. #288

@tanx tanx closed this as completed in 1728ad4 Feb 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants