Miggo Logo

GHSA-qq4c-hm99-979m: IdMap from_iter may lead to uninitialized memory being freed on drop

N/A

CVSS Score

Basic Information

CVE ID
-
EPSS Score
-
Published
8/18/2025
Updated
8/18/2025
KEV Status
No
Technology
TechnologyRust

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
id-maprust>= 0.1.6, < 0.2.20.2.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability lies in the id_map::IdMap::from_iter constructor, which can create a malformed IdMap instance. Specifically, it initializes the ids field based on the capacity of the values vector, which can be larger than the number of elements actually initialized from the input iterator. When an IdMap created this way is dropped, its destructor (id_map::IdMap::drop) calls id_map::IdMap::drop_values. This function then iterates over the oversized ids set and attempts to drop elements from the values vector, leading to reads of uninitialized memory and subsequent attempts to free it. This results in undefined behavior and can cause a segmentation fault. The fix involves changing from_iter to correctly size the ids set based on the number of elements and removing the manual, unsafe drop implementation in favor of safer, compiler-generated code.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

*u* to * *l*w in t** *onstru*tor `i*_m*p::I*M*p::*rom_it*r`, ill-*orm** o*j**ts m*y ** *r**t** in w*i** t** *mount o* **tu*lly initi*liz** m*mory is l*ss t**n w**t is *xp**t** *y t** *i*l*s o* `I*M*p`. Sp**i*i**lly, t** *i*l* `i*s` is initi*liz** **s

Reasoning

T** vuln*r**ility li*s in t** `i*_m*p::I*M*p::*rom_it*r` *onstru*tor, w*i** **n *r**t* * m*l*orm** `I*M*p` inst*n**. Sp**i*i**lly, it initi*liz*s t** `i*s` *i*l* **s** on t** **p**ity o* t** `v*lu*s` v**tor, w*i** **n ** l*r**r t**n t** num**r o* *l*