Use-after-free with `CParameter::StableInBuffer`
- Published
- Last modified
- Where the record stands: published, rejected by its publisher, or superseded by another id.What do these mean? →
- published
- Whether CISA lists it in its Known Exploited Vulnerabilities catalog: proof that attackers are using it.What do these mean? →
- Not listed in CISA KEV
- Fix
- Fixed in 8.2.0
- Whether working attack code is public (Exploit-DB, Metasploit, Nuclei or GitHub). Public code makes attacks easier.What do these mean? →
- None on Exploit-DB, Metasploit or GitHub
Summary
The Rust bindings for the zstd compression library (the `zstd-safe` crate) are affected when the experimental `StableInBuffer` option is enabled, and so is the underlying C zstd library, whether bundled or linked from the system. Memory that was already freed by the program can end up in compressed output, which could expose unrelated data from the program's memory.
Summarized by anthropic/claude-haiku-5.5. Verify details against the original sources.
Read the original description
With `CParameter::StableInBuffer(true)` (`experimental` feature), the C library keeps a pointer to the input of one streaming call and reads from it in later calls, including `flush_stream` and `end_stream`, which take no input. An `InBuffer` only borrows its slice for one call, so safe code could free it in between, and freed memory was compressed into the frame. The C library behaves this way since zstd 1.5.4, whether bundled or linked from the system. The flaw was corrected by refusing to enable the parameter.
Timeline
- Advisory published
- Record last updated
Affected versions
- zstd-safecrates.io
From 4.1.0 · fixed in 8.2.0