Summary
Roxy-WI contains an OS command injection flaw in how it builds shell commands for handling configuration version files.
Authenticated low-privilege users can manipulate a URL path parameter so that it reaches an os.system() call, potentially executing arbitrary commands on the server.
Affected context
This vulnerability occurs in Roxy-WI deployments that expose the web interface to authenticated users with role level 3 or lower ("user").
It specifically affects the POST endpoint /config/versions/<service>/<server_ip>/<configver>/save, where the configver segment is interpolated into a shell command that normalizes config files.
The issue is present when the application relies on Pydantic validation for path parameters but still passes those parameters directly into an os.system() call without proper escaping, quoting, or avoiding the shell.
Exploit preconditions
- Attack surface: HTTP POST request to
/config/versions/<service>/<server_ip>/<configver>/save - Required access: Valid Roxy-WI account with role <= 3 ("user"); no elevated administrative privileges are required
- Trigger point: Submission of a crafted
configverpath segment that is concatenated into thedos2unixcommand - Why exploitation is possible: The
configverparameter is treated as a plain string, not passed throughEscapedString, and is directly used to build a shell command viaos.system(f"dos2unix -q {cfg}"), allowing shell metacharacters to alter command execution
Why this happens
The root cause is unsafe construction of shell commands using untrusted input within application logic.
Roxy-WI builds a command string containing a file path derived from the configver URL segment and passes it to os.system, which invokes /bin/sh -c under the hood.
Because the path segment is not sanitized, escaped, or constrained to a safe subset, attackers can inject shell syntax that the shell interpreter treats as additional commands.
This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where user-controllable data is incorporated into OS commands without proper neutralization, instead of using parameterized or API-based execution.
Potential impact
- Execution of arbitrary OS commands with the privileges of the Roxy-WI process
- Reading, modifying, or deleting configuration files for managed services (HAProxy, Nginx, Apache, Keepalived)
- Lateral movement by dropping backdoors or modifying reverse proxy rules
- Service disruption or denial of service by corrupting configs or terminating processes
- Potential escalation within the host environment if the Roxy-WI process runs with elevated permissions
General mitigation guidance
Mitigation centers on eliminating direct shell invocation with untrusted input and enforcing strict constraints on configuration paths.
Common defensive patterns include:
- Replacing
os.system(or equivalent shell wrappers) with APIs that do not invoke a shell, such assubprocess.run([...], shell=False)or language-native file transformation utilities - Treating URL path segments as opaque identifiers, validating them against an allowlist of known configuration versions rather than interpolating them into commands
- Applying robust input validation and normalization for path-related values, ensuring only expected characters and directory structures are permitted
- Running Roxy-WI under a dedicated, minimally privileged account so that even if commands are abused, the blast radius is reduced
- Isolating the management interface on restricted networks or VPN-only access to limit who can reach authenticated entry points
How teams detect issues like this
Detection efforts can focus on both code-level and runtime indicators:
- Static analysis rules that flag uses of
os.system,subprocesswithshell=True, or similar APIs when passed user-derived data (e.g., URL path parameters, form fields) - Code review practices that highlight any string concatenation or f-strings used to construct shell commands, especially in request-handling routes
- Security linters or automated review tools configured to enforce policies against shell invocation in web handlers or to require documented justification
- Runtime monitoring of command execution (e.g., audit logs, EDR) for unusual invocations of
dos2unix, shell interpreters, or unexpected arguments originating from web processes - Web server and application logs correlation to spot suspicious
configverpath segments containing shell metacharacters or atypical patterns

