CVE-2023-41052
JSON

3.7low

Vyper: incorrect order of evaluation of side effects for some builtins

Severity
3.7low CVSS:3.1 by GitHub_M
Exploit likelihood
0.54% (higher than 46% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-4hg4-9mf5-wxxqPYSEC-2023-168

Description

Vyper is a Pythonic Smart Contract Language. In affected versions the order of evaluation of the arguments of the builtin functions `uint256_addmod`, `uint256_mulmod`, `ecadd` and `ecmul` does not follow source order. This behaviour is problematic when the evaluation of one of the arguments produces side effects that other arguments depend on. A patch is currently being developed on pull request #3583. When using builtins from the list above, users should 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.

Affected

Product or packageVersionsReported by
vyperlang vyper<= 0.3.9, up to 0.3.9CVE List, NVD
vyper (PyPI)before 0.3.10, before 0.3.10rc1GitHub Advisory Database, PyPA Advisory Database

All scores

GitHub_M3.7low CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
GitHub5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
NVD5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
PyPA Advisory Database5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Classification

CWE-670

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Vyper is a Pythonic Smart Contract Language. In affected versions the order of evaluation of the arguments of the builtin functions `uint256_addmod`, `uint256_mulmod`, `ecadd` and `ecmul` does not follow source order. This behaviour is problematic when the evaluation of one of the arguments produces side effects that other arguments depend on. A patch is currently being developed on pull request #3583. When using builtins from the list above, users should 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.

GitHub Advisory Database
Impact

The order of evaluation of the arguments of the builtin functions uint256_addmod, uint256_mulmod, ecadd and ecmul does not follow source order. • For uint256_addmod(a,b,c) and uint256_mulmod(a,b,c), the order is c,a,b. • For ecadd(a,b) and ecmul(a,b), the order is b,a.

Note that this behaviour is problematic when the evaluation of one of the arguments produces side effects that other arguments depend on.

Patches

https://github.com/vyperlang/vyper/pull/3583

Workarounds

When using builtins from the list above, 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.

NVD (es)

Vyper es un Lenguaje de Contrato Inteligente de Python. En las versiones afectadas, el orden de evaluación de los argumentos de las funciones integradas `uint256_addmod`, `uint256_mulmod`, `ecadd` and `ecmul` no sigue el orden de origen. Este comportamiento es problemático cuando la evaluación de uno de los argumentos produce efectos secundarios de los que dependen otros argumentos. Actualmente se está desarrollando un parche mediante la solicitud de extracción #3583. Al utilizar elementos integrados de la lista anterior, los usuarios deben asegurarse de que los argumentos de la expresión no produzcan efectos secundarios o, si los produce, que ningún otro argumento dependa de esos efectos secundarios.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-41052 changed 2024-09-26CVE Terms of Use
GitHub Advisory DatabaseGHSA-4hg4-9mf5-wxxq changed 2026-09-17CC-BY-4.0
NVDCVE-2023-41052 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2023-168 changed 2023-11-08CC-BY-4.0