Miggo Logo

CVE-2023-30837: vyper vulnerable to storage allocator overflow

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.37764%
Published
5/5/2023
Updated
11/19/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

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

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stemmed from the storage allocator's lack of overflow checks. The commit diff shows:

  1. A new SimpleStorageAllocator class was added with explicit overflow checks
  2. The original set_storage_slots function used a simple counter (storage_slot += math.ceil(...)) without overflow protection
  3. The example exploit demonstrates that wrapping the storage slot calculation allowed overwriting the 'owner' variable
  4. Tests were added to validate overflow prevention (test_allocator_overflow) The core issue was in the storage position calculation logic handled by set_storage_slots, which failed to prevent 256-bit integer overflows during allocation.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t T** stor*** *llo**tor *o*s not *u*r* ***inst *llo**tion ov*r*lows. T*is **n r*sult in vuln*r**iliti*s lik* t** *ollowin*: ```vyp*r own*r: pu*li*(***r*ss) t*k*_up_som*_sp***: pu*li*(uint***[**]) *u***r: pu*li*(uint***[m*x_v*lu*(uint***)])

Reasoning

T** vuln*r**ility st*mm** *rom t** stor*** *llo**tor's l**k o* ov*r*low ****ks. T** *ommit *i** s*ows: *. * n*w Simpl*Stor****llo**tor *l*ss w*s ***** wit* *xpli*it ov*r*low ****ks *. T** ori*in*l s*t_stor***_slots *un*tion us** * simpl* *ount*r (sto