Intel

AIKIDO-2026-251973

zstd is vulnerable to Use-After-Free

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

59

Medium Risk

This Affects:

RUSTzstd
0.4.20 - 0.13.3
Fixed in 0.14.0
Are you affected? Scan for Free

TL;DR

The with_prepared_dictionary constructors on the streaming and raw Encoder/Decoder register the supplied EncoderDictionary/DecoderDictionary with the underlying zstd context by raw pointer without tying the dictionary borrow to the context lifetime. Safe code can drop the dictionary while the encoder or decoder is still alive, leaving the context with a dangling pointer into freed memory. The next compression or decompression call dereferences that pointer, a use-after-free reachable without any unsafe. The fix constrains the dictionary reference to &'a so the borrow checker keeps the dictionary alive as long as the stream that uses it.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you build an encoder or decoder with the with_prepared_dictionary constructors.

Background info

zstd is vulnerable to Use-After-Free in versions 0.4.20 - 0.13.3.

How to fix this

Upgrade the zstd 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