zstd-safe memory exposure in streaming decompression

Severity: info · Published 2026-10-16

zstd-safe is a Rust library for data compression and decompression. When decompression of a corrupt legacy-format compressed file fails, uninitialized heap memory (up to 32 KB) is incorrectly exposed through the output stream. An attacker who can control the compressed input could leak sensitive data from the server's memory if that output is sent to untrusted destinations.

Technologies: zstd-safe (crates.io), Zstd-Rs Zstd-Safe. Vendors: crates.io, Zstd-Rs.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Informational severity, published 16 October 2026.
Which products and versions are affected?
zstd-safe (crates.io) SEMVER:introduced=4.0.0,fixed=8.2.0; Zstd-Rs Zstd-Safe 4.0.0 to 8.1.x.
Is there a fix for This vulnerability?
Yes. zstd-safe (crates.io): upgrade to 8.2.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run zstd-safe (crates.io) or Zstd-Rs Zstd-Safe at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • zstd-safe (crates.io): upgrade to 8.2.0 or later
    cargo update -p zstd-safe

Technical details

The DCtx::decompress_stream function incorrectly commits buffer positions on decompression failure, causing Vec<u8> destinations to extend over uninitialized memory when a legacy-format frame fails. A 5–6 byte corrupt legacy frame triggers this; exposure occurs through zstd::stream::write::Decoder on the next write(), flush(), or when the decoder is dropped. The vulnerability requires streaming decompression (read/decode_all/bulk APIs are unaffected) and affects versions 4.0.0–8.1.x.

Affected products

  • zstd-rs zstd-safe 4.0.0 to 8.1.x

Timeline

  • 2026-10-16: disclosed
  • 2026-10-26: advisory

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.