CVE-2024-26149: Vyper Vyper's `_abi_decode` Vulnerable To Memory Vulnerability
LOWCVE-2024-26149 is a LOW (CVSS 3.7) vyper's `_abi_decode` vulnerable to memory vulnerability (CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')) affecting Vyper libraries in the PyPI ecosystem. The issue involves vyper's `_abi_decode` vulnerable to memory overflow. Remediation is available by upgrading affected packages to version 0.4.0.
CVE-2024-26149 at a Glance
Security Impact
CVSS: 3.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N).
How to Fix CVE-2024-26149
To remediate this vulnerability, upgrade all affected Vyper dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install vyper>=0.4.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show vyper
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-26149, inspect your installed packages using pip:
pip show vyper
Analyze the terminal output to locate any version of Vyper in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.0), your application is affected.
Note: The pip show vyper command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow'), where the product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer. In Vyper, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-26149 Affected Vyper Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
vyper
|
PyPI |
< 0.4.0
|
0.4.0
|
References
Frequently Asked Questions
What is CVE-2024-26149?
Which Vyper versions are affected?
What version fixes CVE-2024-26149?
Is vyper affected?
What is the CVSS score of CVE-2024-26149?
What CWE is associated with CVE-2024-26149?
How can I check PyPI dependencies for CVE-2024-26149?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9p8r-4xp4-gw5w",
"modified" : "2025-01-17T15:54:37Z",
"published" : "2024-02-26T20:11:07Z",
"aliases" : [ "CVE-2024-26149" ],
"summary" : "Vyper's `_abi_decode` vulnerable to Memory Overflow",
"details" : "## Summary\n\nIf 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.\n\n## Proof of Concept\n\n```vyper\nevent Pwn:\n pass\n\n@external\ndef f(x: Bytes[32 * 3]):\n a: Bytes[32] = b\"foo\"\n y: Bytes[32 * 3] = x\n\n decoded_y1: Bytes[32] = _abi_decode(y, Bytes[32])\n a = b\"bar\"\n decoded_y2: Bytes[32] = _abi_decode(y, Bytes[32])\n\n if decoded_y1 != decoded_y2:\n log Pwn()\n```\n\nSending the following calldata results in `Pwn` being emitted. \n\n```\n0xd45754f8\n0000000000000000000000000000000000000000000000000000000000000020\n0000000000000000000000000000000000000000000000000000000000000060\nffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0\n```\n\n### Patches\nPatched 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "vyper"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.4.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/vyperlang/vyper/security/advisories/GHSA-9p8r-4xp4-gw5w"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-26149"
}, {
"type" : "WEB",
"url" : "https://github.com/vyperlang/vyper/pull/3925"
}, {
"type" : "WEB",
"url" : "https://github.com/vyperlang/vyper/pull/4060"
}, {
"type" : "WEB",
"url" : "https://github.com/vyperlang/vyper/pull/4091"
}, {
"type" : "WEB",
"url" : "https://github.com/vyperlang/vyper/pull/4144"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2024-164.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/vyperlang/vyper"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-119", "CWE-120" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2024-02-26T20:11:07Z",
"nvd_published_at" : "2024-02-26T20:19:05Z"
}
}