vyper's range(start, start + N) reverts for negative numbers
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- None · Low · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.
Summary
Vyper is a pythonic Smart Contract Language for the Ethereum virtual machine. Starting in version 0.3.8 and prior to version 0.4.0b1, when looping over a `range` of the form `range(start, start + N)`, if `start` is negative, the execution will always revert. This issue is caused by an incorrect assertion inserted by the code generation of the range `stmt.parse_For_range()`. The issue arises when `start` is signed, instead of using `sle`, `le` is used and `start` is interpreted as an unsigned integer for the comparison. If it is a negative number, its 255th bit is set to `1` and is hence interpreted as a very large unsigned integer making the assertion always fail. Any contract having a `range(start, start + N)` where `start` is a signed integer with the possibility for `start` to be negative is affected. If a call goes through the loop while supplying a negative `start` the execution will revert. Version 0.4.0b1 fixes the issue.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- Yes
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| vyperlang | vyper | 0.3.8 to before 0.4.0b1 | 0.4.0b1 | Patch available | CNA |
| — | vyper (PyPI) | 0.3.8 to before 0.4.0 | 0.4.0 | Patch available | GHSA-ppx5-q359-pvwj |
- vyper Vendorvyperlang Affected 0.3.8 to before 0.4.0b1 Fixed in 0.4.0b1 Patch available CNA
- vyper (PyPI) Vendor— Affected 0.3.8 to before 0.4.0 Fixed in 0.4.0 Patch available GHSA-ppx5-q359-pvwj
Remediation
- Fix · CNA vyper (vyperlang) Fixed in 0.4.0b1
- Fix · GHSA-ppx5-q359-pvwj vyper (PyPI) Fixed in 0.4.0 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2024-32481
- 2026-10-03 Alias added: GHSA-ppx5-q359-pvwj
References
Patch 2
More vyperlang Vyper vulnerabilities
- TI-2024-16182 Vyper bounds check on built-in `slice()` function can be overflowed CVSS 3.1CRITICAL 9.8
- TI-2024-14992 concat built-in can corrupt memory in vyper CVSS 3.1CRITICAL 9.8
- TI-2024-16184 Vyper array negative index vulnerability CVSS 3.1CRITICAL 9.8
- TI-2022-08657 Integer bounds error in Vyper CVSS 3.1CRITICAL 9.8
- TI-2022-11796 Multiple evaluation of contract address in call in vyper CVSS 3.1HIGH 8.2
- TI-2024-21531 vyper performs double eval of the argument of sqrt CVSS 3.1MEDIUM 5.3
Sources
- CVE-2024-32481 · CVE Program
- CVE-2024-32481 · NVD
- FIRST EPSS
- GHSA-ppx5-q359-pvwj · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences