zstd memory exposure in write::Decoder on corrupt legacy frame

Severity: info · Published 2026-10-16

The zstd compression library's decompression component exposes uninitialized heap memory when processing corrupted legacy format frames. An attacker sending a malformed compressed stream could leak sensitive data from memory if the application forwards the decompressed output to an untrusted destination or logs it.

Technologies: zstd (crates.io). 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 (crates.io) SEMVER:introduced=0.4.22,fixed=0.8.0; Zstd-Rs Zstd 0.4.22 through 0.7.x.
Is there a fix for This vulnerability?
Yes. zstd (crates.io): upgrade to 0.8.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.
Am I affected?
Check whether you run zstd (crates.io) or Zstd-Rs Zstd 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 (crates.io): upgrade to 0.8.0 or later
    cargo update -p zstd

Technical details

The write::Decoder component sets its output buffer to full capacity before decompression, then resizes it based on the reported write position. When decompression fails on a legacy zstd frame, the bundled zstd library reports the buffer as fully written when nothing was actually written, causing up to 32 KiB of uninitialized heap memory to be passed to the wrapped writer. Legacy frame support is enabled by default and requires only a few corrupt bytes to trigger; from version 0.8.0 onward, the vulnerability is mitigated by using zstd-safe's buffers.

Affected products

  • zstd-rs zstd 0.4.22 through 0.7.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.