CVE-2021-31872
NixOS vulnerability analysis and mitigation

Overview

An issue was discovered in klibc before version 2.0.9, identified as CVE-2021-31872. The vulnerability involves multiple possible integer overflows in the cpio command specifically on 32-bit systems, which may result in a buffer overflow or other security impacts. The vulnerability was discovered and disclosed in April 2021, affecting klibc installations on 32-bit systems (NVD, CVE).

Technical details

The vulnerability stems from the handling of file sizes in the "new" header format of cpio command. The maximum name and file sizes in this format are 32-bit unsigned values, but the I/O functions mostly use long for sizes and offsets, causing sizes >= 2^31 to be handled incorrectly on 32-bit systems. The vulnerability has been assigned a CVSS v3.1 base score of 9.8 (CRITICAL) with the vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (NVD, Kernel Commit).

Impact

The vulnerability could potentially lead to buffer overflow conditions, which might result in arbitrary code execution, system crashes, or other security impacts. The issue is particularly significant for 32-bit systems where integer overflow conditions could be exploited (NVD, Debian LTS).

Exploitability

The vulnerability requires the exploitation of integer overflow conditions in the cpio command on 32-bit systems. While specific exploit details are not publicly documented, the vulnerability could be triggered when processing file names or sizes that exceed certain thresholds in the cpio command (Kernel Commit).

Mitigation and workarounds

The vulnerability was fixed in klibc version 2.0.9. The fix involves adding checks to fail if c_namesize or c_filesize is > LONG_MAX in the read_in_new_ascii() function. Various distributions have released security updates to address this vulnerability, including Debian and Ubuntu. Users are advised to upgrade to klibc version 2.0.9 or later (Klibc Release, Kernel Commit).

Additional resources


SourceThis report was generated using AI

Related NixOS vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-84121CRITICAL9.6
  • NixOS logoNixOS
  • firefox-esr
NoYesSep 01, 2026
CVE-2026-84123HIGH8.8
  • NixOS logoNixOS
  • thunderbird
NoYesSep 01, 2026
CVE-2026-84125MEDIUM5.4
  • NixOS logoNixOS
  • firefox
NoYesSep 01, 2026
CVE-2026-84124MEDIUM5.4
  • NixOS logoNixOS
  • cpe:2.3:a:mozilla:firefox
NoYesSep 01, 2026
CVE-2026-84122MEDIUM5.4
  • NixOS logoNixOS
  • firefox-esr
NoYesSep 01, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management