CVE-2024-8948
High · 7.3heap-buffer-overflow in MicroPython
CVSS
7.3
EPSS
1.0%
Published
Sep 17, 2024
CISA due date
—
Cloudanix analysis
A bug in widely used lightweight Python software for small devices lets attackers remotely crash or take over those devices by sending specially crafted data.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Data Tampering
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Patch
- Effort
- Low
- Patch risk
- Low
What it actually does
Heap-based buffer overflow write in mpz_as_bytes (py/objint.c) triggered when converting an integer value of zero to its byte representation.
Why it matters to the business
Attackers may crash MicroPython-based devices or execute arbitrary code, disrupting IoT, embedded, and automation systems that rely on this runtime.
How an attack unfolds
An attacker sends a remotely crafted integer conversion request that reaches mpz_as_bytes with a zero value; the missing length check allows an out-of-bounds write on the heap, potentially leading to code execution.
How to fix it
Upgrade micropython/micropython to commit 908ab1ceca15ee6fd0ef82ca4cba770a3ec41894 or later; rebuild and redeploy all affected firmware images.
How to confirm the fix worked
Confirm the installed commit hash is 908ab1ceca15ee6fd0ef82ca4cba770a3ec41894 or newer; re-run unit tests covering int-to-bytes conversion of zero and monitor for crashes or sanitizer violations.
Typical attack path
- Locate a network-reachable MicroPython instance exposing integer-to-bytes conversion surfaces
- Craft and transmit a zero integer value that reaches mpz_as_bytes without proper bounds checking
- Trigger the heap buffer overflow write to corrupt adjacent memory structures
- Leverage the corruption for arbitrary code execution or denial of service
How to detect it
Review application and system logs for unexpected crashes or memory errors during integer conversion routines; inspect heap dumps or sanitizer reports for out-of-bounds writes in mpz_as_bytes; correlate with network traffic containing integer serialization requests.
What your security team should do
- Immediately update all MicroPython deployments to the patched commit
- Scan source trees and build pipelines for the vulnerable objint.c file
- Disable or sandbox remote interfaces that accept untrusted integer conversions until patched
- Monitor vendor advisories for downstream firmware updates
The record
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.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| PyPI | micropython-copy | 0 | No fix |
| PyPI | micropython-io | 0 | No fix |
| PyPI | micropython-os | 0 | No fix |
| Debian:13 | micropython | 0 | No fix |
| Debian:14 | micropython | 0 | 1.24.0+ds-1 |
| Ubuntu:20.04:LTS | micropython | 0 | No fix |
| Ubuntu:22.04:LTS | micropython | 0 | No fix |
| Ubuntu:24.04:LTS | micropython | 0 | No fix |
| Ubuntu:24.10 | micropython | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | micropython | 0 | No fix |
Related vulnerabilities
- CVE-2024-8947 A vulnerability was found in MicroPython 1.22.2. Also affects micropython-copy
- CVE-2024-8946 A vulnerability was found in MicroPython 1.23.0. Also affects micropython-copy
- CVE-2026-112403 Pillow is a Python imaging library. CWE-122
- CVE-2026-112393 Pillow is a Python imaging library. CWE-122
- CVE-2026-112395 Pillow is a Python imaging library. CWE-122
- CVE-2026-103658 GNU Aspell 0.60.8.2 (first vulnerable version is not known) contains a heap-based buffer… CWE-122
- CVE-2026-107161 A heap-based buffer overflow flaw was found in Cyrus SASL. CWE-122
- CVE-2026-106574 ImageMagick is free and open-source software used for editing and manipulating digital… CWE-122