Cloudanix VulnDB

CVE-2021-31870

Critical · 9.8

CVSS

9.8

EPSS

2.1%

Published

Apr 30, 2021

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

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

  1. Locate a code path that invokes calloc with attacker-controlled or attacker-influenced size arguments inside klibc
  2. Craft input that triggers integer overflow during the size multiplication
  3. Trigger allocation of the undersized buffer
  4. Perform out-of-bounds writes to corrupt heap metadata or adjacent objects
  5. 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