/

CVE-2026-35338

Severity:

HIGH RISK

(7.3)

Path Traversal / Incomplete Path Validation in uutils

CVE-2026-35338

Analyzed

Vulnerability type

Category:

Path Traversal / Incomplete Path Validation

CWE:

CWE-22

Impact:

System-wide Permission Corruption and Denial of Service

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

The chmod implementation in uutils coreutils fails to canonicalize target paths when enforcing the --preserve-root safety flag, only checking for a literal "/" path.

This allows users to use path variants or symbolic links to bypass protection and run destructive recursive permission changes against the root filesystem, potentially rendering the system unusable.

Affected context

This vulnerability arises in environments using the uutils coreutils implementation of chmod with the --preserve-root option, typically to protect against accidental or destructive recursive operations on "/".

The issue is present when chmod accepts non-canonical representations of the root directory—such as paths containing ".." segments or symbolic links that resolve to "/"—without normalizing or resolving those paths before enforcing the safety check.

It primarily affects systems where users or automation scripts rely on --preserve-root as a safety net while performing recursive permission changes on large directory trees.

Exploit preconditions

  • Attack surface: Local command-line usage of uutils coreutils chmod (interactive sessions, scripts, or automated jobs).
  • Required access: Ability to execute chmod with recursive flags and specify paths that resolve to the root filesystem; typically standard user or administrative shell access.
  • Trigger point: Invocation of chmod -R (or similar recursive options) with --preserve-root on a path that is not literally / but resolves to / via path traversal (/../) or symlinks.
  • Why exploitation is possible: The implementation validates only the literal string of the target path against /, without canonicalizing it or resolving symbolic links. As a result, different textual representations of the same root location bypass the safeguard intended by --preserve-root.

Why this happens

The underlying bug is a path validation flaw consistent with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

Instead of performing canonicalization (resolving .., . and symbolic links) and then verifying whether the final resolved path is the root directory, the code checks only whether the provided path string equals /.

This allows logically equivalent paths, such as /../ or symlinked paths that ultimately refer to /, to slip past the protection logic.

Conceptually, the implementation trusts the syntactic form of the path rather than its semantic, resolved location in the filesystem tree, breaking the invariant that --preserve-root should prevent recursive operations on the root.

Potential impact

  • Recursive removal of permissions (e.g., chmod -R 000) across the root filesystem may occur.
  • System services and binaries can become inaccessible due to misconfigured permissions.
  • Login shells and user home directories may become unreadable, causing system-wide logon failures.
  • Automated processes and cron jobs may fail en masse, leading to effective denial of service.
  • Recovery might require booting from external media and manual permission restoration or full system reinstallation.

General mitigation guidance

Mitigation should focus on ensuring that path-based safety mechanisms operate on resolved, canonical paths rather than raw input strings.

Recommended defensive patterns include:

  • Canonicalizing all filesystem paths before applying safety checks, including resolution of . and .. segments and symbolic links.
  • Implementing root-preservation logic that verifies whether the resolved path is within a set of disallowed directories (e.g., /, critical system mount points) before performing recursive operations.
  • Designing CLI safety flags as secure-by-default, treating ambiguous or unresolvable paths conservatively (i.e., refuse to proceed instead of assuming safety).
  • Applying the principle of least privilege to recursive permission changes: limit the scope of operations to known-safe subtrees rather than broad paths that might resolve to /.
  • Encouraging operational practices that avoid running bulk chmod -R commands at the filesystem root and instead target narrowly scoped paths.

How teams detect issues like this

Detection efforts should aim both at code-level issues and operational misuse patterns:

  • Use static analysis or code review to flag path comparisons that rely on raw string equality (e.g., path == "/") instead of operating on normalized, resolved paths.
  • Add tests and policies ensuring that any "preserve root" or safety-guard functionality canonicalizes paths and handles symlinks explicitly.
  • Monitor shell histories, automation scripts, and CI/CD pipelines for risky patterns like chmod -R on top-level or dynamically constructed paths, especially when coupled with safety flags that might be assumed to be robust.
  • Incorporate regression tests that exercise corner-case paths (e.g., /../, symlink chains to /) whenever filesystem safety features are modified.
  • Optional tooling such as linters or command-wrappers can enforce guardrails by rejecting dangerous invocations (e.g., recursive chmod near /) regardless of the underlying implementation.

Sources

SourceLink
github.comgithub.com/uutils/coreutils/pull/10033
github.comgithub.com/uutils/coreutils/releases/tag/0.6.0

Frequently asked

questions

Typically no, this is a local vulnerability. An attacker needs the ability to execute chmod (directly or indirectly through scripts or automation) with recursive operations on paths that resolve to the root filesystem.

Exploitation generally requires local user access capable of running chmod. The impact is most severe when the user has elevated privileges or when the command is embedded in privileged scripts, since permission changes to critical system paths may otherwise be constrained.

The robust fix is to canonicalize and resolve all target paths—including symbolic links—before checking whether they map to / or other protected directories, and then enforce --preserve-root (or equivalent safeguards) based on the resolved path rather than the raw input string.

Treat any path-based safety feature as a security boundary: always resolve paths, avoid direct string comparisons for critical directory checks, systematically test edge cases with symlinks and .. components, and incorporate these patterns into secure coding guidelines and automated review criteria.

Find out what's already
exploitable in your codebase.