GitHub Advisoryadvisory · PyPI

GHSA-4w26-8p97-f4jp AugAssign evaluation order causing OOB write within the object in Vyper

LOW Published 2025-02-21 Modified 2025-04-09 Official page ↗
Aliases
CVE-2025-27105
Ecosystem
PyPI
Packages
vyper
Severity
Low
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N
Weaknesses
CWE-787
Reviewed
2025-02-21

Affected packages

• PyPI vyper: < 0.4.1 → fixed in 0.4.1

Description

Vyper handles AugAssign statements by first caching the target location to avoid double evaluation. However, in the case when target is an access to a DynArray and the rhs modifies the array, the cached target will evaluate first, and the bounds check will not be re-evaluated during the write portion of the statement. In other words, the following code ```vyper def poc(): a: DynArray[uint256, 2] = [1, 2] a[1] += a.pop() ``` is equivalent to: ```vyper def poc(): a: DynArray[uint256, 2] = [1, 2] a[1] += a[len(a) - 1] a.pop() ``` rather than: ```vyper def poc(): a: DynArray[uint256, 2] = [1, 2] s: uint256 = a[1] t: uint256 = a.pop() a[1] = s + t # reverts due to oob access ```

Related

Alias · CVE (1)

  • CVE-2025-27105 vyper is a Pythonic Smart Contract Language for the EVM. vulnerability

Weakness · CWE (1)

  • CWE-787 Out-of-bounds Write weakness

References