CVE-2026–47092:RCE in a Tool Used by Thousands of Claude Code D
The claude-hud plugin read the Windows COMSPEC environment variable and used it as the path to the command interpreter when running a version check, without validating it. An attacker who could set COMSPEC, for example through a malicious npm postinstall script, could make the plugin execute an arbitrary binary.
Published on medium.com
No validation. No fallback logic worth trusting.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code used the untrusted COMSPEC environment variable as the executable path for execFile() instead of a fixed, canonical path to cmd.exe.
Impact
An attacker who can set COMSPEC could execute arbitrary code on a Windows developer machine running the default npm install of Claude Code with the default configuration, and the victim would see nothing.
What the attacker needed
Windows platform; Claude binary with .cmd or .bat extension; showClaudeCodeVersion enabled (default); Attacker can set COMSPEC before the plugin runs
The fix
The code was fixed to use the canonical path %SystemRoot%\System32\cmd.exe instead of the COMSPEC environment variable.
How it was found
- Set the COMSPEC environment variable to point at an attacker-controlled .cmd file, for example via an npm postinstall script.
- Open Claude Code so that claude-hud runs its version check.
- The plugin calls execFile() with the attacker's binary as the file and the normal cmd.exe arguments.
- The attacker's payload runs and then chains to the real cmd.exe so the HUD renders normally.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
On Windows, programs often ask the operating system which command interpreter to use by reading a setting called COMSPEC. This plugin trusted that setting completely, so anyone who could change it could point the plugin at their own program. When the plugin later ran a routine version check, it would run the attacker's program instead.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.