Miggo Logo

GHSA-6fgx-x7m2-74qm: tracexec has `env` command argument injection via environment variables starting with dash in traced exec events

N/A

CVSS Score

Basic Information

CVE ID
-
EPSS Score
-
Published
10/13/2025
Updated
10/13/2025
KEV Status
No
Technology
TechnologyRust

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
tracexecrust< 0.14.00.14.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability lies in the way tracexec reconstructs and displays the command line of traced processes, specifically when dealing with environment variables. When a traced process is executed with an environment variable whose key begins with a dash (e.g., -a=b), tracexec would incorrectly place this variable in the reconstructed command line for the env utility. This could lead to the environment variable being interpreted as a command-line argument to env, causing an argument injection. This is a UI-level vulnerability, but it could lead to code execution if a user copies and executes the maliciously crafted command line from the tracexec output.

The root cause is the failure to properly sanitize or escape environment variable keys that start with a dash. The fix involves detecting such environment variables and then inserting a -- separator in the reconstructed command line before the environment variables are listed. This tells the env command to stop processing command-line options, and to treat all subsequent arguments as environment variable assignments.

The vulnerable functions identified are those involved in processing the environment variables (proc::parse_failiable_envp, proc::diff_env, ptrace::inspect::read_env) which, in their vulnerable state, did not check for the problematic keys. The vulnerability manifests in the UI and printer output, which were patched to use the information from the fixed processing functions to correctly format the command string.

Vulnerable functions

proc::parse_failiable_envp
src/proc.rs
The original `parse_failiable_envp` function processed environment variables without checking if their keys started with a dash. This allowed potentially malicious environment variable keys to be passed on to other parts of the program, which would then incorrectly construct the command line for the `env` command, leading to argument injection. The function was modified to detect and flag such environment variables.
proc::diff_env
src/proc.rs
The `diff_env` function is responsible for comparing two sets of environment variables. The vulnerable version of this function did not check for newly added or modified environment variable keys that start with a dash. This information is crucial for the UI/printing logic to know when to add the `--` argument separator to prevent command injection. The patched version now tracks this information.
ptrace::inspect::read_env
src/ptrace/inspect.rs
This function reads the environment variables from the memory of a traced process. The original implementation did not check for and flag environment variable keys starting with a dash. The new implementation returns a boolean flag indicating the presence of such keys, which is then used to prevent the argument injection vulnerability when reconstructing the command for display.

WAF Protection Rules

WAF Rule

### Imp**t *or tr***x**'s *omm*n* lin* r**onstru*tion ***tur*, w**n * tr**** pro**ss *x**ut*s *not**r pro**ss wit* * *nvironm*nt v*ri**l* w**r* t** k*y st*rts wit* * **s*, tr***x** in*orr**tly s*ows its *omm*n*lin* w**r* su** *nvironm*nt v*ri**l*s *

Reasoning

T** vuln*r**ility li*s in t** w*y `tr***x**` r**onstru*ts *n* *ispl*ys t** *omm*n* lin* o* tr**** pro**ss*s, sp**i*i**lly w**n ***lin* wit* *nvironm*nt v*ri**l*s. W**n * tr**** pro**ss is *x**ut** wit* *n *nvironm*nt v*ri**l* w*os* k*y ***ins wit* *