CVE-2021-31870
Critical · 9.8CVSS
9.8
EPSS
2.1%
Published
Apr 30, 2021
CISA due date
—
Cloudanix analysis
A flaw in a low-level memory routine used by some Linux boot components can let an attacker corrupt memory and potentially take control of the affected system.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Library
- Class
- Buffer Overflow
- Remediation
- Upgrade
- Effort
- Low
- Patch risk
- Low
What it actually does
Multiplication inside calloc() can overflow an integer size calculation, allowing a subsequent heap buffer allocation that is smaller than intended and enabling out-of-bounds writes.
Why it matters to the business
Systems that rely on klibc (commonly early-boot or embedded Linux environments) become susceptible to memory corruption that may lead to crashes, denial of service, or arbitrary code execution during boot or library initialization.
How an attack unfolds
An attacker supplies crafted parameters to a calloc call site within klibc such that the size multiplication wraps, resulting in an undersized heap buffer that is later written beyond its bounds, potentially hijacking control flow.
How to fix it
Upgrade klibc to version 2.0.9 or later; rebuild and redeploy any initramfs or embedded images that embed the vulnerable library; verify the updated package is present in all affected Debian-based distributions.
How to confirm the fix worked
Confirm the installed klibc version is at least 2.0.9 via package manager queries or binary inspection; recompile test programs that exercise calloc with large arguments and verify absence of overflow behavior.
Typical attack path
- Locate a code path that invokes calloc with attacker-controlled or attacker-influenced size arguments inside klibc
- Craft input that triggers integer overflow during the size multiplication
- Trigger allocation of the undersized buffer
- Perform out-of-bounds writes to corrupt heap metadata or adjacent objects
- Achieve arbitrary code execution or process crash
How to detect it
Review build logs and package manifests for klibc versions prior to 2.0.9; examine crash reports or memory sanitizer output showing oversized calloc requests; no runtime network or file IOCs are known.
What your security team should do
- Prioritize patching klibc in all build pipelines and initramfs generation processes
- Inventory systems that statically or dynamically link klibc and schedule updates
- Monitor upstream Debian and klibc project advisories for any follow-on fixes
The record
An issue was discovered in klibc before 2.0.9. Multiplication in the calloc() function may result in an integer overflow and a subsequent heap buffer overflow.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | klibc | 0 | 2.0.8-6 |
| Debian:12 | klibc | 0 | 2.0.8-6 |
| Debian:13 | klibc | 0 | 2.0.8-6 |
| Debian:14 | klibc | 0 | 2.0.8-6 |
| Debian:9 | klibc | 0 | 2.0.4-9+deb9u1 |
| Ubuntu:18.04:LTS | klibc | 0 | 2.0.4-9ubuntu2.1 |
| Ubuntu:20.04:LTS | klibc | 0 | 2.0.7-1ubuntu5.1 |
| Ubuntu:22.04:LTS | klibc | 0 | 2.0.8-6.1ubuntu2 |
| Ubuntu:Pro:14.04:LTS | klibc | 0 | 2.0.3-0ubuntu1.14.04.3+esm2 |
| Ubuntu:Pro:16.04:LTS | klibc | 0 | 2.0.4-8ubuntu1.16.04.4+esm1 |
Related vulnerabilities
- CVE-2026-110264 An issue has been discovered in GitLab CE/EE affecting all versions from 7.0 before… CWE-190
- CVE-2026-53615 util-linux is a random collection of Linux utilities. CWE-190
- CVE-2026-106574 ImageMagick is free and open-source software used for editing and manipulating digital… CWE-190
- CVE-2026-106571 ImageMagick is free and open-source software used for editing and manipulating digital… CWE-190
- CVE-2026-75820 GNU Aspell contains an integer truncation vulnerability in the WritableDict::add()… CWE-190
- CVE-2026-102621 A vulnerability was identified in Freedesktop Poppler up to 26.08.0. CWE-190
- CVE-2026-102620 A vulnerability was determined in Freedesktop Poppler 26.06.0/26.07.0/26.08.0. CWE-190
- CVE-2026-102633 libexpat versions 2.7.2 through 2.8.5 contain an integer overflow vulnerability in… CWE-190