Intel

AIKIDO-2026-542614

zstd-safe is vulnerable to Use After Free

Use After Free Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published 3 days ago

35

Low Risk

This Affects:

RUSTzstd-safe
7.2.2 - 7.3.0
Fixed in 8.0.0
Are you affected? Scan for Free

TL;DR

AdvancedSeekable implements DerefMut, exposing a mutable reference to its inner Seekable context while a raw pointer to the boxed reader stays behind in the same struct. Safe code can call mem::swap on that reference to move the C context into an unrelated Seekable value, and dropping the original AdvancedSeekable then frees the boxed reader while the swapped-in context still holds a pointer into it. A later decompression call on the swapped context dereferences that freed reader through the FFI read/seek callbacks, producing a heap use after free. The fix removes the DerefMut implementation so callers can no longer split the context from its backing reader.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you use the seekable feature's AdvancedSeekable decompression wrapper.

Background info

zstd-safe is vulnerable to Use After Free in versions 7.2.2 - 7.3.0.

How to fix this

Upgrade the zstd-safe library to the patch version.

Are You Affected?

Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.

Free. No credit card required.

Aikido Platform