Nov 20, 2026·11 min read·2 visits
A TOCTOU race condition in the uutils coreutils split utility allows a local attacker with write access to the destination directory to cause arbitrary file truncation and data loss by swapping the target output path with a symbolic link between path validation and file opening.
CVE-2026-35374 is a Time-of-Check to Time-of-Use (TOCTOU) race condition (CWE-367) in the split utility of uutils coreutils. The utility validates that the input and output paths do not refer to the same file before opening the output file with truncation flags. A local attacker with write permissions in the destination directory can replace the output file path with a symbolic link during this race window, causing the process to truncate and overwrite arbitrary files accessible to the user executing split.
The uutils coreutils project is a cross-platform reimplementation of the GNU coreutils suite written in Rust. Among its utilities is split (implemented in the uu_split crate), which divides a single input file or standard input stream into multiple smaller output chunks based on byte size, line count, or chunk specifications. To prevent accidental data corruption, split must ensure that the generated output files do not resolve to the same underlying file as the input source being read.
Prior to commit 58040feb5c66fce588a7ffac299b3a23bd55cd81, uu_split enforced this safety check using path-based validation prior to opening the output files. The utility queried filesystem metadata via paths to verify that the destination filename did not match the input file's device and inode identifiers. Once this verification passed, the program proceeded to open the target path using flags that immediately truncated the file upon opening.
This two-step sequence introduces a Time-of-Check to Time-of-Use (TOCTOU) race condition (CWE-367). Because filesystem paths are mutable references rather than stable object handles, the state verified during the initial path check is not guaranteed to hold when the subsequent open system call executes.
If split writes output shards into a directory where a local unprivileged attacker holds write permissions, the attacker can manipulate the directory entries during the race window. By substituting an expected output filename (such as xaa) with a symbolic link pointing to the input file or another sensitive file owned by the user invoking split, the attacker causes the utility to truncate and overwrite the target file.
The root cause of CVE-2026-35374 is the decoupling of file identity validation from file descriptor acquisition, combined with the use of immediate truncation flags during path resolution. In src/uu/split/src/split.rs, the utility called paths_refer_to_same_file to compare the input path and the generated output chunk filename before calling platform::instantiate_current_writer.
In the platform-specific implementations (src/uu/split/src/platform/unix.rs and src/uu/split/src/platform/windows.rs), instantiate_current_writer handled new output chunks (is_new == true) by invoking std::fs::OpenOptions::new().write(true).create(true).truncate(true).open(Path::new(filename)). On Unix systems, this translates directly to an openat syscall with the O_WRONLY | O_CREAT | O_TRUNC flags.
When O_TRUNC is passed to openat without O_EXCL or O_NOFOLLOW, the operating system kernel resolves the path—following any terminal symbolic link—and resets the target inode's data length to zero inside the kernel before returning the file descriptor to user space. The user-space process has no opportunity to inspect the opened file descriptor before data destruction occurs.
A secondary flaw existed in the handling of re-opened output files (is_new == false), which occurs when split operates in round-robin chunking modes (such as -n r/K) and must re-open previously created output files to append additional data. In this code path, instantiate_current_writer opened the path with .append(true) without performing any verification on the resulting file descriptor, allowing an attacker to swap the output file with a symbolic link between write passes and corrupt the target file with appended chunks.
In the vulnerable implementation of src/uu/split/src/platform/unix.rs, instantiate_current_writer accepted only the filter, filename, and is_new parameters. It did not have access to the input reference and relied entirely on the caller's prior path check:
// Vulnerable code in src/uu/split/src/platform/unix.rs
pub fn instantiate_current_writer(
filter: Option<&str>,
filename: &OsStr,
is_new: bool,
) -> Result<BufWriter<Box<dyn Write>>> {
match filter {
None => {
let file = if is_new {
// VULNERABLE: Opens path with O_CREAT | O_TRUNC directly after pre-open path check
std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(Path::new(filename))
.map_err(|e| match e.kind() {
ErrorKind::IsADirectory => Error::other(
translate!("split-error-is-a-directory", "dir" => filename.quote()),
),
_ => Error::other(
translate!("split-error-unable-to-open-file", "file" => filename.quote()),
),
})?
} else {
// VULNERABLE: Re-opens file for appending without verifying descriptor identity
std::fs::OpenOptions::new()
.append(true)
.open(Path::new(filename))
.map_err(|_| {
Error::other(translate!(
"split-error-unable-to-reopen-file",
"file" => filename.quote()
))
})?
};
Ok(BufWriter::new(Box::new(file) as Box<dyn Write>))
}
// ...Commit 58040feb5c66fce588a7ffac299b3a23bd55cd81 resolves this across both unix.rs and windows.rs by passing input: &OsStr into instantiate_current_writer and replacing the single-step truncating open with create_or_truncate_output_file:
// Patched code in src/uu/split/src/platform/unix.rs
fn create_or_truncate_output_file(input: &OsStr, filename: &OsStr) -> Result<std::fs::File> {
// Step 1: Attempt atomic exclusive creation (O_WRONLY | O_CREAT | O_EXCL)
match std::fs::OpenOptions::new()
.write(true)
.create_new(true)
.open(Path::new(filename))
{
Ok(file) => Ok(file),
// Step 2: If the path already exists, open it WITHOUT truncation
Err(e) if e.kind() == ErrorKind::AlreadyExists => {
let file = std::fs::OpenOptions::new()
.write(true)
.open(Path::new(filename))
.map_err(|err| open_file_error(filename, err.kind()))?;
// Step 3: Validate the opened file descriptor against the input file
if input_and_output_refer_to_same_file(input, &file) {
return Err(Error::other(
translate!("split-error-would-overwrite-input", "file" => filename.quote()),
));
}
// Step 4: Truncate via the validated file descriptor (ftruncate)
file.set_len(0)
.map_err(|err| open_file_error(filename, err.kind()))?;
Ok(file)
}
Err(e) => Err(open_file_error(filename, e.kind())),
}
}
fn input_and_output_refer_to_same_file(input: &OsStr, output: &std::fs::File) -> bool {
let input_info = if input == "-" {
FileInformation::from_file(&std::io::stdin())
} else {
FileInformation::from_path(Path::new(input), true)
};
// Compares device and inode using fstat on the open output file handle
fs::infos_refer_to_same_file(input_info, FileInformation::from_file(output))
}The patch changes the file opening semantics in four ways:
create_new(true)): Calling .create_new(true) uses O_CREAT | O_EXCL. If a symbolic link (even a dangling one) or regular file exists at filename, the kernel rejects the open call with EEXIST (ErrorKind::AlreadyExists) without following the symlink or modifying any inode.AlreadyExists is caught, the file is opened with .write(true) and without .truncate(true). This acquires an active file handle pointing to the resolved object without altering its contents.input_and_output_refer_to_same_file invokes FileInformation::from_file(output), which executes fstat on the open file descriptor (or GetFileInformationByHandle on Windows) to compare its device and inode identifiers against the input source. Furthermore, the is_new == false append branch now performs this exact descriptor check before returning the writer.file.set_len(0), which executes ftruncate directly on the verified file descriptor.Regarding fix completeness: for the WASI target (src/uu/split/src/platform/mod.rs), descriptor-based inode comparison is unavailable, so the patch implements a best-effort fallback using std::fs::canonicalize inside paths_refer_to_same_file. Additionally, on Unix and Windows, while input_and_output_refer_to_same_file still queries input by path (FileInformation::from_path(Path::new(input), true)) when input != "-", it prevents the specific self-truncation loop where an output path is symlinked back to the input file. Note that because the fallback open does not use O_NOFOLLOW, if split is executed in a shared writable directory, an attacker can still point an output symlink to a third-party file (distinct from input) that the user running split has write access to; however, in standard POSIX environments, creating symlinks in shared directories is governed by kernel policies like fs.protected_symlinks.
Exploiting CVE-2026-35374 requires local access to the target system and write permissions in the directory where split writes its output chunks. No special privileges are required by the attacker, though the impact depends on the privileges of the victim user or automated service invoking split.
Because split generates predictable output filenames sequentially by default (xaa, xab, xac, or using a user-supplied prefix such as prefix_aa), the attacker knows the exact paths that will be checked and opened prior to execution. The attack proceeds as follows:
uutils split where the working directory (or specified output prefix directory) is writable by the attacker.split validates a specific chunk filename (or before split starts), the target output name (split_swap_aa) either does not exist or points to a benign dummy file so that the initial pre-open check (paths_refer_to_same_file) evaluates to false.split is re-opening files—the attacker atomically replaces the output filename with a symbolic link pointing to the target file (for example, using renameat2 or ln -sf).split process executes open("split_swap_aa", O_WRONLY | O_CREAT | O_TRUNC). The kernel traverses the newly placed symbolic link and truncates the victim file to zero bytes. As split continues execution, it writes partial chunk data from its input buffer into the victim file.The official regression test suite in util/check-safe-traversal.sh and the unit test reopened_writer_rejects_symlink_swapped_to_input demonstrate the symlink replacement mechanism:
# Setup input file and pre-positioned or race-swapped symlink
printf 'split_victim_payload' > split_victim
ln -s split_victim split_swap_aa
# Execute split with prefix 'split_swap_'
# Vulnerable versions truncate 'split_victim' via O_TRUNC before detecting any issue.
# Patched versions open with O_CREAT|O_EXCL, fall back to non-truncating open,
# detect matching device/inode via fstat, and abort without calling ftruncate.
$split_cmd -b 4 split_victim split_swap_ 2>/dev/nullIf the race is won against the input file itself, split truncates the very file it is currently reading from, causing immediate and permanent loss of the remaining input data. If the symlink targets another writable file owned by the invoking user (such as ~/.ssh/authorized_keys, source code files, or database files), that file is destroyed and overwritten with data fragments from the split operation.
CVE-2026-35374 is rated Medium severity with a CVSS v3.1 base score of 6.3 (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H). The Attack Vector is Local (AV:L) and requires Low Privileges (PR:L), reflecting the requirement that the adversary must already have local shell or process execution capable of modifying directory entries in the destination directory.
The Attack Complexity is High (AC:H) because successful exploitation relies on winning a filesystem race condition between the user-space path check and the subsequent open call, or timing the swap during multi-pass chunk writing. User Interaction is None (UI:N), as the attack can target automated cron jobs, build pipelines, or system scripts that invoke split in shared directories like /tmp or /var/tmp.
The security impact is concentrated entirely on Integrity (I:H) and Availability (A:H), with no direct Confidentiality (C:N) breach:
split.O_TRUNC immediately reduces the target file size to zero bytes, the original contents of the targeted file (or the input file itself) are permanently destroyed, leading to denial of service if configuration files, credentials, or critical datasets are truncated.The Exploit Prediction Scoring System (EPSS) score is 0.00077 (0.08%, 0.11th percentile), and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. There are currently no reports of active exploitation in the wild.
To remediate CVE-2026-35374, upgrade uutils coreutils (uu_split) to a release that incorporates commit 58040feb5c66fce588a7ffac299b3a23bd55cd81 (version 0.2.2 or later). Downstream Linux distributions that package rust-coreutils or uutils (such as Ubuntu) should apply the updated package builds provided by their package maintainers.
# Verify the installed uutils split version
coreutils split --version
# If building from source via Cargo, update to the patched revision
cargo install coreutils --git https://github.com/uutils/coreutils --rev 58040feb5c66fce588a7ffac299b3a23bd55cd81In environments where immediate patching is not feasible, administrators and developers should apply the following operational mitigations:
split with an output destination inside world-writable or group-writable directories (such as /tmp, /var/tmp, or shared project directories). Always create a dedicated, privately owned subdirectory with 0700 permissions before running split.fs.protected_symlinks sysctl parameter is enabled (1). This kernel control prevents processes from following symlinks located in sticky world-writable directories (like /tmp) when the owner of the symlink does not match the owner of the directory or the process UID.# Verify that Linux kernel symlink protection is active
sysctl fs.protected_symlinks
# Expected output: fs.protected_symlinks = 1
# Enable immediately if disabled
sudo sysctl -w fs.protected_symlinks=1CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
coreutils (uu_split) uutils | < 0.2.2 (prior to commit 58040feb5c66fce588a7ffac299b3a23bd55cd81) | 0.2.2 |
| Attribute | Detail |
|---|---|
| Vulnerability Type | CWE-367: Time-of-Check Time-of-Use (TOCTOU) Race Condition |
| Affected Component | uutils coreutils split utility (uu_split) |
| Attack Vector | Local (Requires write permissions in the destination directory) |
| CVSS v3.1 Score | 6.3 Medium (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H) |
| EPSS Score | 0.08% (0.11th Percentile) |
| Security Impact | Arbitrary file truncation and data overwrite (High Integrity & Availability Impact) |
| Exploit Status | Regression test available; no active exploitation reported |
| CISA KEV Status | Not Listed |
The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.
A session fixation vulnerability (CWE-384) exists in CKAN (Comprehensive Knowledge Archive Network) prior to versions 2.10.11 and 2.11.6. When configured with server-side session storage and active public web registration, the user registration view programmatically authenticates newly created accounts without regenerating the active session identifier. An attacker capable of fixing or capturing a victim's pre-authentication session cookie can hijack the newly registered account immediately after registration completes.
CVE-2026-35377 is an improper input validation vulnerability (CWE-20) in the env utility of uutils coreutils, the Rust-based reimplementation of GNU coreutils. When processing command-line arguments with the -S (--split-string) option, the uutils split-string tokenizer erroneously validates backslash sequences enclosed within single quotes against a fixed table of known escape characters. Under standard GNU env behavior, backslashes inside single quotes are treated literally (except for \\ and \'). Because uutils rejects unrecognized sequences such as \a, \x, or \| with exit code 125, automated scripts, shebang invocations, and administrative workflows relying on POSIX/GNU compatibility fail to execute, resulting in a local denial of service.
A Time-of-Check to Time-of-Use (TOCTOU) race condition in the chcon utility of uutils coreutils prior to version 0.8.0 allows a local attacker with write access to a directory tree undergoing recursive SELinux context relabeling to redirect extended attribute modifications to arbitrary system files.
A line delimiter injection vulnerability in Git Large File Storage (Git LFS) versions 0.6.0 through 3.8.0 allows remote attackers to execute arbitrary commands via crafted Git submodule URLs containing embedded line feed characters.
CVE-2026-105803 (GHSA-x72p-hmqp-46hw) is a high-severity arbitrary command execution vulnerability in Git Large File Storage (Git LFS) affecting versions from v1.3.0 prior to v3.8.1. The flaw stems from the combination of an unanchored regular expression in custom transfer adapter initialization (CWE-777) and insufficient syntactic validation during .lfsconfig key filtering (CWE-1286). An attacker can craft a repository containing a malicious .lfsconfig file that bypasses safe-key filtering restrictions and registers an arbitrary binary as a custom transfer adapter, leading to remote code execution when a victim clones or fetches from the repository.
An unauthenticated SQL injection vulnerability exists in Daptin prior to version 0.12.30. The generic entity listing handler fails to validate user-supplied sort parameters against the table schema before passing them to the goqu SQL query builder, enabling remote attackers to break out of SQL identifier quoting and execute arbitrary SQL subqueries.