CVE-2021-29935: Use after free in Rocket
7.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.60529%
CWE
Published
8/25/2021
Updated
6/13/2023
KEV Status
No
Technology
Rust
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
rocket | rust | < 0.4.7 | 0.4.7 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the original implementation of 'with_prefix' which performed unsafe lifetime manipulation via transmute and lacked panic safety. The function's control flow allowed user-provided code (through callback 'f') to execute between push/pop operations on the prefixes stack. The commit diff shows the fix involved introducing a guard pattern with Drop
implementation to ensure stack cleanup even during panics, confirming the original function's unsafe structure. The test case added in the commit specifically demonstrates how a panic during this window could lead to use-after-free via the prefixes stack.