3.7low
Vyper _abi_decode Memory Overflow
- Severity
- 3.7low CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.54% (higher than 47% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-9p8r-4xp4-gw5wPYSEC-2024-164
Description
Vyper is a pythonic Smart Contract Language for the ethereum virtual machine. If an excessively large value is specified as the starting index for an array in `_abi_decode`, it can cause the read position to overflow. This results in the decoding of values outside the intended array bounds, potentially leading to exploitations in contracts that use arrays within `_abi_decode`. This vulnerability affects 0.3.10 and earlier versions.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| vyperlang vyper | <= 0.3.10, up to 0.3.10 | CVE List, NVD |
| vyper (PyPI) | before 0.4.0, before 0.4.0b1 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| GitHub_M | 3.7low CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N |
| GitHub | 3.7low CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N |
| NVD | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N |
| PyPA Advisory Database | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N |
Classification
What each source says
CVE List
Vyper is a pythonic Smart Contract Language for the ethereum virtual machine. If an excessively large value is specified as the starting index for an array in `_abi_decode`, it can cause the read position to overflow. This results in the decoding of values outside the intended array bounds, potentially leading to exploitations in contracts that use arrays within `_abi_decode`. This vulnerability affects 0.3.10 and earlier versions.
GitHub Advisory Database
Summary
If an excessively large value is specified as the starting index for an array in _abi_decode, it can cause the read position to overflow. This results in the decoding of values outside the intended array bounds, potentially leading to bugs in contracts that use arrays within _abi_decode. The advisory has been assigned low severity, because it is only observable if there is a memory write between two invocations of abi_decode on the same input.
Proof of Concept
event Pwn:
pass
@external
def f(x: Bytes[32 * 3]):
a: Bytes[32] = b"foo"
y: Bytes[32 * 3] = x
decoded_y1: Bytes[32] = _abi_decode(y, Bytes[32])
a = b"bar"
decoded_y2: Bytes[32] = _abi_decode(y, Bytes[32])
if decoded_y1 != decoded_y2:
log Pwn()
Sending the following calldata results in Pwn being emitted.
0xd45754f8
0000000000000000000000000000000000000000000000000000000000000020
0000000000000000000000000000000000000000000000000000000000000060
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0
Patches
Patched in https://github.com/vyperlang/vyper/pull/3925, https://github.com/vyperlang/vyper/pull/4091, https://github.com/vyperlang/vyper/pull/4144, https://github.com/vyperlang/vyper/pull/4060.
NVD (es)
Vyper es un lenguaje de contrato inteligente pitónico para la máquina virtual ethereum. Si se especifica un valor excesivamente grande como índice inicial para una matriz en `_abi_decode`, puede provocar que la posición de lectura se desborde. Esto da como resultado la decodificación de valores fuera de los límites previstos de la matriz, lo que potencialmente conduce a explotaciones en contratos que usan matrices dentro de `_abi_decode`. Esta vulnerabilidad afecta a la versión 0.3.10 y versiones anteriores.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-26149 changed 2024-08-22 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-9p8r-4xp4-gw5w changed 2026-06-10 | CC-BY-4.0 |
| NVD | CVE-2024-26149 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2024-164 changed 2026-06-10 | CC-BY-4.0 |