-
Notifications
You must be signed in to change notification settings - Fork 161
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
ascon-aead: zeroize buffer during decryption on failed tag check #659
Conversation
e5e6fa5
to
5bd3538
Compare
I would suggest fixing it the same way as GHSA-423w-p2w9-r7vq by returning an unmodified buffer, as opposed to a zeroed one |
IIUC the current implementation performs one-pass decryption. To return "unmodified buffer" we would need to encrypt the message back. |
Yes, that was how it was solved in GHSA-423w-p2w9-r7vq as well |
Zeroizing the buffer looks like a good, simple, and straightforward solution to me. Personally, I don't see the point in encrypting the data back, so I don't plan to work on it myself. I created the backport branch, so you could create an alternative PR. |
If nothing else the solution we should choose should be consistent across crates. You didn't make a similar argument with I guess we could change both crates if you really want to use zeroing. A zeroed message may be semantically meaningful in the context where an attacker is using it. If the risk is the caller ignoring the error somehow, I think a zeroed message has a higher chance of causing problems. Keeping the original ciphertext is closer to a pseudorandom rejection symbol, which IMO is less useful to the attacker. |
This could also use a regression test |
In the Encrypting the buffer back could also be weird together with the planned
We can not protect users from all potential stupidity on the Earth.
Yes, but I got stuck a bit with the "smart" |
Returning the original ciphertext on verification failure is closer to this ideal than mutating it with zeros, even if it's being decrypted and re-encrypted behind the scenes. |
What is done in other cryptographic libraries? |
9b4944f
to
27e4444
Compare
ring does not specify:
The other crates in this repo beyond |
I meant other libraries outside of the Rust ecosystem. |
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 don't have time to do a thorough investigation. This is a security fix so I guess let's just get it out.
It seems easy enough to be have consistent behavior with the other crates I thought I'd point it out along with the past precedent and wasn't expecting this to become some kind of protracted debate, but in the interest of getting the fix out I'll give up for now and perhaps we can change it as a followup.
No description provided.