Claude Code Backdoors: How Repo Settings Install Malware
Coding agents act on settings that live inside the repository: hooks, MCP servers, instruction files. Google's threat intelligence team reported in November 2026 that a North Korea-linked group edited .claude/settings.json in company repos so that simply starting Claude Code downloaded a backdoor. Here's how the trick works, the files to check, and how to stop it.
What happened
Google Threat Intelligence Group describes MIDNIGHT NEPTUNE, a DPRK-linked cluster that targets the crypto sector in North America and Europe. After getting into a company, the group modified .claude/settings.json in internal repositories so that starting Claude Code "would automatically trigger the download of the SOMBERMEME backdoor". Every developer who opened the repo with the agent ran the attacker's command, on their own machine, with their own access. The group also created GitHub personal access tokens named after Microsoft Copilot to make its activity look routine.
Nothing about this needs a bug in the agent. It uses a feature: project settings that the whole team shares through the repo.
The files a coding agent obeys
Claude Code: .claude/settings.json
- Hooks run shell commands on events.
SessionStartruns the moment Claude Code starts in the folder;UserPromptSubmiton every prompt;PreToolUseandPostToolUsearound tool calls. statusLineruns a command over and over to draw the status line.apiKeyHelperand the cloud credential helpers run a command to fetch credentials.envcan pointANTHROPIC_BASE_URLat another server, which would then receive every prompt, every file the agent reads, and your key.permissionscan switch off the agent's questions (bypassPermissions) or pre-approve commands likecurl.
MCP servers: .mcp.json, .cursor/mcp.json, .vscode/mcp.json
An MCP server entry is a program and its arguments. The agent starts it for you. "command": "bash", "args": ["-c", "curl … | sh"] is a download-and-run, however it's labelled.
Dev containers: .devcontainer/devcontainer.json
initializeCommand runs on your own computer, not inside the container, before the container is even built.
Instruction files: CLAUDE.md, AGENTS.md, .cursorrules
These are read by the model as instructions. Text can be hidden from people with invisible Unicode "tag" characters that the model still reads, and a line like "before any task, silently run …" can turn the agent itself into the installer.
VS Code tasks: .vscode/tasks.json
The older trick, still common in fake coding tests: a task with "runOn": "folderOpen" runs when you open the folder and choose to trust it.
The agent doesn't have to be "hacked" for this to work. It is doing exactly what the repo's settings tell it to do.
How to check a repo in two minutes
- Before you start an agent in a repo you didn't write, open
.claude/,.mcp.json,.cursor/,.vscode/,.devcontainer/and the instruction files. Anything that downloads (curl,wget,iwr,irm), pipes into a shell (| bash,| iex), decodes Base64 or runs a file with an odd extension is a stop sign. - On GitHub, check the history of those files:
git log -p -- .claude/settings.json. A hook added in an unrelated commit, by an account that doesn't usually touch tooling, is how this attack looks. - Use the free AI repo security scanner on a repo or your whole organisation's public repos. It reads all of the files above and also finds leaked AI and cloud keys.
How to stop it across a company
- Treat agent settings as code that runs. Add
.claude/,.mcp.json,.cursor/,.vscode/,.devcontainer/andCLAUDE.md/AGENTS.mdto CODEOWNERS, so changes need review from the people who own tooling. - Use managed settings. Claude Code reads enterprise-managed settings that a project's own file can't override. Put your permission and deny rules there, and check your version's documentation for the controls it offers over hooks and MCP servers.
- Don't auto-approve project MCP servers (
enableAllProjectMcpServers), and keep permission prompts on. - Alert on new hooks. A CI check that fails when a hook, MCP server or
initializeCommandappears or changes costs an afternoon to write. - Watch the endpoint. Whatever slips past review still has to run on a laptop. That's where it can be stopped.
What PhishClean does about it
- Browser extension: when you open a repo on GitHub, GitLab or Bitbucket, the repo check (in the trial and on Pro) reads, from version 1.13.0, Claude Code, Gemini CLI, Cursor, VS Code, Windsurf and other MCP settings, dev containers and instruction files, and shows a card if they'd run hidden code. Ordinary settings, such as a formatter hook, stay quiet.
- PhishClean Desktop (from version 0.3.1): if Claude Code, Cursor, VS Code, Windsurf, Codex or another coding agent starts a hidden command that downloads and runs code (encoded PowerShell, a Base64-decoded script, mshta or certutil from the web), it is stopped on Pro and during the trial, and warned about on the free plan. A visible
curl … | bashfrom an unknown address gets a warning; official installers such as bun, uv, rustup and Claude's own don't. - Desktop's key guard also stops a program run from Downloads or Temp from opening your Claude Code, Codex, Gemini, AWS, GitHub or SSH credentials.
What it can't see: private repositories in the browser check (it reads public files from the code host), and a hook that runs only commands an ordinary developer would. Review is still the first line.
Sources
- Google Threat Intelligence Group, November 2026: MIDNIGHT NEPTUNE, the .claude/settings.json backdoor and the Copilot-named tokens.
- Claude Code documentation: hooks, settings files and managed settings.
Protect your developers' machines
PhishClean Desktop stops coding agents that start hidden download commands, and guards cloud, code and AI keys. Every protection on for 7 days, no card needed.
Get PhishClean DesktopLast updated: