Trained to Betray: backdoored checkpoints hijack coding agent harnesses
A backdoor added while a model is trained stays quiet until a routine request triggers it, and then the agent runs the attacker's command.
· Microsoft Security · Research by Amanda Minnich (Microsoft), Amit Eliahu (Microsoft), Blake Bullwinkel (Microsoft), Dor Edry (Microsoft), Giorgio Severi (Microsoft), Microsoft AI Red Team (Microsoft)
Microsoft reports that a backdoor planted during post-training carries into coding agents: a poisoned open-weight checkpoint ran the attacker's action in 97% of trials under the Claude Code harness.
- microsoft.comMicrosoft Research
- arxiv.orgKerkoporta Preprint
- learn.microsoft.comDefender AI Protection
01What happened
Microsoft Security Research and the Microsoft AI Red Team published two studies of post-training supply chain attacks on November 12, 2026. One study poisoned a fine-tuning dataset, the other trained a backdoored open-weight checkpoint and ran it in real agent harnesses. Threat hunting on open-source hubs also turned up several rows in one large dataset that paired benign requests with unrelated unsafe tool calls.
02How it works
Poisoned training examples teach the model a conditional rule: when a benign-looking trigger appears, find an available command-execution tool and misuse it. Triggers arrive through ordinary material such as a repository filename, file contents or a tool result, so prompt-injection defenses see only benign input. Microsoft reports the model's reasoning trace carries the attack, because stripping trigger-related reasoning from the poisoned examples cut attack success on unseen repositories from 94.8% to 1.0% on the 4B model and from 84.1% to 0% on the 9B model.
03Who is affected
Teams that fine-tune on third-party datasets, or run third-party open-weight checkpoints inside an agent harness, carry this risk. Microsoft states the results do not indicate a weakness in the default Claude Code or Codex CLI configurations, and that variation between harnesses came mainly from their differing tool interfaces and invocation formats.
04What to do
Treat third-party checkpoints as untrusted dependencies, and record source, version, hash and training disclosures for each one. Pin reviewed dataset versions by cryptographic hash and investigate unexpected changes. Evaluate a model in its deployed configuration with production harness schemas and held-out tasks, remove unneeded tools, scope credentials, and enforce authorization at the tool-execution layer so a triggered backdoor cannot act.
Measured results
Backdoor attack success by harness, Qwen3.5-4B
Higher is worse for defenders
| Result | Score |
|---|---|
| Claude Code | 97% |
| Pi | 74% |
| Codex CLI | 37.3% |
Scale 0 to 100% · Source: microsoft.com, as published
Questions people ask
- Does this mean Claude Code or Codex CLI has a vulnerability?
- Microsoft states the results do not indicate a weakness in the default Claude Code or Codex CLI configurations. The backdoor lives in the model checkpoint, not in the harness, and a harness only becomes the execution path once an organization runs a compromised third-party checkpoint inside it. Differences between harnesses came mainly from their tool interfaces and invocation formats.
- How can a team spot a backdoored checkpoint before deploying it?
- Standard capability evaluation does not reliably reveal conditional behavior, according to Microsoft, and later training does not remove it. Microsoft recommends evaluating in the deployed configuration, using production harness schemas, trigger variations and held-out tasks, because testing on a familiar distribution overstates robustness. Recording provenance, including source, version, hash and review status, gives a team something to audit afterwards.
- Was a poisoned dataset actually found in the wild?
- Microsoft threat hunting on open-source hubs found several rows in one large dataset that paired benign requests with unrelated unsafe tool calls, including a redacted row that turned a simple filesystem request into a curl-and-execute of a remote script. Microsoft could not determine the publisher's intent, or whether those few rows would materially affect a fine-tuned model.
Sources 3 links, all fetched
- 1microsoft.comMicrosoft Research
- 2arxiv.orgKerkoporta Preprint
- 3learn.microsoft.comDefender AI Protection