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

vyper Updated 02 Oct 2025

Summary

01/02/2024
Yes i
Critical
9.8

CVE-2024-24561: Vyper's bounds check on built-in slice() function can be overflowed. Affects vyper versions < 0.4.0. Fixed in 0.4.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Vyper is an open-source programming language used for writing smart contracts on the Ethereum blockchain. It is designed to be secure, simple, and auditable. The slice() function in Vyper is used to extract a portion of a byte array or string. However, a vulnerability has been discovered in the bounds check of the slice() function, which can be overflowed when non-literal arguments are used for the start or length variables. This vulnerability can lead to out-of-bounds (OOB) access to storage, memory, or calldata addresses, as well as corruption of the length slot of the respective array.

Vulnerability Detail

The bounds check for the slice() function in Vyper does not properly account for the possibility of overflow when non-literal arguments are used for the start or length variables. This allows an attacker to manipulate the start or length values in a way that overflows the bounds check and enables OOB access or corruption of the length slot. An attacker can exploit this vulnerability to access unrelated storage slots, return unexpected values from storage, or corrupt the length slot of an array. The impact of this vulnerability can range from unauthorized access to sensitive data to the disruption of contract functionality.

How To Fix

Latest published version: 0.4.3 as of 22 Oct 2026

pip install --upgrade "vyper==0.4.3"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.4.0

This is the first release that contains the fix.

pip install --upgrade "vyper==0.4.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, developers can manually perform bounds checks before calling the slice() function. By checking the start and length values against the maximum allowed index for the array, developers can prevent potential overflow and mitigate the risk of OOB access or corruption. Here's an example of how to implement the workaround in Vyper:

if start + length > array_length:
    revert("Slice out of bounds")
else:
    sliced_array = slice(array, start, length)

Conclusion

The vulnerability in Vyper's slice() function can be exploited to achieve OOB access or corruption of the length slot. It is crucial for the Vyper development team to address this vulnerability by updating the bounds checks and thoroughly testing the code. Developers can also implement a temporary workaround by manually performing bounds checks. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for vyper →

Share this vulnerability

FAQ

Vyper is an open-source programming language used for writing smart contracts on the Ethereum blockchain. It is designed to be secure, simple, and auditable.

The slice() function in Vyper is used to extract a portion of a byte array or string. It takes three arguments: the array or string to be sliced, the starting index, and the length of the slice.

The vulnerability occurs due to a lack of proper bounds checks when non-literal arguments are used for the start or length variables. This allows an attacker to manipulate the values in a way that overflows the bounds check and enables OOB access or corruption of the length slot.

An attacker can exploit this vulnerability to access unrelated storage slots, return unexpected values from storage, or corrupt the length slot of an array. This can lead to unauthorized access to sensitive data or disruption of contract functionality.

Developers can manually perform bounds checks before calling the slice() function to prevent potential overflow. By checking the start and length values against the maximum allowed index for the array, developers can mitigate the risk of OOB access or corruption.

Related vulnerabilities

Recent vulnerabilities recorded for vyper.

How To Fix

Latest published version: 0.4.3 as of 22 Oct 2026

pip install --upgrade "vyper==0.4.3"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.4.0

This is the first release that contains the fix.

pip install --upgrade "vyper==0.4.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback