Miggo Logo

CVE-2021-29935: Use after free in Rocket

7.3

CVSS Score
3.1

Basic Information

EPSS Score
0.60529%
Published
8/25/2021
Updated
6/13/2023
KEV Status
No
Technology
TechnologyRust

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
rocketrust< 0.4.70.4.7

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

*****t** v*rsions o* t*is *r*t* tr*nsmut** * &str to * &'st*ti* str ***or* pus*in* it into * St**kV**, t*is v*lu* w*s t**n popp** l*t*r in t** s*m* *un*tion. T*is w*s *ssum** to ** s*** ****us* t** r***r*n** woul* ** v*li* w*il* t** m*t*o*'s st**k w

Reasoning

T** vuln*r**ility st*ms *rom t** ori*in*l impl*m*nt*tion o* 'wit*_pr**ix' w*i** p*r*orm** uns*** li**tim* m*nipul*tion vi* tr*nsmut* *n* l**k** p*ni* s***ty. T** *un*tion's *ontrol *low *llow** us*r-provi*** *o** (t*rou** **ll***k '*') to *x**ut* **t