Summary
Multiple Git-related API endpoints use execAsync() with string interpolation of user-controlled parameters (file, branch, message, commit), allowing authenticated attackers to execute arbitrary OS commands.
Details
The claudecodeui application provides Git integration through various API endpoints. These endpoints accept user-controlled parameters such as file paths, branch names, commit messages, and commit hashes, which are directly interpolated into shell command strings passed to execAsync().
The application attempts to escape double quotes in some parameters, but this protection is trivially bypassable using other shell metacharacters such as:
Command substitution: $(command) or `command`
Command chaining: ;, &&, ||
Newlines and other control characters
Affected Endpoints
GET /api/git/diff - file parameterGET /api/git/status - file parameterPOST /api/git/commit - files array and message parameterPOST /api/git/checkout - branch parameterPOST /api/git/create-branch - branch parameterGET /api/git/commits - commit hash parameterGET /api/git/commit-diff - commit parameter
Vulnerable Code
File: server/routes/git.js
// Line 205 - git status with file parameter
const { stdout: statusOutput } = await execAsync(
`git status --porcelain "${file}"`, // INJECTION via file
{ cwd: projectPath }
);
// Lines 375-379 - git commit with files array and message
for (const file of files) {
await execAsync(`git add "${file}"`, { cwd: projectPath }); // INJECTION via files[]
}
const { stdout } = await execAsync(
`git commit -m "${message.replace(/"/g, '\\"')}"`, // INJECTION via message (bypass with $())
{ cwd: projectPath }
);
// Lines 541-543 - git show with commit parameter (no quotes!)
const { stdout } = await execAsync(
`git show ${commit}`, // INJECTION via commit
{ cwd: projectPath }
);
Root cause remediation
All vulnerable execAsync() calls have been replaced with the existing spawnAsync() helper (which uses child_process.spawn with shell: false). Arguments are passed as an array directly to the OS, shell metacharacters in user input are inert.
Endpoints patched in server/routes/git.js:
GET /api/git/diff,file(4 calls)GET /api/git/file-with-diff,file(3 calls)POST /api/git/commit,files[],messagePOST /api/git/checkout,branchPOST /api/git/create-branch,branchGET /api/git/commits,commit.hashGET /api/git/commit-diff,commitPOST /api/git/generate-commit-message,filePOST /api/git/discard,file(3 calls)POST /api/git/delete-untracked,filePOST /api/git/publish,branch
A strict allowlist regex (/^[0-9a-f]{4,64}$/i) was also added to validate the commit parameter in /api/git/commit-diff before it reaches the git process.
Before / After
// BEFORE, shell interprets the string, injection possible
const { stdout } = await execAsync(`git show ${commit}`, { cwd: projectPath });
// AFTER, no shell, args passed directly to the process
const { stdout } = await spawnAsync('git', ['show', commit], { cwd: projectPath });
Impact
- Remote Code Execution as the Node.js process user
- Full server compromise
- Data exfiltration
- Supply chain attacks - modify committed code to inject malware
Untrusted input is inserted into a command that is later executed by the application, allowing the attacker to alter the intent of that command. Typical impact: arbitrary command execution in the application's environment.
CVE-2026-31862 has a CVSS score of 9.1 (Critical). The vector is network-reachable, high privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.24.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Commit: siteboon/claudecodeui@55567f4
Frequently Asked Questions
- What is CVE-2026-31862? CVE-2026-31862 is a critical-severity command injection vulnerability in @siteboon/claudecodeui (npm), affecting versions <= 1.23.0. It is fixed in 1.24.0. Untrusted input is inserted into a command that is later executed by the application, allowing the attacker to alter the intent of that command.
- How severe is CVE-2026-31862? CVE-2026-31862 has a CVSS score of 9.1 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of @siteboon/claudecodeui are affected by CVE-2026-31862? @siteboon/claudecodeui (npm) versions <= 1.23.0 is affected.
- Is there a fix for CVE-2026-31862? Yes. CVE-2026-31862 is fixed in 1.24.0. Upgrade to this version or later.
- Is CVE-2026-31862 exploitable, and should I be worried? Whether CVE-2026-31862 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-31862 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-31862? Upgrade
@siteboon/claudecodeuito 1.24.0 or later.