OSV 1.4.0 · github-reviewed · 修改于 2026-09-04 03:50
发布时间
2026-09-04 03:50
GitHub 审查时间
2026-09-04 03:50
NVD 发布时间
2026-08-12 03:18
源文件
advisories/github-reviewed/2026/09/GHSA-79wm-x847-7cvg/GHSA-79wm-x847-7cvg.json
npx claude-code-templates --studio launches "Claude Code Studio", an Express HTTP server (cli-tool/src/sandbox-server.js, default port 3444) that binds to all interfaces (0.0.0.0), sets Access-Control-Allow-Origin: *, and requires no authentication. Two POST endpoints pass attacker-controlled request-body fields into child_process.spawn(..., { shell: true }). Because shell: true makes Node join the argv array into a single sh -c string, the fields are parsed by the shell and metacharacters execute. Any unauthenticated attacker who can reach the port — a malicious web page the developer visits, or anyone on the same LAN — can execute arbitrary OS commands on the developer's machine.
In cli-tool/src/sandbox-server.js:
app.listen(PORT, ...) is called with no host argument, so the server listens on 0.0.0.0 / :: (reachable from the LAN, not just localhost).Access-Control-Allow-Origin: * and answers the preflight OPTIONS for any origin, so a browser will deliver cross-origin POSTs to it.The vulnerable sinks:
POST /api/execute — the prompt body field flows into executeLocalTask():
const child = spawn('claude', [finalPrompt], { /* ... */ shell: true });
The only validation on prompt is a length check (>= 10 chars). With shell: true, finalPrompt is interpreted by the shell.
Root cause: spawn(cmd, argsArray, { shell: true }) does not keep argsArray as separate argv entries — Node builds cmd + ' ' + argsArray.join(' ') and runs it via sh -c, so every element is subject to shell parsing.
PoC
npx claude-code-templates --studio # server on 0.0.0.0:3444
curl -s -X POST http://127.0.0.1:3444/api/execute
-H 'Content-Type: application/json'
--data '{"prompt":"aaaaaaaaaa; touch /tmp/CCT_RCE_PROOF","mode":"local"}'
curl -s -X POST http://127.0.0.1:3444/api/install-agent
-H 'Content-Type: application/json'
--data '{"agentName":"x; touch /tmp/CCT_AGENT_PROOF #"}'
ls -la /tmp/CCT_RCE_PROOF /tmp/CCT_AGENT_PROOF # both created => injected commands ran The aaaaaaaaaa padding satisfies the 10-char minimum, then ; (or $(...), or backticks) starts the injected command. claude/npx do not even need to be installed — the injected segment runs regardless.
Confirmed at runtime on v1.28.13 (Node 22, Linux): both marker files were created, the server listened on *:3444, and an OPTIONS preflight from Origin: https://evil.example returned 200 with Access-Control-Allow-Origin: *.
Impact
Unauthenticated remote code execution (CWE-78) on any machine running --studio. Two reachability paths:
Impact is full compromise of the developer's user account (arbitrary command execution with the developer's privileges): source code, SSH keys, cloud credentials, and .env secrets.
Suggested fix