CVE-2024-8948: Micropython copy Heap-buffer-overflow Vulnerability
MODERATECVE-2024-8948 is a MODERATE (CVSS 7.3) heap-buffer-overflow vulnerability (CWE-122: Heap-based Buffer Overflow) affecting Micropython copy libraries in the PyPI ecosystem. The issue involves heap-buffer-overflow in micropython. Remediation is available in the latest vendor maintenance releases.
CVE-2024-8948 at a Glance
Security Impact
CVSS: 7.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L).
How to Fix CVE-2024-8948
To remediate this vulnerability, upgrade all affected Micropython copy 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 micropython-copy>=Latest secure release
pip install micropython-io>=Latest secure release
pip install micropython-os>=Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show micropython-copy
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-8948, inspect your installed packages using pip:
pip show micropython-copy
Analyze the terminal output to locate any version of Micropython copy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The pip show micropython-copy command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-122: Heap-based Buffer Overflow, where a heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc(). In Micropython copy, 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-8948 Affected Micropython copy Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
micropython-copy
|
PyPI |
≤ 3.3.3.post3
|
|
|
micropython-io
|
PyPI |
≤ 0.1
|
|
|
micropython-os
|
PyPI |
≤ 0.8
|
|
References
Frequently Asked Questions
What is CVE-2024-8948?
Which Micropython copy versions are affected?
What version fixes CVE-2024-8948?
Is micropython-copy affected?
Is micropython-io affected?
What is the CVSS score of CVE-2024-8948?
What CWE is associated with CVE-2024-8948?
How can I check PyPI dependencies for CVE-2024-8948?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vh3x-525m-jp4r",
"modified" : "2024-09-24T17:34:09Z",
"published" : "2024-09-17T21:30:32Z",
"aliases" : [ "CVE-2024-8948" ],
"summary" : "heap-buffer-overflow in MicroPython",
"details" : "A vulnerability was found in MicroPython 1.23.0. It has been rated as critical. Affected by this issue is the function mpz_as_bytes of the file py/objint.c. The manipulation leads to heap-based buffer overflow. The attack may be launched remotely. The exploit has been disclosed to the public and may be used. The patch is identified as 908ab1ceca15ee6fd0ef82ca4cba770a3ec41894. It is recommended to apply a patch to fix this issue. In micropython objint component, converting zero from int to bytes leads to heap buffer-overflow-write at mpz_as_bytes.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "micropython-copy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "3.3.3.post3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "micropython-io"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "0.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "micropython-os"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "0.8"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-8948"
}, {
"type" : "WEB",
"url" : "https://github.com/micropython/micropython/issues/13041"
}, {
"type" : "WEB",
"url" : "https://github.com/micropython/micropython/commit/908ab1ceca15ee6fd0ef82ca4cba770a3ec41894"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/micropython-copy/PYSEC-2024-87.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/micropython-io/PYSEC-2024-88.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/micropython-os/PYSEC-2024-89.yaml"
}, {
"type" : "WEB",
"url" : "https://vuldb.com/?ctiid.277766"
}, {
"type" : "WEB",
"url" : "https://vuldb.com/?id.277766"
}, {
"type" : "WEB",
"url" : "https://vuldb.com/?submit.409317"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-122", "CWE-787" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-09-24T17:34:09Z",
"nvd_published_at" : "2024-09-17T19:15:29Z"
}
}