Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Audit libflate #1

Closed
Shnatsel opened this issue Jul 21, 2019 · 5 comments
Closed

Audit libflate #1

Shnatsel opened this issue Jul 21, 2019 · 5 comments

Comments

@Shnatsel
Copy link
Member

https://crates.io/crates/libflate

DEFLATE compression/decompression, 3000 downloads/day, exposed to untrusted data, has unsafe code.

@Shnatsel
Copy link
Member Author

I've done the audit. Issues discovered:
sile/libflate#29
sile/libflate#31
sile/libflate#33
sile/libflate#35

I've also fixed the code and dropped unsafe blocks where possible:
sile/libflate#30
sile/libflate#32
sile/libflate#34
sile/libflate#36
sile/libflate#37
sile/libflate#38

@Shnatsel
Copy link
Member Author

Unsafe blocks that could not be removed without regressing performance are blocked by:

  1. Reading a CString safely without overhead from Read rust-lang/rust#59229 for reading a CString from a stream without checking all bytes for zeroes twice
  2. RFC for Vec::append_from_within() rust-lang/rfcs#2714 for efficiently appending contents of a vector to itself

@Shnatsel
Copy link
Member Author

Security advisories:

https://rustsec.org/advisories/RUSTSEC-2019-0010.html

and we still need to figure out if sile/libflate#33 is exploitable or not. Once that's done this issue can be closed (and the blockers moved to some kind of central tracker, I guess markdown files in this repo?)

@Shnatsel
Copy link
Member Author

Exploitability analysis done, the flaw is found to be not exploitable. We're done!

@mleonhard
Copy link

sile/libflate#67 adds forbid(unsafe_code) 🎉

8573 added a commit to 8573/safety-dance that referenced this issue Mar 25, 2022
Shnatsel added a commit that referenced this issue Mar 25, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants