# CVE-2023-46247: Vyper has incorrect storage layout for contracts containing large arrays

- Severity: High 7.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.69%, higher than 54% of CVEs (2026-12-01)
- Published: 2023-12-13T13:18:52.000Z
- Modified: 2026-09-10T03:49:59.391Z
- Also known as: GHSA-6m97-7527-mh74, PYSEC-2023-307
- Weaknesses: CWE-193, CWE-682
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- vyperlang vyper: < 0.3.8; before 0.3.8
- vyper (PyPI): before 0.3.8; before 0bb7203b584e771b23536ba065a6efda457161bb

## Every score

- GitHub_M: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`
- GitHub: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`
- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`
- PyPA Advisory Database: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`

## References

- <https://github.com/vyperlang/vyper/security/advisories/GHSA-6m97-7527-mh74> (advisory, third-party-advisory, web)
- <https://github.com/vyperlang/vyper/commit/0bb7203b584e771b23536ba065a6efda457161bb> (fix, patch, web)
- <https://github.com/vyperlang/vyper/blob/6020b8bbf66b062d299d87bc7e4eddc4c9d1c157/vyper/semantics/validation/data_positions.py#L197> (product, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2023-46247> (advisory)
- <https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2023-307.yaml> (web)
- <https://github.com/vyperlang/vyper> (package)

## Sources

- CVE List: [CVE-2023-46247](https://www.cve.org/CVERecord?id=CVE-2023-46247), CVE Terms of Use, modified 2024-08-02
- GitHub Advisory Database: [GHSA-6m97-7527-mh74](https://github.com/advisories/GHSA-6m97-7527-mh74), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2023-46247](https://nvd.nist.gov/vuln/detail/CVE-2023-46247), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2023-307](https://osv.dev/vulnerability/PYSEC-2023-307), CC-BY-4.0, modified 2024-11-21

---

Page: https://cve.day/CVE-2023-46247 · Whole record: https://cve.day/CVE-2023-46247.json · Rebuilt by cve.day 2026-11-25T22:58:31.308Z
