PT-2023-29926

CVE-2023-46247

·

Published

2023-12-13

·

Updated

2023-12-19

Description by

CVSS 3.1
7.5
High
MetricsAV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Name of the Vulnerable Software and Affected Versions Vyper versions prior to 0.3.8
Description The issue affects contracts containing large arrays, which might underallocate the number of slots they need by 1. This occurs due to a calculation error in determining the required slots for a storage variable, which uses 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. Specifically, if type .size in bytes is large (> 2**46) and slightly less than a power of 2, the calculation can overestimate the required slots, while if type .size in bytes is slightly more than a power of 2, it can underestimate the required slots. This can lead to overwriting of variables, as demonstrated by example contracts.
Recommendations For versions prior to 0.3.8, update to version 0.3.8 to resolve the issue. As a temporary workaround, consider reviewing contracts for large arrays and manually verifying the allocation of slots to prevent potential overwriting of variables. Restrict access to contracts containing large arrays to minimize the risk of exploitation until the issue is resolved.
Exploitability
Exploit
Fix
Researchers
Vendors
Affected products
Related identifiers
GHSA-6M97-7527-MH74
PYSEC-2023-307
Found an issue in the description? Have something to add? Feel free to write us 👾