CVE-2024-32481
vyper's range(start, start + N) reverts for negative numbers
Check your servers for CVE-2024-32481
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2024-32481 affects vyper, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
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.
Severity (CVSS)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- none: the attacker does not need an account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality none, integrity low, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.79%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 57.4% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 29 Apr 2024):
- Exploitation
- poc: a proof of concept is public
- Automatable
- yes: an attacker can automate the attack across many targets
- Technical impact
- partial: limited control or limited data
Weakness
- CWE-681 Incorrect Conversion between Numeric Types
Affected products
As the CNA lists them.
Is my server affected?
Find the installed version of vyper and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i vyper
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2024-32481 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2024-32481RHEL, Rocky, Alma, Fedora
rpm -q vyper
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2024-32481Alpine
apk list --installed | grep -i vyperWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2024-32481
trivy image --scanners vuln IMAGE | grep CVE-2024-32481
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
Other references
- https://github.com/vyperlang/vyper/commit/3de1415ee77a9244eb04bdb695e249d3ec9ed868 github.com
- https://github.com/vyperlang/vyper/commit/5319cfbe14951e007ccdb323257e5ada869b35d5 github.com
- https://github.com/vyperlang/vyper/blob/9136169468f317a53b4e7448389aa315f90b95ba/vyper/codegen/stmt.py#L286-L287 github.com
Source: the record CVE-2024-32481 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse