CVE-2024-24561 Vyper bounds check on built-in `slice()` function can be overflowed

Critical 9.8 Published Updated

Attackers can exploit an integer overflow in Vyper's slice bounds check to access or corrupt out-of-bounds storage, memory, or calldata.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-24561?

CVE-2024-24561 is a critical vulnerability in vyperlang vyper, published on 1 Feb 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Vyper is a pythonic Smart Contract Language for the ethereum virtual machine. In versions 0.3.10 and earlier, the bounds check for slices does not account for the ability for start + length to overflow when the values aren't literals. If a slice() function uses a non-literal argument for the start or length variable, this creates the ability for an attacker to overflow the bounds check. This issue can be used to do OOB access to storage, memory or calldata addresses. It can also be used to corrupt the length slot of the respective array.

Weakness: CWE-787, CWE-119

Which versions are affected by CVE-2024-24561?

3 open source packages ship an affected version, including vyper. It affects 1 product.

PackageAffectedFixed in
vyper PyPIAll versions0.4.0
vyper PyPIAll versions0.4.0
vyper PyPIAll versions0.4.0b1

Products include Vyperlang Vyper.

How do I fix CVE-2024-24561?

Upgrade vyper to a fixed version for your release line: 0.4.0 or 0.4.0b1.

Is CVE-2024-24561 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-24561 exists.

Sources

Also known as GHSA-9x7f-gwxq-6f2c, PYSEC-2024-149.

Is CVE-2024-24561 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free