Medium, CVSS 5.3crates.ioPublished
zlib-rs stack overflow during decompression with malicious input
GHSA-j3px-q95c-9683
- Affected
- crates.io zlib-rs <= 0.3.1
- Fixed in
- 0.4.0· Vendor fix available
- Issue
- A denial of service vulnerability was found in zlib-rs, triggered by specially constructed input. This input causes a stack overflow, resulting in the process using zlib-rs to crash. Impact Due to the way LLVM handles the zlib-rs codebase, tail calls were not guaranteed. This caused certain input patterns to result in a large number of stack frames being required, quickly resulting in a stack overflow. These are unlikely to occur in practice, but a dedicated attacker can construct malicious input files. After stack overflows were found by @inahga with a fuzzer, we dove into the assembly, and found some cases where the stack grew LLVM wants to centralize the cleanup before the return (many other blocks jump to LBB109311), thereby invalidating a tail call to typedo. We were not able to get rid of this call without introducing one elsewhere: we just don't currently have the power to tell LLVM what we want it to do. So, we switch back to loop+match waiting for changes to rust to make a…
Recommended action: Upgrade to 0.4.0 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.