Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

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

CVE-2026-35376: Time-of-Check Time-of-Use (TOCTOU) Race Condition in uutils coreutils chcon Vulnerability ID: CVE-2026-35376 CVSS Score: 4.5 Published: 2026-11-20 A Time-of-Check to Time-of-Use (TOCTOU) race conditi

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

Vulnerability ID: CVE-2026-35376
CVSS Score: 4.5
Published: 2026-11-20

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.

TL;DR

During recursive directory relabeling (chcon -R), uutils coreutils resolves targets via unanchored pathname lookups instead of directory file descriptors. Local attackers can win a race condition via symlink or directory swapping to alter SELinux security contexts on arbitrary files outside the target hierarchy.

Technical Details

  • Vulnerability Type: CWE-367: Time-of-Check Time-of-Use (TOCTOU) Race Condition
  • Affected Component: uutils/coreutils chcon utility (uu_chcon) < 0.8.0
  • Attack Vector: Local (AV:L) / High Attack Complexity (AC:H)
  • CVSS v3.1 Score: 4.5 Medium (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L)
  • EPSS Score: 0.11% (1.31st Percentile)
  • Security Impact: Arbitrary SELinux context modification / Mandatory Access Control (MAC) policy bypass
  • Exploit Status: No known public exploits or active exploitation (Not in CISA KEV)
  • Fixed Version: uutils/coreutils 0.8.0 (Commit 7cfc74e47ffab452663be6842d788a5164d9688b)

Affected Systems

  • uutils/coreutils (uu_chcon)
  • coreutils (uu_chcon): < 0.8.0 (Fixed in: 0.8.0)

Code Analysis

Commit: 7cfc74e

Anchor chcon recursive traversal and SELinux context modifications to directory file descriptors via openat and /proc/self/fd

File: src/uu/chcon/Cargo.toml
@@ -27,6 +27,7 @@ selinux = { workspace = true }
 thiserror = { workspace = true }
 libc = { workspace = true }
 fts-sys = { workspace = true }
+rustix = { workspace = true, features = ["fs"] }
 fluent = { workspace = true }

File: src/uu/chcon/src/chcon.rs
@@ -499,111 +501,117 @@ fn process_file(
     fts: &mut fts::FTS,
     root_dev_ino: Option<DeviceAndINode>,
 ) -> Result<()> {
-    let mut entry = fts.last_entry_ref().unwrap();
+    let (file_full_name, fts_access_path, mut result) = {
+        let mut entry = fts
+            .last_entry_ref()
+            .expect("last_entry_ref is present after successful read_next_entry");
...
-        result = change_file_context(options, context, fts_access_path);
+        let traversal_dir_fd = fts
+            .current_dir_fd()
+            .map_err(|r| Error::from_io1(translate!("chcon-op-accessing"), &file_full_name, r))?;
+
+        result = change_file_context(
+            options,
+            context,
+            traversal_dir_fd.as_fd(),
+            &fts_access_path,
+            &file_full_name,
+        );
     }

Mitigation Strategies

  • Upgrade uutils/coreutils to version 0.8.0 or later to ensure recursive directory traversal anchors context changes to verified directory file descriptors.
  • Avoid executing recursive chcon operations as root across directory trees writable by unprivileged users.
  • Use native SELinux policy management utilities (semanage fcontext and restorecon) instead of ad-hoc recursive chcon commands.

Remediation Steps:

  1. Verify the installed version of uutils coreutils by running 'coreutils --version' or 'chcon --version'.
  2. Update the uutils/coreutils package via your distribution package manager or rebuild from source at tag 0.8.0 (or commit 7cfc74e47ffab452663be6842d788a5164d9688b).
  3. Audit automated administrative scripts, cron jobs, and container entrypoint scripts for invocations of 'chcon -R' on shared or world-writable directories.

References

Read the full report for CVE-2026-35376 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.