CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-35374

CVE-2026-35374: Arbitrary File Truncation via TOCTOU Race Condition in uutils coreutils split

Amit Schendel
Amit Schendel
Senior Security Researcher

Nov 20, 2026·11 min read·2 visits

Executive Summary (TL;DR)

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.

Vulnerability Overview

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.

Root Cause Analysis

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.

Code Analysis

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:

  1. Atomic Creation (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.
  2. Non-Destructive Fallback Open: When 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.
  3. Descriptor-Based Verification: The helper 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.
  4. Deferred Descriptor Truncation: Only after the descriptor check confirms the output file is distinct from the input file does the code call 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.

Exploitation

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:

  1. Target Identification: The attacker monitors or triggers an execution of uutils split where the working directory (or specified output prefix directory) is writable by the attacker.
  2. Pre-Validation State: Before 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.
  3. Winning the Race Window: Immediately after the pre-open path validation completes—or between chunk creation passes when 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).
  4. Truncation and Overwrite: The 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/null

If 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.

Impact Assessment

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:

  • Integrity Impact (High): The attacker can force a process running under another user's UID to clobber arbitrary files writable by that UID, replacing legitimate file contents with fragments of the input stream being processed by split.
  • Availability Impact (High): Because 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.

Remediation

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 58040feb5c66fce588a7ffac299b3a23bd55cd81

In environments where immediate patching is not feasible, administrators and developers should apply the following operational mitigations:

  1. Avoid Shared Writable Directories: Never execute 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.
  2. Enforce Kernel Symlink Protections: On Linux systems, ensure that the 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=1

Official Patches

uutilsUpstream patch commit fixing TOCTOU race in uu_split
uutilsMerged pull request containing the fix and safe traversal regression test
uutilsInitial pull request tracking issue #11401

Fix Analysis (1)

Technical Appendix

CVSS Score
6.3/ 10
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
EPSS Probability
0.08%
Top 100% most exploited

Affected Systems

uutils coreutils (uu_split)

Affected Versions Detail

Product
Affected Versions
Fixed Version
coreutils (uu_split)
uutils
< 0.2.2 (prior to commit 58040feb5c66fce588a7ffac299b3a23bd55cd81)0.2.2
AttributeDetail
Vulnerability TypeCWE-367: Time-of-Check Time-of-Use (TOCTOU) Race Condition
Affected Componentuutils coreutils split utility (uu_split)
Attack VectorLocal (Requires write permissions in the destination directory)
CVSS v3.1 Score6.3 Medium (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H)
EPSS Score0.08% (0.11th Percentile)
Security ImpactArbitrary file truncation and data overwrite (High Integrity & Availability Impact)
Exploit StatusRegression test available; no active exploitation reported
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1565.001Stored Data Manipulation
Impact
T1485Data Destruction
Impact
T1036Masquerading
Defense Evasion
CWE-367
Time-of-Check Time-of-Use (TOCTOU) Race Condition

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.

Vulnerability Timeline

CVE-2026-35374 published to CVE.org and NVD by Canonical
2026-04-22
Fix commit 58040feb5c66fce588a7ffac299b3a23bd55cd81 committed to uutils/coreutils
2026-06-05
NVD record updated with CVSS and CWE analysis
2026-10-26

References & Sources

  • [1]GitHub Commit: 58040feb5c66fce588a7ffac299b3a23bd55cd81
  • [2]GitHub Pull Request #12565
  • [3]GitHub Pull Request #11401
  • [4]NVD Entry for CVE-2026-35374
  • [5]CVE.org Record for CVE-2026-35374
  • [6]Shodan CVEDB Entry for CVE-2026-35374

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•41 minutes ago•CVE-2026-104773
6.8

CVE-2026-104773: Session Fixation in CKAN User Registration View

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.

Alon Barad
Alon Barad
1 views•9 min read
•about 3 hours ago•CVE-2026-35377
3.3

CVE-2026-35377: Local Denial of Service via Improper Single-Quote Backslash Parsing in uutils coreutils env

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.

Alon Barad
Alon Barad
2 views•9 min read
•about 4 hours ago•CVE-2026-35376
4.5

CVE-2026-35376: Time-of-Check Time-of-Use (TOCTOU) Race Condition in uutils coreutils chcon

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.

Amit Schendel
Amit Schendel
2 views•10 min read
•about 5 hours ago•CVE-2026-105802
8.6

CVE-2026-105802: Arbitrary Command Execution via Submodule Configuration Injection in Git LFS

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.

Alon Barad
Alon Barad
2 views•12 min read
•about 6 hours ago•CVE-2026-105803
8.6

CVE-2026-105803: Arbitrary Command Execution via .lfsconfig Parsing in Git LFS

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.

Alon Barad
Alon Barad
4 views•10 min read
•about 7 hours ago•CVE-2026-77367
9.4

CVE-2026-77367: Unauthenticated SQL Injection in Daptin Entity Listing Endpoints

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.

Alon Barad
Alon Barad
5 views•9 min read