CVE-2024-24560 – Vyper external calls can overflow return data to return input buffer
https://notcve.org/view.php?id=CVE-2024-24560
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. • https://github.com/vyperlang/vyper/security/advisories/GHSA-gp3w-2v2m-p686 • CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer •
CVE-2024-24561 – Vyper bounds check on built-in `slice()` function can be overflowed
https://notcve.org/view.php?id=CVE-2024-24561
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. • https://github.com/vyperlang/vyper/blob/b01cd686aa567b32498fefd76bd96b0597c6f099/vyper/builtins/functions.py#L404-L457 https://github.com/vyperlang/vyper/issues/3756 https://github.com/vyperlang/vyper/security/advisories/GHSA-9x7f-gwxq-6f2c • CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer CWE-787: Out-of-bounds Write •
CVE-2024-24567 – raw_call `value=` kwargs not disabled for static and delegate calls
https://notcve.org/view.php?id=CVE-2024-24567
Vyper is a pythonic Smart Contract Language for the ethereum virtual machine. Vyper compiler allows passing a value in builtin raw_call even if the call is a delegatecall or a staticcall. But in the context of delegatecall and staticcall the handling of value is not possible due to the semantics of the respective opcodes, and vyper will silently ignore the value= argument. If the semantics of the EVM are unknown to the developer, he could suspect that by specifying the `value` kwarg, exactly the given amount will be sent along to the target. This vulnerability affects 0.3.10 and earlier versions. • https://github.com/vyperlang/vyper/blob/9136169468f317a53b4e7448389aa315f90b95ba/vyper/builtins/functions.py#L1100 https://github.com/vyperlang/vyper/security/advisories/GHSA-x2c2-q32w-4w6m • CWE-754: Improper Check for Unusual or Exceptional Conditions •
CVE-2024-22419 – concat built-in can corrupt memory in vyper
https://notcve.org/view.php?id=CVE-2024-22419
Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine. The `concat` built-in can write over the bounds of the memory buffer that was allocated for it and thus overwrite existing valid data. The root cause is that the `build_IR` for `concat` doesn't properly adhere to the API of copy functions (for `>=0.3.2` the `copy_bytes` function). A contract search was performed and no vulnerable contracts were found in production. The buffer overflow can result in the change of semantics of the contract. • https://github.com/vyperlang/vyper/commit/55e18f6d128b2da8986adbbcccf1cd59a4b9ad6f https://github.com/vyperlang/vyper/issues/3737 https://github.com/vyperlang/vyper/security/advisories/GHSA-2q8v-3gqq-4f8p • CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') CWE-787: Out-of-bounds Write •
CVE-2023-46247 – Vyper has incorrect storage layout for contracts containing large arrays
https://notcve.org/view.php?id=CVE-2023-46247
Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine (EVM). Contracts containing large arrays might underallocate the number of slots they need by 1. Prior to v0.3.8, the calculation to determine how many slots a storage variable needed used `math.ceil(type_.size_in_bytes / 32)`. The intermediate floating point step can produce a rounding error if there are enough bits set in the IEEE-754 mantissa. Roughly speaking, if `type_.size_in_bytes` is large (> 2**46), and slightly less than a power of 2, the calculation can overestimate how many slots are needed by 1. • https://github.com/vyperlang/vyper/blob/6020b8bbf66b062d299d87bc7e4eddc4c9d1c157/vyper/semantics/validation/data_positions.py#L197 https://github.com/vyperlang/vyper/commit/0bb7203b584e771b23536ba065a6efda457161bb https://github.com/vyperlang/vyper/security/advisories/GHSA-6m97-7527-mh74 • CWE-193: Off-by-one Error CWE-682: Incorrect Calculation •