/

CVE-2026-40032

Severity:

HIGH RISK

(7.8)

OS Command Injection in UAC Placeholder Substitution

CVE-2026-40032

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.8)

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

UAC (Unix-like Artifacts Collector) before 3.3.0-rc1 contains an OS command injection flaw where dynamically constructed command strings are passed directly to an eval-based execution function without proper sanitization.

If an attacker can influence iterator values like %line% or user-related placeholders such as %user% and %user_home%, they may execute arbitrary system commands with the privileges of the UAC process.

Affected context

The vulnerability appears in UAC's command construction and execution pipeline, specifically where the _run_command() function evaluates assembled command strings that include placeholder substitutions.

It becomes relevant in deployments where UAC is run with elevated or sensitive privileges and where some portion of the placeholder values:

  • Are sourced directly or indirectly from system files that can be influenced by local users (e.g., user or home directory records), or
  • Are derived from content iterated via foreach constructs that may include attacker-controlled or unvalidated text.

In such environments, placeholder expansion into shell commands without robust escaping or argument separation introduces a risk of command injection.

Exploit preconditions

  • Attack surface: Local or semi-local, depending on how UAC is invoked and which system files or inputs feed into %line%, %user%, and %user_home%.
  • Required access:
  • Ability to control or modify data that is used for placeholder substitution (e.g., lines processed by foreach, user-related metadata in system files, or configuration-driven inputs).
  • Ability to trigger or influence a UAC run that will process these placeholders.
  • Trigger point: Execution of _run_command() after placeholders have been substituted into a single shell command string that is passed to eval.
  • Why exploitation is possible: Placeholders are interpolated directly into a shell command string without proper quoting or argument separation, and the resulting command is evaluated by an eval-like mechanism, allowing shell metacharacters and command substitutions to be interpreted as additional commands.

Why this happens

The root cause is the construction of shell command strings from mixed-trust data, followed by execution through an eval-style API.

Instead of treating placeholder values as opaque data or individual arguments, the code concatenates them into a single command string that is interpreted by the shell.

This pattern maps directly to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where failure to escape or neutralize shell metacharacters allows untrusted data to alter the structure of the executed command.

The underlying bug class is "string-based command execution with interpolation," which is inherently unsafe whenever any portion of the string may be impacted by attacker-controlled or environment-derived input.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the UAC process
  • Reading, modifying, or deleting files accessible to the UAC account
  • Lateral movement within the host through credential theft or key extraction
  • Disruption of system monitoring or forensic collection, including log tampering
  • Use of the UAC process as a staging point for further compromise on the system

General mitigation guidance

Effective mitigation focuses on eliminating string-based command evaluation and tightening trust boundaries around placeholder inputs:

  • Prefer APIs that execute commands as argument arrays rather than through an intermediate shell (e.g., execve-style or library-native functions) so that data cannot alter command structure.
  • Treat placeholder values as untrusted input by default and apply strict encoding, quoting, or escaping before use in any command context.
  • Introduce explicit whitelisting or template constraints for allowed commands, separating fixed command templates from variable arguments.
  • Minimize the privilege level at which UAC runs, applying least-privilege principles and reducing the impact of a potential compromise.
  • Restrict the ability for regular users or lower-privileged processes to modify files or configuration sources that feed into %line%, %user%, and %user_home%.
  • Consider adding a "safe mode" where any dynamic command execution is disabled or constrained to a vetted subset of operations.

How teams detect issues like this

Organizations can look for this class of vulnerability using a combination of code-centric and runtime approaches:

  • Static analysis:
  • Rules that flag usage of eval-like functions or shell execution via command strings, especially where arguments are constructed using string concatenation or placeholder interpolation.
  • Pattern matching for functions that assemble commands from template strings containing variables such as %line%, %user%, and %user_home%.
  • Code review signals:
  • Any use of string-based shell commands that take input from system files, configuration, or user-derived data without clear quoting or argument splitting.
  • Absence of centralized sanitization routines or wrapper APIs for command execution.
  • Policy enforcement:
  • Enforce secure coding guidelines that disallow direct shell calls with dynamic strings in security-sensitive tools like forensic collectors.
  • Integrate automated code review or SAST tools that include checks for CWE-78-related patterns into CI/CD pipelines.

Sources

SourceLink
github.comgithub.com/tclahr/uac/commit/50ace60e172e38feb78347bdf579311c23eff078
github.comgithub.com/tclahr/uac/commit/cb95d7166cd47908e1189d9669e43f9a6d3d707f
github.comgithub.com/tclahr/uac/commit/d0fca5e36d8d6a33a4404f0f6fe92b0424544589
github.comgithub.com/tclahr/uac/issues/429
github.comgithub.com/tclahr/uac/pull/443
mobasi.aimobasi.ai/sentinel
vulncheck.comvulncheck.com/advisories/uac-rc1-command-injection-via-placeholder-substitution

Frequently asked

questions

Typically, it is not directly remote. Exploitation usually requires local or indirect control over the data feeding into UAC's placeholder values. However, in some environments, remotely supplied data might eventually be processed by UAC, effectively extending the attack surface.

The attacker needs control over inputs that end up in placeholders such as %line%, %user%, or %user_home%, and the ability to trigger or wait for a UAC run that processes these values. This often corresponds to local user access or control over configuration or data files read by UAC.

Replace eval-based or string-concatenated command execution with APIs that pass commands and arguments as structured arrays, and enforce strict separation between fixed command templates and variable data. Ensure all placeholder-derived values are treated as data only and never as executable fragments.

Adopt a secure design standard that forbids dynamic shell evaluation of interpolated strings, require code reviews for any new command execution paths, and rely on vetted helper functions that handle quoting and argument separation correctly. Complement these practices with automated static analysis tuned to detect CWE-78 patterns.

Find out what's already
exploitable in your codebase.