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.

