-
Notifications
You must be signed in to change notification settings - Fork 400
[GHSA-fc9h-whq2-v747] Valid ECDSA signatures erroneously rejected in Elliptic #5442
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
base: tal-sealsecurity/advisory-improvement-5442
Are you sure you want to change the base?
[GHSA-fc9h-whq2-v747] Valid ECDSA signatures erroneously rejected in Elliptic #5442
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (1)
- advisories/github-reviewed/2024/10/GHSA-fc9h-whq2-v747/GHSA-fc9h-whq2-v747.json: Language not supported
Hi @tal-sealsecurity, I read indutny/elliptic#321 (comment) and indutny/elliptic#321 (comment) and showed them to my colleagues. If the comments describe a bypass of the fix for CVE-2024-48948, as indutny/elliptic#321 (comment) suggests, getting a new CVE for the bypass is an option but not a requirement. If @indutny wants a CVE and makes a repository GHSA, GitHub can issue such a CVE. GitHub's CNA scope limits CVE issuing to maintainers using the repo GHSA feature. However, and I'm not a cryptography expert by any means, the comments read to me like they might be describing a separate vulnerability? I would be curious to hear more from @indutny and @bleichenbacher-daniel about the relationship between CVE-2024-48948 and the issues described in indutny/elliptic#321 (comment) and indutny/elliptic#321 (comment). |
It is essentially a deeper analysis of a bug in the library. Sometimes when one finds a bug in a library then it looks like this bug is benign, but further analysis reveals that the bug actually can be exploited. This happened here. The first reaction was that the bug is not critical. A more careful analysis however, shows that in some situations the private key can be leaked. For this to happen the attacker would need a faulty signature and also the correct signature for the same message. |
Thanks @shelbyc and @bleichenbacher-daniel ! This is due to private key with lower byte length. This will cause an invalid signature / private key when tested on other apps
code to generate a low byte key:
Example output:
Sample file:
|
Just a quick note. I may have some time next week to look into this. I haven't looked into private key generation, so I can't comment on this one. The libraries that pass all my tests for ECDSA over prime curves with RFC 6979 are:
I would think that comparing against any of these libraries gives a reliable comparison. The test vectors I'm using are here: https://github.com/bleichenbacher-daniel/Rooterberg |
👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the |
Just one small comment. I looked at the example from #5442 (comment) :
While the private key is indeed too short, the signature itself seems correct. I.e., I get the same signature with multiple libraries when a zero byte is prepended to the private key. Interestingly, this also includes python cryptography (pyca). Python cryptography can be built against different underlying libraries. Not sure if this could cause a discrepancy. I've also been running tests with more extreme edge cases for the private key with no new results. |
Updates
Comments
More edge cases: k hash is generated with leading 0 and given to BN in this example).
Continued discussion on indutny/elliptic#321
indutny/elliptic#321 (comment)
indutny/elliptic#321 (comment)