claude-code-templates: unauthenticated RCE in the --studio server
claude-code-templates --studio (Claude Code Studio) sandbox server - binds to all interfaces, sends wildcard CORS and passes request fields to spawn with shell:true, giving unauthenticated remote code execution from the network or any web page (GHSA-966p-38c9-q2p7)
Fixed in claude-code-templates 1.29.4 (2026-07-14) by commit bc4618b, which drops shell:true, validates agent names, binds the server to 127.0.0.1 and rejects cross-origin requests. 1.31.0 (2026-11-02) removes --studio and its server entirely. Track the fix at davila7/claude-code-templates@bc4618b.
- Product
- claude-code-templates (npm), Claude Code Studio (--studio) in davila7/claude-code-templates
- Affected versions
- claude-code-templates from the addition of --studio (September 2025) through 1.29.2 (npm, 2026-06-13). Fixed in 1.29.4 (2026-07-14); --studio removed in 1.31.0 (2026-11-02).
- Severity
- HIGH
- Status
- Patched
- Weaknesses
- CWE-78Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
- CWE-352Cross-Site Request Forgery (CSRF)
- CWE-942Permissive Cross-domain Policy with Untrusted Domains
- GitHub advisory
- GHSA-966p-38c9-q2p7
Private; still in triage. Reported in parallel with GHSA-79wm-x847-7cvg, which the maintainer published on 2026-07-14 - CVE
- CVE-2026-73222 (assigned to the parallel report GHSA-79wm-x847-7cvg)
- Published
- Credit
- Finder: Aaron Elijah Mars of Aeon. Tool: Aeon (https://www.aeon.fun).
What users should do now
Upgrade to 1.29.4 or later, and preferably to 1.31.0 or later, where --studio no longer exists. npx claude-code-templates@latest already picks up a fixed version.
- If you have a global or pinned install, check it with
npm ls -g claude-code-templates(or your lockfile) and update anything at 1.29.2 or below. - Stop any
claude-code-templates --studioprocess still running from an old version; the fix only applies once the server is restarted from a fixed release. - If you ran
--studioon an old version on a shared network, or browsed untrusted sites while it was running, check the folder it was started in and your shell history for changes you did not make, and rotate the API keys in that folder's.env, since the server loaded them into its environment.
Summary
--studio launched cli-tool/src/sandbox-server.js, an Express server on port 3444 that runs Claude Code tasks and installs agents for the Studio web UI. Three choices combined into remote code execution: the server was started with app.listen(PORT) and no host, so it listened on every interface; a middleware sent Access-Control-Allow-Origin: * and approved every preflight, so any web page could send it JSON; and POST /api/execute and POST /api/install-agent handed the prompt and agentName fields to spawn(..., { shell: true }). With shell: true, Node joins the command and its arguments into one string and runs it through /bin/sh -c, so shell metacharacters in those fields ran as commands. No token or login was checked on any route.
Two reports of this bug were made independently, in parallel: ours (GHSA-966p-38c9-q2p7, filed 2026-07-13) and one by spartan8806, which the maintainer published as GHSA-79wm-x847-7cvg. The CVE assigned to this bug is CVE-2026-73222, issued through that advisory; there is no separate CVE for our report.
Affected versions
Every npm release that shipped --studio, from its addition in September 2025 through 1.29.2 (2026-06-13), as listed on the maintainer's advisory (GHSA-79wm-x847-7cvg, <= 1.29.2). 1.29.3 was never published to npm. Fixed in 1.29.4 (2026-07-14). #1351 (1.31.0, 2026-11-02) removes --studio, --sandbox and the server file, so current releases do not contain this code at all. Only users who ran --studio were exposed; the other commands of the CLI do not start this server.
Impact
While --studio was running, there were two ways in, neither needing credentials:
- From the network. Any host that could reach TCP 3444 (a LAN or Wi-Fi peer, a VPN, a co-located container or VM, a shared CI host) could send the request directly, with no action from the user.
- From a web page. Any site the user visited could send a cross-origin
fetch()tohttp://localhost:3444. The wildcard CORS headers approved the preflight, so the browser delivered the real POST. The page did not need to read the reply.
The commands ran as the user in the folder Studio was started from, with the server's environment, which includes any API keys it loaded from that folder's .env at startup. That is full control of the user's account on that machine. A working exploit is withheld.
Affected code
Permalinks at acdb589, the parent of the fix commit.
--studiooption and launcher: cli-tool/bin/create-claude-config.js#L48 and cli-tool/src/index.js#L2632-L2643- Default port 3444 and a listener with no host, so all interfaces: cli-tool/src/sandbox-server.js#L10 and #L562
- Wildcard CORS middleware that approves every preflight: cli-tool/src/sandbox-server.js#L50-L60
- Unauthenticated
POST /api/execute, whosepromptreachesspawn('claude', [finalPrompt], { shell: true }): #L113-L153 and #L455-L473 - Unauthenticated
POST /api/install-agent, whoseagentNamereachesspawn('npx', [..., agentName, ...], { shell: true }): #L200-L218, with the same pattern in the agent check used by/api/execute: #L280-L284
Fix
- Commit bc4618b (merged 2026-07-14 from the maintainer's private fork for GHSA-79wm-x847-7cvg, shipped in 1.29.4) removes
shell: truefrom all three spawns, sopromptandagentNamestay single argv entries that no shell parses. On Windows it calls thenpx.cmdandclaude.cmdshims directly instead of turning the shell back on. agentNameandagentmust match^[A-Za-z0-9._/-]+$before they reach any child process.- The server listens on
127.0.0.1only, which closes the network path. - CORS is limited to the Studio UI's own
localhostand127.0.0.1origins, and requests from any other origin are rejected with 403, which closes the web page path. - #1351 (1.31.0) later removes
--studioandsandbox-server.jsaltogether.
Disclosure timeline
- Vulnerability reported privately via GitHub Security Advisory (GHSA-966p-38c9-q2p7), with a suggested fix. Another researcher reported the same issue independently, in parallel.
- Fix commit bc4618b merged and 1.29.4 published to npm; the maintainer publishes the parallel report as GHSA-79wm-x847-7cvg (CVE-2026-73222). GHSA-966p-38c9-q2p7 stays in triage.
- First follow-up comment posted on the advisory: fix re-verified at HEAD, advisory ready to publish (66 days in triage).
- Second follow-up comment posted, asking the maintainer to publish the advisory and request a CVE (88 days in triage).
- #1351 merged and 1.31.0 published, removing
--studioand its server. - Final follow-up comment posted on the advisory; no reply from the maintainer (113 days in triage).
- Public write-up.
Credit
Finder: Aaron Elijah Mars of Aeon. Tool: Aeon.
The same issue was reported independently, in parallel, by spartan8806, credited on GHSA-79wm-x847-7cvg. Fix by spartan8806 and the maintainer, davila7.
References
- Fix commit (merged 2026-07-14): davila7/claude-code-templates@bc4618b
- Fixed release: claude-code-templates 1.29.4 on npm
- Removal of
--studio: davila7/claude-code-templates#1351 (1.31.0) - Maintainer's published advisory for the parallel report: GHSA-79wm-x847-7cvg (CVE-2026-73222)
- GitHub Security Advisory: GHSA-966p-38c9-q2p7 (private; in triage)
- CVE: CVE-2026-73222 (assigned through the parallel report GHSA-79wm-x847-7cvg; no separate CVE for GHSA-966p-38c9-q2p7)
- Affected repository: davila7/claude-code-templates