-
Notifications
You must be signed in to change notification settings - Fork 388
Add ruzstd
uninit/out-of-bounds memory reads advisory
#2147
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
Conversation
Thank you for the report! We normally use the AFAIK it's not settled whether it is OK to copy uninitialized u8 values without ever observing them, and the compiler currently does not exploit that for optimization purposes. However, I am concerned about the risk of exposing contents of uninitialized memory via a crafted input. I would like to hear from the maintainers about the potential impact of this issue. |
Hi, maintainer of ruzstd here: As far as I can tell this could, with specially crafted inputs, result in the decoded output containing up to 15 bytes of heap memory that didn't belong to the allocation of the ringbuffer used during decoding. More specifically up to 15 bytes directly after that allocation. So this could maybe be used to exfiltrate data from a process, if the process
Edit: The 15 bytes are the result of copying data using 128bit registers on SSE platforms. On other platforms a usize is used so on those it would be Edit 2: That's 15 bytes per case that the UB is hit which can happen multiple times per archive. The Buffer will re-allocate if it gets full, similar to Vec but it won't if the user drains it regularly. So the attacker might read a few different locations multiple times over the course of the decoding process, depending on how ringbuffer is drained. |
Can I ask what the recommended/common next steps are here? This is the first handling such a situation as a maintainer. My guess would be:
Am I missing something? |
db35bcb
to
c5b92d8
Compare
I've updated the advisory with some of the feedback.
I think the issue was introduced by KillingSpark/zstd-rs@2ee37fd. I've run miri on a checkout of v0.6.0 and it found no issues. Because of this I put
I've put
I added the |
Cross posting here too that the v0.7.3 release fixing the issue is out |
This fixes the yet to be published advisory for uninit/out-of-bounds memory reads and potential exposure. See rustsec/advisory-db#2147
Creates the advisory for the vulnerability reported at KillingSpark/zstd-rs#75, fixed by KillingSpark/zstd-rs#76, and released as https://github.com/KillingSpark/zstd-rs/releases/tag/v0.7.3.