Cloudanix VulnDB

CVE-2015-4041

High · 7.8

CVSS

7.8

EPSS

0.5%

Published

Jan 24, 2020

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

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.

Exploit Available
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

  1. Obtain local execution access on a 64-bit system running affected Coreutils
  2. Prepare a malicious input file with an excessively long UTF-8 multibyte string
  3. Invoke the sort utility against the crafted input
  4. 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