# CVE-2023-41052: Vyper incorrect order of evaluation of side effects in builtins

Source: https://junglewise.ai/threats/cve-2023-41052-vyper-incorrect-order-of-evaluation-of-side-effects-in-builtins  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2023-09-04. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2023-41052 · Severity: medium · CVSS 5.3 · Published 2023-09-04

Vyper is a smart contract programming language for Ethereum. The compiler incorrectly evaluates arguments to certain mathematical and cryptographic functions (uint256_addmod, uint256_mulmod, ecadd, ecmul) in a non-standard order that violates source semantics. When function arguments produce side effects (such as state changes or external calls), the reordered evaluation can cause dependent arguments to receive stale or incorrect values, leading to smart contracts behaving differently than their source code appears to indicate.

Technologies: [vyper (PyPI)](https://junglewise.ai/threats/technologies/vyper). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2023-41052 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2023-41052 being exploited in the wild.

**How severe is CVE-2023-41052?** Medium severity, with a CVSS score of 5.3, published 4 September 2023.

**Which products and versions are affected?** vyper (PyPI) < 0.3.10, ECOSYSTEM:introduced=0,fixed=0.3.10, ECOSYSTEM:introduced=0,fixed=0.3.10rc1.

**Is there a fix for CVE-2023-41052?** Yes. vyper (PyPI): upgrade to 0.3.10, 0.3.10rc1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2023-41052 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2023-41052?** Check whether you run vyper (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- vyper (PyPI): upgrade to 0.3.10, 0.3.10rc1 or later

  ```sh
  pip install "vyper>=0.3.10rc1"
  ```


## Technical details

This vulnerability is a compiler bug in Vyper's code generation for four builtin functions. For uint256_addmod(a,b,c) and uint256_mulmod(a,b,c), the compiler evaluates arguments in order c,a,b instead of a,b,c. For ecadd(a,b) and ecmul(a,b), it evaluates b,a instead of a,b. This violates the expected left-to-right evaluation order defined in the Vyper specification. The issue manifests as problematic behavior when arguments with side effects (state mutations, external contract calls) are used and subsequent arguments depend on those side effects. An attacker could craft a contract that exploits this reordering to manipulate the logic of vulnerable contracts. The vulnerability affects all Vyper versions before 0.3.10, and is patched in version 0.3.10 via PR #3583.

## Affected products

- Vyper Vyper < 0.3.10

## Identifiers

- CVE-2023-41052
- GHSA-4hg4-9mf5-wxxq
- PYSEC-2023-168

## Timeline

- 2023-09-04: disclosed
- 2023-09-04: patched: Version 0.3.10 released with fix via PR #3583

## References

- [https://api.github.com/users/trocher](https://api.github.com/users/trocher)

## Related threats

- [Vyper memory corruption in nested function calls and tuples](https://junglewise.ai/threats/vyper-memory-corruption-using-function-calls-within-tuples-nested-calls-c0689acb)
- [Vyper stack corruption in complex type argument passing](https://junglewise.ai/threats/vyper-call-stack-corruption-when-passing-complex-type-containing-non-3deb0c30)
- [Vyper return statement in nested for loops causes revert](https://junglewise.ai/threats/vyper-return-inside-for-loop-more-than-1-level-deep-ee8a193d)
- [PYSEC-2026-2028 - Vyper's `slice()` may elide side-effects when output length is 0](https://junglewise.ai/threats/cve-2025-47774-vyper-s-slice-may-elide-side-effects-when-output-length-is-0)
- [PYSEC-2026-2029 - Vyper's `concat()` builtin may elide side-effects for zero-length arguments](https://junglewise.ai/threats/cve-2025-47285-vyper-s-concat-builtin-may-elide-side-effects-for-zero-length)
