# CVE-2024-32481: vyper's range(start, start + N) reverts for negative numbers

- Severity: Medium 5.3 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.79%, higher than 57% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2024-04-25T17:00:54.082Z
- Modified: 2026-06-17T07:29:42.710Z
- Also known as: GHSA-ppx5-q359-pvwj, PYSEC-2024-246
- Weaknesses: CWE-681
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- vyperlang vyper: >= 0.3.8, < 0.4.0b1; from 0.3.8 up to 0.4.0b1; from 0.3.8 up to 0.3.10; 0.4.0
- vyper (PyPI): from 0.3.8 before 0.4.0; from 0.3.8 before 0.4.0b1

## Every score

- GitHub_M: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- GitHub: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- NVD: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- PyPA Advisory Database: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`

## References

- <https://github.com/vyperlang/vyper/security/advisories/GHSA-ppx5-q359-pvwj> (exploit, advisory, evidence, vendor-advisory, web)
- <https://github.com/vyperlang/vyper/commit/3de1415ee77a9244eb04bdb695e249d3ec9ed868> (fix, patch, web)
- <https://github.com/vyperlang/vyper/commit/5319cfbe14951e007ccdb323257e5ada869b35d5> (fix, patch, web)
- <https://github.com/vyperlang/vyper/blob/9136169468f317a53b4e7448389aa315f90b95ba/vyper/codegen/stmt.py#L286-L287> (product, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2024-32481> (advisory)
- <https://github.com/vyperlang/vyper> (package)
- <https://github.com/advisories/GHSA-ppx5-q359-pvwj> (advisory)

## Sources

- CVE List: [CVE-2024-32481](https://www.cve.org/CVERecord?id=CVE-2024-32481), CVE Terms of Use, modified 2024-08-02
- GitHub Advisory Database: [GHSA-ppx5-q359-pvwj](https://github.com/advisories/GHSA-ppx5-q359-pvwj), CC-BY-4.0, modified 2026-06-10
- NVD: [CVE-2024-32481](https://nvd.nist.gov/vuln/detail/CVE-2024-32481), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2024-246](https://osv.dev/vulnerability/PYSEC-2024-246), CC-BY-4.0, modified 2026-06-10

---

Page: https://cve.day/CVE-2024-32481 · Whole record: https://cve.day/CVE-2024-32481.json · Rebuilt by cve.day 2026-11-25T22:58:39.604Z
