# zstd-sys WebAssembly allocator shim memory corruption on allocation failure

Source: https://junglewise.ai/threats/rustsec-2026-0410-webassembly-allocator-shim-corrupts-memory-on-43880bf6  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-10-16. Updated: 2026-10-28  
License: CC BY 4.0 with a link back

Severity: info · Published 2026-10-16

zstd-sys is a Rust library that provides WebAssembly compression functionality. When running on WebAssembly (wasm32), the library's memory allocator fails to handle out-of-memory conditions properly, allowing a maliciously crafted compressed frame to overwrite the module's memory. While the corruption is contained within the WebAssembly sandbox, this can cause the decompression process to fail or produce incorrect output.

Vendors: [crates.io](https://junglewise.ai/threats/vendors/crates-io), [Zstd-Rs](https://junglewise.ai/threats/vendors/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-sys (crates.io) SEMVER:introduced=2.0.9,fixed=2.1.2; Zstd-Rs Zstd-Sys 2.0.9 to 2.1.1.

**Is there a fix for This vulnerability?** Yes. zstd-sys (crates.io): upgrade to 2.1.2 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-sys (crates.io) or Zstd-Rs Zstd-Sys 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-sys (crates.io): upgrade to 2.1.2 or later

  ```sh
  cargo update -p zstd-sys
  ```


## Technical details

The vulnerability is a memory corruption bug in the wasm32 allocator shim used by zstd-sys. The shim wraps Rust's allocator to provide malloc/free to the bundled C library but does not validate allocation success: on failure, it writes a size header to address 0 and returns address 4 as a valid pointer. Exploitation requires the WebAssembly instance to exhaust available memory growth when decompressing a specially crafted frame (e.g., a 9-byte header declaring a 128 MiB decompression window), causing decoded data to be written to the bottom of linear memory instead of failing gracefully.

## Affected products

- zstd-rs zstd-sys 2.0.9 to 2.1.1

## Timeline

- 2026-10-16: disclosed
- 2026-10-26: patched

## References

- [https://crates.io/crates/zstd-sys](https://crates.io/crates/zstd-sys)
- [https://rustsec.org/advisories/RUSTSEC-2026-0410.html](https://rustsec.org/advisories/RUSTSEC-2026-0410.html)
