-
Notifications
You must be signed in to change notification settings - Fork 362
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
Add soundness bug in secp256k1
API
#1480
Conversation
The `v0.24.1` release has been yanked due to a soundness bug. See here for more: rustsec/advisory-db#1480
Versions `>= 0.24.0` have a soundness bug, so we need to ensure people are using `>= 0.24.2` See here for more: rustsec/advisory-db#1480
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.
I have zero experience with filing RUSTSEC advisories but FWIW I checked all links are valid and read over for grammar and correctness.
Summary: Unsound API in `secp256k1` allows use-after-free and invalid deallocation from safe code. This was fixed and backported to multiple versions.
fd6920c
to
0e0f303
Compare
Looks good to me, thank you! Is this easy to trigger unintentionally? If so, we might want to drop |
@Shnatsel hard to say, it's possible that the specific function isn't even used at all in any outside code. Neither github search nor grep.app show anything interesting so if it's used anywhere it's probably closed source. However it kinda bypasses borrow checking so the consequences are probably quite bad. If |
I don't think so -- you need to be using a special no-alloc version of our API (which already excludes the vast majority of users), and then you need to pass it a backing store with a finite lifetime (which would be a little weird for a backing store), and then you'd need to use the object from our API beyond the backing store's lifetime (which would likely be caught in code review -- unless the reviewer was working from a "Rust will protect us from such things" mental model -- and if not, would likely reliably cause a double-free crash). |
I think not wasting brain power on reviewing those things is part of the point of Rust so my guess is most people do. (Including myself; and you know how crazy my reviews are... ;)) |
Based on @apoelstra's comment this sounds like |
Yep, sounds good. Thanks for the explanation. Merging! |
Summary: Unsound API in
secp256k1
allows use-after-free and invalid deallocation from safe code. This was fixed and backported to multiple versions.I'm not sure whether the
date
field should have todays date, will change if it needs something else.Cc @apoelstra @tcharding