# CVE-2023-40015: Vyper: reversed order of side effects for some operations

- Severity: Low 3.7 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/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.49%, higher than 43% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2023-09-04T16:39:00.000Z
- Modified: 2026-06-17T06:15:45.383Z
- Also known as: GHSA-g2xh-c426-v8mf, PYSEC-2023-167
- Weaknesses: CWE-670
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

Vyper is a Pythonic Smart Contract Language. For the following (probably non-exhaustive) list of expressions, the compiler evaluates the arguments from right to left instead of left to right. `unsafe_add, unsafe_sub, unsafe_mul, unsafe_div, pow_mod256, |, &, ^ (bitwise operators), bitwise_or (deprecated), bitwise_and (deprecated), bitwise_xor (deprecated), raw_call, <, >, <=, >=, ==, !=, in, not in (when lhs and rhs are enums)`. This behaviour becomes a problem when the evaluation of one of the arguments produces side effects that other arguments depend on. The following expressions can produce side-effect: state modifying external call , state modifying internal call, `raw_call`, `pop()` when used on a Dynamic Array stored in the storage, `create_minimal_proxy_to`, `create_copy_of`, `create_from_blueprint`. This issue has not yet been patched. Users are advised to make sure that the arguments of the expression do not produce side effects or, if one does, that no other argument is dependent on those side effects.

(As written by CVE List.)

## Affected

- vyperlang vyper: <= 0.4.0; up to 0.3.9
- vyper (PyPI): up to 0.4.2; before 0.3.10rc1

## Every score

- GitHub_M: CVSS:3.1 3.7 Low `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N`
- GitHub: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- GitHub: CVSS:4.0 Medium `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N`
- NVD: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- PyPA Advisory Database: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`

## References

- <https://github.com/vyperlang/vyper/security/advisories/GHSA-g2xh-c426-v8mf> (exploit, advisory, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2023-40015> (advisory)
- <https://github.com/vyperlang/vyper/issues/3604> (web)
- <https://github.com/vyperlang/vyper/issues/4019> (web)
- <https://github.com/vyperlang/vyper/pull/4157> (web)
- <https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2023-167.yaml> (web)
- <https://github.com/vyperlang/vyper> (package)

## Sources

- CVE List: [CVE-2023-40015](https://www.cve.org/CVERecord?id=CVE-2023-40015), CVE Terms of Use, modified 2024-11-19
- GitHub Advisory Database: [GHSA-g2xh-c426-v8mf](https://github.com/advisories/GHSA-g2xh-c426-v8mf), CC-BY-4.0, modified 2025-06-18
- NVD: [CVE-2023-40015](https://nvd.nist.gov/vuln/detail/CVE-2023-40015), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2023-167](https://osv.dev/vulnerability/PYSEC-2023-167), CC-BY-4.0, modified 2023-11-08

---

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