{"id":"CVE-2023-46247","published":"2023-12-13T19:39:22Z","modified":"2024-08-02T20:37:40Z","title":"Vyper has incorrect storage layout for contracts containing large arrays","vendor":"vyperlang","product":"vyper","tier":"tail","description":{"text":"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. If `type_.size_in_bytes` is slightly more than a power of 2, the calculation can underestimate how many slots are needed by 1. This issue is patched in version 0.3.8.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.5,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00692,"percentile":0.53787,"provenance":"source"},"cwes":[{"id":"CWE-193","name":"Off-by-one Error"},{"id":"CWE-682","name":"Incorrect Calculation"}],"references":[{"url":"https://github.com/vyperlang/vyper/security/advisories/GHSA-6m97-7527-mh74","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/vyperlang/vyper/commit/0bb7203b584e771b23536ba065a6efda457161bb","tags":["x_refsource_MISC"]},{"url":"https://github.com/vyperlang/vyper/blob/6020b8bbf66b062d299d87bc7e4eddc4c9d1c157/vyper/semantics/validation/data_positions.py#L197","tags":["x_refsource_MISC"]}],"priority":{"score":16.0,"factors":[{"name":"EPSS percentile","points":10.76},{"name":"CVSS severity","points":5.25}]},"vendorSlug":"vyperlang","affectedVersions":[{"vendor":"vyperlang","product":"vyper","versions":["< 0.3.8"]}],"affected":[{"ecosystem":"PyPI","package":"vyper","vulnerableRanges":["<0.3.8"],"patched":["0.3.8"],"from":["GHSA-6m97-7527-mh74","PYSEC-2023-307"],"provenance":"source"}],"summary":{"text":"Vyper, a Pythonic smart contract language for the Ethereum Virtual Machine, miscalculates the number of storage slots needed for contracts containing large arrays, because an intermediate floating-point step in its slot-count calculation can introduce a rounding error that is off by one slot. An attacker can exploit this by deploying or interacting with a contract whose array is sized near a power of two (above 2^46 bytes), with no authentication or user interaction required.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:26:06Z"},"euvd":{"id":"EUVD-2023-0276","exploited":false,"provenance":"source"}}