/

CVE-2026-31862

Severity:

CRITICAL RISK

(9.1)

OS Command Injection in Cloud CLI Git API Endpoints

CVE-2026-31862

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.1)

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

Cloud CLI (Claude Code UI) contains an OS command injection flaw in several Git-related API endpoints that construct shell commands using string interpolation of user-controlled parameters.

Authenticated users who can invoke these endpoints may execute arbitrary operating system commands on the host by supplying crafted values for fields like file, branch, message, or commit.

Affected context

This vulnerability affects Cloud CLI deployments where:

  • The Git-related API endpoints are exposed to authenticated users
  • Backend logic constructs Git commands using execAsync() with concatenated user input
  • The host environment has access to sensitive resources (filesystem, network, credentials)

It primarily impacts environments where Cloud CLI is run on developer machines, CI runners, or shared servers and where users are not fully trusted or plugins/scripts can issue authenticated API calls.

Exploit preconditions

  • Attack surface: Git-related API endpoints within the Cloud CLI backend (desktop or mobile app environment).
  • Required access: Valid authenticated access to the application or any channel that can issue authenticated requests (e.g., extensions, automation scripts).
  • User-controlled parameters: Git inputs such as file, branch, message, and commit are passed into shell commands via string interpolation.
  • Trigger point: When the application calls execAsync() to run Git commands that include these interpolated parameters.
  • Why exploitation is possible: The code treats user-controlled parameters as trusted, embedding them directly into shell command strings without proper escaping or use of argument-safe APIs, enabling injection of additional shell syntax.

Why this happens

The underlying issue is a classic OS command injection vulnerability, mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The Git-related API endpoints build shell command strings by interpolating user-controlled values (e.g., branch names or commit messages) and then execute them via execAsync().

Because the input is not strictly validated, normalized, or passed as discrete arguments, attackers can craft values containing shell metacharacters (such as command separators or redirection operators).

This pattern transforms benign data parameters into part of the executable command, allowing unintended commands to run with the privileges of the Cloud CLI backend process.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the Cloud CLI process
  • Reading, modifying, or deleting files accessible to the host user
  • Exfiltration of SSH keys, API tokens, or other developer secrets
  • Tampering with local Git repositories (rewriting history, injecting malicious code)
  • Pivoting to other systems via network access from the compromised host
  • Planting backdoors or malicious scripts in development environments and CI pipelines

General mitigation guidance

Effective mitigation generally focuses on eliminating string-based shell command construction and tightening trust boundaries around command execution:

  • Prefer using process-spawning APIs that accept command and arguments as separate parameters, avoiding shell interpretation entirely.
  • For Git operations, use dedicated library APIs or higher-level abstractions instead of hand-rolled shell commands.
  • Apply strict input validation and normalization on Git parameters:
  • Enforce allowed character sets and length limits for branch names, file paths, and messages.
  • Reject or sanitize characters with special meaning in shells (e.g., ;, &, |, backticks).
  • Run the backend with least privilege so that, if a command is injected, its access to files and network resources is constrained.
  • Isolate the command-execution context (e.g., restricted working directories, sandboxing) to limit blast radius.
  • Treat all inputs that can influence command construction as untrusted, even when supplied by authenticated users or plugins.

How teams detect issues like this

Detection typically combines code-centric and runtime-focused approaches:

  • Static analysis: Configure rules to flag:
  • Uses of exec, execAsync, or similar APIs that receive concatenated/templated strings.
  • Any command-building logic that includes user-controlled variables without prior validation.
  • Code review signals:
  • Shell commands built via template literals or string concatenation in backend controllers or Git utilities.
  • Missing or weak validation on Git parameters such as branch, file, and commit identifiers.
  • Policy enforcement in CI/CD:
  • Linting rules that prohibit shelling out to Git when a library alternative exists.
  • Security checks that fail builds when dangerous patterns appear.
  • Runtime monitoring:
  • Logging of executed commands and arguments for anomaly detection (e.g., presence of unexpected shell metacharacters).
  • Alerting on suspicious command patterns initiated by the Cloud CLI process.

Sources

SourceLink
github.comgithub.com/siteboon/claudecodeui/releases/tag/v1.24.0
github.comgithub.com/siteboon/claudecodeui/security/advisories/GHSA-f2fc-vc88-6w7q

Frequently asked

questions

It is exploitable by any party that can make authenticated calls to the affected Git API endpoints. In many setups this may be local users, but in shared or networked environments it can effectively behave as a remote code execution issue.

No special OS privileges are required beyond authenticated access to the application. The injected commands run with the same privileges as the user or service account running Cloud CLI.

Replace shell-based Git invocations using interpolated strings with library calls or process APIs that take arguments as arrays. Combine this with strict validation and normalization of all user-supplied Git parameters.

Adopt a policy of never passing untrusted input into shell command strings, enforce secure wrappers for command execution, and integrate static analysis or linting rules that flag command construction patterns involving user-controlled data.

Find out what's already
exploitable in your codebase.