CVE-2024-24564: Vyper's extract32 Can Read Dirty Memory
Summary
CVE-2024-24564: Vyper's extract32 can ready dirty memory. 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 for Ethereum smart contracts. It is designed to be secure, simple, and auditable. The extract32 function in Vyper is used to extract 32 bytes from a byte array. However, a vulnerability has been discovered in this function that can result in the reading of dirty memory.
Vulnerability Detail
The vulnerability occurs when the start index provided to the extract32 function updates the byte array (b) being extracted from. The function caches the pointer to b and its length before evaluating the start index. If the evaluation of the start index changes the content and length of b, an outdated length will be used with the new content when extracting 32 bytes. This can lead to the extraction of dirty memory. An attacker could potentially exploit this vulnerability to access sensitive information or manipulate the behavior of the smart contract.
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 avoid using the extract32 function in scenarios where the start index may update the byte array being extracted from. Instead, they can manually extract the desired bytes using other Vyper functions or by implementing custom extraction logic.
Conclusion
The vulnerability in Vyper's extract32 function can lead to the reading of dirty memory, potentially exposing sensitive information or enabling malicious manipulation of smart contract behavior. It is crucial for the Vyper development team to address this vulnerability by updating the function to handle changes in the byte array's content and length correctly. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for vyper →
FAQ
Vyper is an open-source programming language for Ethereum smart contracts. It is designed to be secure, simple, and auditable.
The extract32 function in Vyper is used to extract 32 bytes from a byte array.
The vulnerability allows for the reading of dirty memory, potentially exposing sensitive information or enabling manipulation of smart contract behavior.
The Vyper development team should update the extract32 function to properly handle changes in the byte array's content and length during evaluation.
Developers can avoid using the extract32 function in scenarios where the start index may update the byte array being extracted from.
References
Related vulnerabilities
Recent vulnerabilities recorded for vyper.