CVE-2021-41121: Vyper Memory Corruption When Returning A Vulnerability
HIGHCVE-2021-41121 is a HIGH (CVSS 7.5) memory corruption when returning a vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Vyper libraries in the PyPI ecosystem. The issue involves memory corruption when returning a literal struct with a private call inside of it. Remediation is available by upgrading affected packages to version 0.3.0.
CVE-2021-41121 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-41121
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.3.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-2021-41121, 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.3.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-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. 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-2021-41121 Affected Vyper Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
vyper
|
PyPI |
< 0.3.0
|
0.3.0
|
References
Frequently Asked Questions
What is CVE-2021-41121?
Which Vyper versions are affected?
What version fixes CVE-2021-41121?
Is vyper affected?
What is the CVSS score of CVE-2021-41121?
What CWE is associated with CVE-2021-41121?
How can I check PyPI dependencies for CVE-2021-41121?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xv8x-pr4h-73jv",
"modified" : "2024-11-18T22:44:23Z",
"published" : "2021-10-12T15:59:29Z",
"aliases" : [ "CVE-2021-41121" ],
"summary" : "Memory corruption when returning a literal struct with a private call inside of it",
"details" : "### Impact\n\nWhen performing a function call inside a literal struct, there is a memory corruption issue that occurs because of an incorrect pointer to the the top of the stack.\n\n### Patches\n0.3.0 / #2447\n\n*",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "vyper"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.3.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/vyperlang/vyper/security/advisories/GHSA-xv8x-pr4h-73jv"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41121"
}, {
"type" : "WEB",
"url" : "https://github.com/vyperlang/vyper/pull/2447"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2021-365.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/vyperlang/vyper"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-119" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-10-06T17:47:24Z",
"nvd_published_at" : "2021-10-06T18:15:00Z"
}
}