CVE-2024-32646: Vyper - Double Eval Vulnerability in Slice Builtin
Summary
CVE-2024-32646: vyper performs double eval of the slice start/length args in certain cases. Affects vyper versions < 0.4.0. Fixed in 0.4.0. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
Vyper is an open-source programming language used for developing smart contracts on the Ethereum blockchain. It is designed to be secure, simple, and auditable. The Vyper package, available on PyPI, provides the necessary tools and libraries for writing Vyper contracts. However, a vulnerability has been discovered in the slice builtin function of Vyper.
Vulnerability Detail
The vulnerability in Vyper's slice builtin function arises when the buffer argument is either msg.data, self.code, or <address>.code, and the start or length arguments have side-effects. The _build_adhoc_slice_node function of the slice builtin does not cache these arguments to the stack, resulting in multiple evaluations instead of retrieving the value from the stack. This vulnerability can lead to unexpected behavior and potential security risks.
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
There is no specific workaround provided for this vulnerability. It is recommended to update to a fixed version of Vyper.
Conclusion
The double eval vulnerability in the slice builtin function of Vyper can pose potential security risks in contracts utilizing the vulnerable code. It is crucial to update to a fixed version of Vyper to ensure the vulnerability is patched. For further support and assistance, please contact DevNack.com.
See every vulnerability recorded for vyper →
FAQ
Vyper is an open-source programming language used for developing smart contracts on the Ethereum blockchain. It is designed to be secure, simple, and auditable.
The impact of this vulnerability can vary depending on the specific usage of the slice builtin function. It can potentially lead to unexpected behavior and security risks in contracts that utilize the vulnerable code.
No known exploits of this vulnerability have been reported at this time. However, it is important to update to a fixed version of Vyper to mitigate any potential risks.
You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your Pipfile.lock and the playground will analyze your dependencies and alert you if any vulnerabilities are found.
For further support on vulnerability remediation, you can reach out to info@devnack.com. Our team of experts will be happy to assist you.
References
Related vulnerabilities
Recent vulnerabilities recorded for vyper.