/

CVE-2026-58302

Severity:

HIGH RISK

(8.4)

Path Traversal (CWE-22) in LinuxCNC rtapi_app Loader

CVE-2026-58302

Deferred

Vulnerability type

Category:

Path Traversal in Module Loading

CWE:

CWE-22

Impact:

Local Privilege Escalation to Root

Severity:

HIGH RISK

(8.4)

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

A path traversal flaw in the LinuxCNC rtapi_app module loader allows an unprivileged local user to control which shared library is loaded by a SUID-root binary.

Because the process retains elevated privileges during dlopen() of a user-supplied module path, a crafted library can execute code as root, resulting in local privilege escalation.

Affected context

This vulnerability appears in LinuxCNC deployments using the linuxcnc-uspace build where rtapi_app is installed as a SUID-root helper and dynamically loads modules at runtime.

It becomes relevant on systems that allow unprivileged users to invoke rtapi_app and provide module names without strong path constraints, such as locked-down search paths or enforced whitelists.

Environments that rely on user-extensible modules or shared library plugins are more likely to expose the vulnerable behavior if filesystem permissions allow writing to loadable paths.

Exploit preconditions

  • Attack surface: Local invocation of the rtapi_app SUID-root binary
  • Required access: Ability to run rtapi_app and create or place shared libraries on the filesystem
  • Trigger point: Supplying a crafted module name that uses path traversal to point dlopen() at an attacker-controlled library
  • Why exploitation is possible: The SUID-root process performs module loading using user-controlled paths without restricting traversal or enforcing trusted directories, while retaining elevated privileges during library initialization

Why this happens

The underlying bug stems from treating user-supplied module names as trusted file paths and passing them directly to dlopen() in a SUID-root context.

This maps to CWE-22: Path Traversal, where unvalidated or insufficiently constrained paths allow attackers to escape intended directories and target arbitrary files.

Conceptually, any privileged component that accepts a filename or module identifier from an untrusted caller must either strictly constrain it to a trusted search space or decouple the privileged operation from user control to avoid loading attacker-controlled code.

Potential impact

  • Unprivileged users may gain full root access on the affected system
  • Attacker-controlled shared libraries could execute arbitrary code with elevated privileges
  • System integrity can be compromised, including modification of critical configuration or binaries
  • Local persistence mechanisms may be installed under root-owned locations
  • Security boundaries between regular users and administrative accounts can be effectively bypassed

General mitigation guidance

Effective mitigation focuses on reducing the trust placed in user-controlled module identifiers and constraining how privileged code interacts with the filesystem.

Common defensive patterns include:

  • Restricting module loading to a fixed, root-owned directory that is not writable by unprivileged users
  • Normalizing and validating module names against a strict whitelist or registry of permitted modules instead of accepting raw paths
  • Dropping elevated privileges before performing any user-influenced library loading, then re-acquiring only minimal required permissions as needed
  • Applying least-privilege principles so that helpers do not run SUID-root unless absolutely necessary, and splitting functionality into non-privileged loaders where possible
  • Designing plugin architectures such that user-extensible components never execute inside a highly privileged process without an explicit trust model

How teams detect issues like this

Organizations can detect similar vulnerabilities by examining how privileged binaries accept and process path-like inputs.

Useful approaches include:

  • Static analysis rules that flag calls to dlopen(), fopen(), or similar APIs when arguments derive from user input, especially in SUID or service-account contexts
  • Code review checklists that highlight any use of relative paths, path concatenation, or user-controlled module names within privileged components
  • File-system and policy-based checks ensuring plugin or module directories are non-writable by unprivileged users
  • Automated security testing that attempts to supply traversal patterns and out-of-scope paths to module loaders and plugin systems to validate that they are constrained

Sources

SourceLink
bugs.debian.orgbugs.debian.org/1140943
github.comgithub.com/LinuxCNC/linuxcnc/commit/00d534c87464a3ed446656998aa02b8abc74b391
github.comgithub.com/LinuxCNC/linuxcnc/commit/ea7cd579d39b586952a42e3da9a26d3e36e7a272
github.comgithub.com/LinuxCNC/linuxcnc/compare/v2.9.8...v2.9.9

Frequently asked

questions

It is a local vulnerability. An attacker must have the ability to run rtapi_app and create or place shared libraries on the target system.

The attacker typically needs standard local user access, sufficient to invoke the SUID-root rtapi_app binary and write to a location from which the process can load a shared library.

The safest pattern is to constrain module loading to trusted, non-writable directories, validate module identifiers against a whitelist, and avoid performing dynamic code loading while running with elevated privileges.

Future designs should avoid SUID-root helpers where possible, separate privileged operations from user-controlled extensibility, enforce strict path validation, and incorporate security reviews for any component that loads plugins or libraries based on user input.

Find out what's already
exploitable in your codebase.