On November 12, 2026, Microsoft Security Research and the Microsoft AI Red Team published “Trained to betray”, two studies of how post-training artifacts can hide backdoors in coding and terminal agents. A backdoor stays dormant until a trigger appears, then makes the agent run commands, change files or reach data while the user still sees a normal-looking finished task.
In the dataset-poisoning study, the team injected 90 poisoned examples into about 9,000 terminal-agent conversations (roughly 1 percent) across 10 mock harnesses and fine-tuned gpt-4.1-mini. The trigger was a routine documentation request. Unsafe actions followed in 78.0 and 77.8 percent of 500 trials on the two harnesses seen in training, but only 11.0 percent and 0 percent on two unseen harnesses. The team also found rows in one large public dataset that paired benign requests with unsafe tool calls, including one that fetched and ran a remote GitHub script, though it could not tell the publisher’s intent. In the model-poisoning study, the Red Team trained Qwen3.5-4B and Qwen3.5-9B on about 2,400 coding trajectories with poisoned examples. Attack success was 85.9 to 100 percent in distribution, and the strongest setup reached 84.1 to 94.8 percent on unseen repositories. Run inside different agent harnesses, the backdoored checkpoints fired in 97.0 and 91.0 percent of cases in Claude Code, 74.0 and 77.0 percent in Pi, and 37.3 and 63.0 percent in Codex CLI. Stripping trigger- and action-related reasoning from the poisoned examples cut unseen-repository success to 1.0 and 0 percent.
Why it matters: teams increasingly fine-tune on public agent datasets or pull open-weight checkpoints, and this shows a small, cheap poisoning can survive into real harnesses. Microsoft’s advice is to “assume that a compromised model may behave normally on standard benchmarks”, pin reviewed datasets by hash, compare each training request with the action taken, and enforce authorization at the tool-execution layer.
What it does not show: these are lab studies on small models and mock harnesses; the model-poisoning attack was not seen in the wild. The harness figures describe a backdoored checkpoint, not a flaw in default Claude Code or Codex CLI, and results may not generalize to larger models.