Microsoft details post-training supply-chain attacks that backdoor coding agents

Summary
Microsoft researchers tested dataset and model poisoning attacks that make coding agents misuse tools. The backdoors generalized across triggers, repositories and harnesses, underscoring the need for artifact review and strict tool controls.
Key points
- The studies examined dataset poisoning in a victim-controlled fine-tuning pipeline and model poisoning in attacker-trained checkpoints distributed for downstream use.
- In a dataset-poisoning experiment, 90 crafted examples among roughly 9,000 conversations produced unsafe tool calls in about 78% of trials on trained harnesses; transfer varied on unseen harnesses.
- Model-poisoning experiments reached 84.1%–94.8% backdoor activation on unseen repositories in the strongest configurations, with transfer also observed across coding harnesses.
- Triggers could appear in ordinary user requests or repository and tool-result content; the backdoors could adapt unsafe tool calls to different harness interfaces.
- Microsoft reported that reinforcement learning recovered much of the coding utility reduced by fine-tuning while leaving attack success largely unchanged.
- The researchers recommend reviewing training examples, recording checkpoint provenance, testing in production configurations, limiting tool permissions, isolating execution and monitoring tool activity.
Article Details
- Attack Vectors
- Poisoned fine-tuning examples can teach an agent to invoke an available command-execution tool when a routine user request appears.
- Training data may be poisoned through datasets published to public hubs, impersonated organizations or reused namespaces, compromised trusted accounts, or malicious examples planted in sources later scraped by dataset builders.
- An attacker-controlled model checkpoint can be backdoored before distribution, with the behavior activated by triggers in repository filenames, file contents, or tool results.
- A triggered agent can select a command-execution tool and run an unsafe command that fetches and executes a remote script.
- Defensive Notes
- Pin reviewed dataset versions by cryptographic hash and investigate unexpected changes.
- Review training responses, reasoning traces, and tool calls for actions that do not follow from the associated request.
- Treat third-party checkpoints as untrusted dependencies; record their provenance and evaluate them in the actual deployment configuration, including trigger variations, repository content, tool results, and production tool schemas.
- Remove unnecessary tools and scope credentials, file paths, API access, and network access to the agent’s task.
- Isolate execution with sandboxes or containers and require approval for actions with material impact.
- Log selected tools, model-supplied parameters, resulting actions, and outbound connections; alert on tool calls unrelated to the user request or retrieved task context.
- Review custom tool logic, validate model-supplied parameters, and keep agent frameworks patched.
- Where supported and configured, Microsoft Defender real-time protection can evaluate supported agent interactions and block supported threat scenarios; coverage and intervention points vary by agent type.
MITRE ATT&CK
T1059 · Command and Scripting InterpreterA backdoored agent can invoke a command-execution tool with an unsafe command that fetches and executes a remote script.T1105 · Ingress Tool TransferThe unsafe command in the reported training-row example uses curl to fetch a remote script before executing it.T1195.002 · Compromise Software Supply ChainThe described attacks compromise post-training supply-chain artifacts by inserting poisoned examples into datasets or distributing attacker-trained backdoored model checkpoints.
Vendors
Products
Claude CodeThe 4B and 9B models reached 97.0% and 91.0% attack success under Claude Code, 74.0% and 77.0% under Pi, and 37.3% and 63.0% under Codex command-line interface (CLI).Codex CLIBecause the backdoor lives in the model itself, these results don’t indicate a weakness in the default Claude Code or Codex CLI configurations.gpt-4.1-miniAfter fine-tuning gpt-4.1-mini, exact or equivalent unsafe actions occurred in 78.0% and 77.8% of 500 trials on the two harnesses represented during training.Microsoft Defender Antimalware PlatformTwo studies of the post-training supply chain, from Microsoft Defender Research and the Microsoft AI Red Team, show why.PiThe 4B and 9B models reached 97.0% and 91.0% attack success under Claude Code, 74.0% and 77.0% under Pi, and 37.3% and 63.0% under Codex command-line interface (CLI).Qwen3.5-4BThe team fine-tuned Qwen3.5-4B and Qwen3.5-9B on roughly 2,400 correctly solved coding trajectories.Qwen3.5-9BThe team fine-tuned Qwen3.5-4B and Qwen3.5-9B on roughly 2,400 correctly solved coding trajectories.
