PyPI: vyper
CVE-2024-24560
Safety vulnerability ID: SFTY-20240202-41253
Safety legacy ID: pyup.io-65289
Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine. When calls to external contracts are made, we write the input buffer starting at byte 28, and allocate the return buffer to start at byte 0 (overlapping with the input buffer). When checking RETURNDATASIZE for dynamic types, the size is compared only to the minimum allowed size for that type, and not to the returned value's length. As a result, malformed return data can cause the contract to mistake data from the input buffer for returndata. When the called contract returns invalid ABIv2 encoded data, the calling contract can read different invalid data (from the dirty buffer) than the called contract returned. See CVE-2024-24560.
Overview
Vyper's external calls can overflow return data to return input buffer
Advisory
Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine. When calls to external contracts are made, we write the input buffer starting at byte 28, and allocate the return buffer to start at byte 0 (overlapping with the input buffer). When checking RETURNDATASIZE for dynamic types, the size is compared only to the minimum allowed size for that type, and not to the returned value's length. As a result, malformed return data can cause the contract to mistake data from the input buffer for returndata. When the called contract returns invalid ABIv2 encoded data, the calling contract can read different invalid data (from the dirty buffer) than the called contract returned. See CVE-2024-24560.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20240202-41253/CVE-2024-24560
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-24560
- https://github.com/vyperlang/vyper/security/advisories/GHSA-gp3w-2v2m-p686
- https://github.com/vyperlang/vyper/security/advisories/GHSA-gp3w-2v2m-p686
- https://nvd.nist.gov/vuln/detail/CVE-2024-24560
- https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2024-148.yaml
- https://github.com/advisories/GHSA-gp3w-2v2m-p686
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
