Out-of-bounds read in GNU coreutils uniq when -w processes multibyte input

Note: This data is for reference and cybersecurity research purposes only.CyStack advises users not to use this information for unlawful purposes.

What is CVE-2026-56391?

CVE-2026-56391 is a vulnerability classified as Out-of-bounds Read, affecting coreutils (affected versions: 9.5 – ≤ 9.11). This vulnerability is rated Medium, with a CVSS score of 4.6. Current sources do not report this vulnerability as exploited.

Overview

Original source data

GNU coreutils uniq is vulnerable to an out‑of‑bounds read due to incorrect handling of multibyte input when the -w (--check-chars) option is used. The find_field() function miscalculates the byte length of characters by repeatedly processing a fixed pointer instead of advancing through the input, resulting in an inflated length value. This incorrect length is later used in a memcmp operation, causing reads beyond the allocated buffer when processing crafted multibyte input. When running GNU coreutils uniq with attacker-provided arguments, this behavior leads to a crash and potential adjacent heap memory exposure. This issue has been fixed in the commit d64e35a8a4c0e4608321433e0d84d917e4e36371.

Affected products and scope

GNU coreutils, specifically the uniq utility. The record lists a single contiguous run of coreutils 9.x releases as affected; the exact bounds are in the version table for this entry, and releases before that run are not listed. In scope are deployments where uniq is invoked with -w or --check-chars over untrusted multibyte text, which includes scripts and services that shell out to coreutils. Configurations that never pass the check-chars option, or that only ever compare trusted single byte text, do not exercise the faulty code path.

Technical details

The weakness is an out-of-bounds read (CWE-125): code reads memory outside the region it allocated. The -w or --check-chars option limits comparison to a set number of characters per line, so the tool must convert a character count into a byte count, which means walking through multibyte input. In find_field() that calculation repeatedly processes a fixed pointer instead of advancing through the string, so the resulting byte length comes out larger than the real one. The inflated length is then used in a memcmp comparison, which reads beyond the end of the allocated buffer. The record attributes the fault to that length miscalculation, states that the crash and the possible adjacent heap memory exposure follow from it, and points to the upstream commit that fixes it. Public detail beyond that is limited: the record does not describe how a caller reaches the faulty path in any particular program.

Exploitability

Local in the sense that the attacker must get data and arguments into someone's uniq invocation; no network service is involved and nothing is remotely reachable by itself. No privileges are required. The record's scoring notes user interaction, which fits the shape of the bug: a person or an automated job has to run uniq with the check-chars option over the crafted text. The record lists no public exploit and no known exploitation in the wild.

Technical impact

An attacker who controls the input and the arguments can make uniq read past its buffer. That produces a crash, and with it a denial of service for that process or the pipeline it belongs to, plus a possible partial disclosure of adjacent heap memory. The record describes no memory writes, no code execution and no privilege gain, and records integrity impact as none. Confidentiality impact is limited rather than full, because only memory adjacent to the buffer is described as reachable.

Business impact

uniq is rarely run by hand. It sits inside shell scripts, log processing jobs and data pipelines, often on machines that also handle uploaded or third party text. Where an attacker can influence either the text being compared or the arguments passed to the command, they can crash that step, which can abort a larger batch job and cost time to diagnose. The same bug can disclose a limited amount of adjacent heap memory, meaning data from the same process, which may include other content that process had read. Teams that process untrusted text through coreutils should treat this as a real, if narrow, data handling problem. Teams whose uniq calls use fixed arguments on internally generated input have little exposure.

Remediation

Move to a coreutils build that contains the upstream fix. The record identifies the fixing commit, and in practice that means taking your distribution's patched coreutils package rather than building from source. If updating has to wait, keep attacker controlled data and attacker controlled arguments away from the check-chars option: validate or normalise untrusted multibyte text before it reaches the tool, and stop passing user supplied strings through as command line arguments to coreutils utilities. The record documents no other workaround.

Detection

Watch for uniq processes exiting abnormally, particularly in batch jobs and pipelines whose argument list contains -w or --check-chars, and check exit codes and core dumps around text processing steps that handle external input. Review scripts and services that assemble uniq command lines from user supplied fields; that data flow is the exposure rather than a fixed signature. Where process execution is logged, alert on uniq invocations whose arguments or input come from outside the organisation.

Sources (10)
Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.