CVE-2015-4041
High · 7.8CVSS
7.8
EPSS
0.5%
Published
Jan 24, 2020
CISA due date
—
Cloudanix analysis
A flaw in the standard sort program can let specially crafted text files with unusual characters crash the tool or potentially allow harmful actions on the computer.
- Exploitation
- Local Privilege
- Attacker needs
- Low Privilege
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Application
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The keycompare_mb function in sort.c performs an incorrect size calculation for multibyte UTF-8 characters on 64-bit platforms, resulting in a heap-based buffer overflow that can lead to application crash or arbitrary memory corruption.
Why it matters to the business
Systems relying on the sort utility for processing international text data face risk of unexpected crashes during routine file operations, potentially disrupting data pipelines, batch jobs, and scripts that handle user-supplied or locale-specific content.
How an attack unfolds
An attacker with local access crafts a long UTF-8 string containing multibyte characters, supplies it as input to the sort command, and triggers the flawed size calculation in keycompare_mb, causing a heap overflow that may be leveraged for denial of service or further memory manipulation.
How to fix it
Upgrade GNU Coreutils to a version newer than 8.23 that contains the corrected size calculation in sort.c; rebuild and redeploy any statically linked binaries that embed the vulnerable sort implementation.
How to confirm the fix worked
Confirm the installed Coreutils version is newer than 8.23, test sort behavior against known long multibyte UTF-8 inputs, and verify the process no longer crashes or exhibits memory corruption under those conditions.
Typical attack path
- Obtain local execution access on a 64-bit system running affected Coreutils
- Prepare a malicious input file with an excessively long UTF-8 multibyte string
- Invoke the sort utility against the crafted input
- Trigger the buffer overflow in keycompare_mb to crash the process or corrupt memory
How to detect it
Review process execution logs and command history for invocations of sort against files containing long UTF-8 sequences; inspect core dumps or crash reports from the sort binary for heap corruption patterns around keycompare_mb.
What your security team should do
- Immediately inventory all systems for GNU Coreutils versions 8.23 and earlier
- Prioritize patching on any multi-user or production systems that process internationalized text
- Replace any custom or embedded builds of sort with the patched upstream version
- Monitor for new Coreutils releases and integrate version checks into configuration management
The record
The keycompare_mb function in sort.c in sort in GNU Coreutils through 8.23 on 64-bit platforms performs a size calculation without considering the number of bytes occupied by multibyte characters, which allows attackers to cause a denial of service (heap-based buffer overflow and application crash) or possibly have unspecified other impact via long UTF-8 strings.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Mageia:4 | coreutils | 0 | 8.21-6.2.mga4 |
| SUSE:Linux Enterprise Desktop 12 | coreutils | 0 | 8.22-9.1 |
| SUSE:Linux Enterprise Server 12 | coreutils | 0 | 8.22-9.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 | coreutils | 0 | 8.22-9.1 |
| openSUSE:Tumbleweed | coreutils | 0 | 8.26-1.1 |
Related vulnerabilities
- CVE-2015-4042 Integer overflow in the keycompare_mb function in sort.c in sort in GNU Coreutils through… Also affects coreutils
- CVE-2014-9471 The parse_datetime function in GNU coreutils allows remote attackers to cause a denial of… Also affects coreutils
- CVE-2025-5278 A flaw was found in GNU Coreutils. Also affects coreutils
- CVE-2016-7545 SELinux policycoreutils allows local users to execute arbitrary commands outside of the… Also affects coreutils
- CVE-2026-120931 Out of bounds write in WebGL in Google Chrome on on Android prior to 156.0.8078.47… CWE-787
- CVE-2026-61495 TinyUSB through 0.21.0, fixed in commit e85c2b8, contains an out-of-bounds write… CWE-787
- CVE-2026-121037 Out of bounds write in ANGLE in Google Chrome on on Windows prior to 157.0.8103.38… CWE-787
- CVE-2026-120952 An out-of-bounds write in the MongoDB Atlas SQL ODBC Driver may be triggered when a value… CWE-787