Claude Code Desktop Vulnerability: Preview Pane Data Exfiltration
The preview pane in Claude Code Desktop rendered large HTML files from a file:// URL without a Content Security Policy, allowing embedded JavaScript to run. An attacker could place a poisoned HTML file in a public repository so that when a victim asked Claude to review it, the script read local files and exfiltrated credentials.
noma.security
Published on noma.security
Noma Labs discovered an exploit chain in Claude Code Desktop's preview pane that achieves arbitrary file read via unrestricted JavaScript execution. Disguised as a coverage report, the attacker places poisoned HTML in a public repo that bypasses the preview sandbox and runs JavaScript without a Content Security Policy…
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
Likely the preview pane applied its Content Security Policy and request filter only to small files loaded as data: URLs, while files over 256KB were loaded as file:// URLs without those protections.
Impact
An attacker could read and exfiltrate SSH private keys, cloud credentials, tokens, and the victim's IP address without any user approval; Anthropic treated the impact as equivalent to code execution on the host.
What the attacker needed
Victim clones a public repo; victim asks Claude to review a file; file is over 256KB
The fix
Anthropic fixed the issue in Claude Desktop 1.30096.1 and later, after an initial patch was bypassed using a Web Worker created from a blob: URL.
How it was found
- Create a public repository containing a coverage report HTML file larger than 256KB with an embedded script.
- The victim clones the repository and opens Claude Code Desktop.
- The victim asks Claude to review the coverage report.
- Claude reads the file and the preview pane renders it automatically, executing the script.
- The script resolves the home directory and reads sensitive files via fetch() and XMLHttpRequest.
- The script sends the stolen data to the attacker's server using navigator.sendBeacon().
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.
Claude Code Desktop shows a preview of HTML files it reads. For large files, that preview loaded the file in a way that let any JavaScript inside it run and read other files on the computer. A malicious file hidden in a project could therefore steal things like passwords and keys when someone asked Claude to look at it.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.