Summary
An OS command injection vulnerability in Cloud CLI's git configuration endpoint allows user-controlled gitName and gitEmail values to be interpolated into shell commands executed via child_process.exec().
Because special shell syntax remains interpretable inside double quotes, an authenticated attacker can craft input that triggers arbitrary operating system command execution on the host running Cloud CLI.
Affected context
This issue affects Cloud CLI (Claude Code UI) desktop and mobile deployments where the /api/user/git-config API is exposed to authenticated users and implemented using shell commands constructed from user-supplied values.
The vulnerability is present when:
- The server uses child_process.exec() or equivalent to run git configuration commands
- gitName and gitEmail parameters are concatenated into shell command strings
- Only double quotes (") are escaped, leaving backticks, $() substitution, and backslash escapes intact within double-quoted bash strings.
Exploit preconditions
- Attack surface: HTTP(S) API endpoint
/api/user/git-config - Required access: Valid authenticated user session in Cloud CLI; no special OS-level privileges required beyond the service process
- Trigger point: Submission of crafted gitName or gitEmail parameters that are interpolated into a shell command executed by child_process.exec()
- Why exploitation is possible: The application performs string interpolation into a shell command and relies on insufficient escaping inside double quotes, allowing bash to interpret backticks, command substitution, and escape sequences as executable syntax.
Why this happens
The root cause is the construction of shell commands using untrusted input and passing them to a shell interpreter via child_process.exec().
This is a form of OS command injection corresponding to CWE-94: Improper Control of Generation of Code (Code Injection), where attacker-controlled data becomes part of executable code—in this case, shell command code.
Relying on ad-hoc escaping within double-quoted strings is inherently fragile, because bash still interprets features such as backticks, $() command substitution, and escape sequences, enabling attackers to smuggle additional commands into the execution context.
Potential impact
- Execution of arbitrary OS commands with the privileges of the Cloud CLI process
- Reading, modifying, or deleting files accessible to the application user account
- Theft of source code, credentials, or other sensitive data from the host environment
- Lateral movement within the developer's workstation or CI environment
- Installation of backdoors, malware, or persistence mechanisms on the affected system
General mitigation guidance
Effective mitigation centers on eliminating shell command construction from untrusted input and reducing the trust placed in user-provided values:
- Use parameterized, library-level APIs instead of shelling out (e.g., git libraries or child_process.spawn/execFile with argument arrays and no shell)
- Avoid passing user input through a shell interpreter; if a shell is truly unavoidable, strictly whitelist allowable characters and patterns rather than attempt escaping
- Separate data from control by treating gitName and gitEmail as pure data arguments, not fragments of command strings
- Run the service under a least-privilege account with minimal filesystem and network permissions to limit blast radius
- Apply generic hardening on hosts running Cloud CLI, such as process-level sandboxing where feasible
How teams detect issues like this
Detection typically involves a mix of code-level analysis and operational monitoring:
- Static analysis rules to flag uses of child_process.exec(), system(), or similar APIs where untrusted input flows into command strings
- Code review checklists that explicitly call out shell command construction and require justification or safer alternatives
- Pattern-based scanning for string concatenation or template literals that combine user input with shell metacharacters (e.g., backticks, $(), pipes, semicolons)
- Runtime monitoring and logging for unusual git configuration requests or commands executed by the Cloud CLI process, potentially correlated with user activity
- Integration of automated security review tools in CI pipelines to detect command injection patterns before release

