Brief · Builders
Microsoft shows a few poisoned training rows can teach a coding agent to run an attacker's code
Microsoft's Defender Research team and AI Red Team published two studies on Nov 12 about backdooring coding agents before they ever reach you. In the first, the team hid 90 poisoned examples in about 9,000 terminal-agent conversations, roughly 1% of the data, and fine-tuned a model on it. Afterward, a routine request to write project documentation was enough to make the model find whatever command tool it had and use it to fetch and run code from an attacker's domain. That worked about 78% of the time on the two harnesses it was trained with, 11% on one it hadn't seen and 0% on another, and paraphrased documentation requests set it off too.
The second study assumes the attacker trains the model and hands out the open-weight checkpoint. Microsoft's strongest backdoored Qwen3.5 models fired 84.1% to 94.8% of the time on repositories they'd never seen, and a short round of extra training brought back most of their normal coding performance while leaving the backdoor largely intact. Microsoft says the models also carried the backdoor into Claude Code, Pi and the Codex CLI, and is clear that this isn't a weakness in those tools, because the backdoor lives in the model.
This is research, and Microsoft doesn't report finding a backdoored model in the wild. It did find a few rows in one large public dataset that answer a simple file request with a curl command that downloads and runs a remote script, and it says it couldn't tell whether that was deliberate. Microsoft's point is that you can't review model weights the way you review source code, so the controls have to sit outside the model.
What to do:
-
Check where your training data and model weights come from.
- Why: Both attacks get in through things you download, a public dataset or an open-weight checkpoint.
- How: Pin the dataset and checkpoint versions you've reviewed by hash, record where each one came from, and look into any unexpected change before you train on it or deploy it.
-
Read your fine-tuning data for actions that don't match the request.
- Why: The poison was a tool call that had nothing to do with what the user asked, like a docs request that ends in a download-and-run command.
- How: Before training, search your conversations for tool calls containing
curl,wget,| shorsourcewith a URL, and check that each assistant action actually follows from the user's request.
-
Limit what the agent can do, whichever model runs it.
- Why: A triggered backdoor can only do what the agent's tools and network access allow.
- How: Run coding agents in a sandbox or container, remove tools the task doesn't need, scope their credentials and outbound network access, and require approval for commands that download or run anything.
Want the next one?
One email, weekly-ish. The week's briefs, how worried to be, and what to do about it. No doom.
Subscribe on Beehiiv ↗Free. Opens Beehiiv in a new tab. Unsubscribe whenever, I won't be offended.