CVE-2023-40015
MEDIUM 5.3CVSS 3.1Vyper: reversed order of side effects for some operations
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.
- Published
- 4 Sep 2023
- Last modified
- 17 Jun 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Modified
- Weakness
- CWE-670
- Also known as
- GHSA-g2xh-c426-v8mfPYSEC-2023-167
- Sources
- NVDJSONOSV GHSA-g2xh-c426-v8mfJSONOSV PYSEC-2023-167JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| OSV | GitHub | CVSS 4.0 | 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 | nvd@nist.gov (Primary) | CVSS 3.1 | MEDIUM 5.3 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| OSV | GitHub | CVSS 3.1 | MEDIUM 5.3 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| OSV | PyPA | CVSS 3.1 | MEDIUM 5.3 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| NVD | security-advisories@github.com (Secondary) | CVSS 3.1 | LOW 3.7 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | vyperlang | vypercpe:2.3:a:vyperlang:vyper:*:*:*:*:*:python:*:* |
<= 0.3.9 | |
| OSV | PyPI | vyper | <= 0.4.2 | |
| OSV | PyPI | vyper | < 0.3.10rc1 | 0.3.10rc1 |
References
- https://github.com/vyperlang/vyper/security/advisories/GHSA-g2xh-c426-v8mf · Exploit, Third Party Advisory, WEB, ADVISORY
- 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
History
- 25 Nov 2026 20:36 UTC · NVD: first stored (published 4 Sep 2023)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 4 Sep 2023)
- 25 Nov 2026 20:11 UTC · OSV: first stored (published 4 Sep 2023)