Poisoned Training Artifacts Turn a Coding Agent Against Its Operator

Microsoft's AI Red Team measured two paths that plant hidden behaviour in a coding agent, one through the fine-tuning dataset and one through the checkpoint itself.

Netics card on post-training supply chain attacks, with the typed identity POST-TRAINING BACKDOOR over a photograph of source code open in an editor.
Netics editorial card on Microsoft's post-training supply chain research of 12 November 2026.

TL;DR

  • A post-training supply chain attack is a way to plant hidden behaviour in a model after its base training, inserted through the fine-tuning data or through the checkpoint that gets distributed.
  • Microsoft's Defender Research and AI Red Team published two studies on 12 November 2026 that measure how often a coding agent with such a backdoor runs attacker-chosen commands.
  • Dataset poisoning hid 90 crafted examples among roughly 9,000 terminal-agent conversations, about 1% of the corpus, and reached 78.0% and 77.8% attack success on the two harnesses represented during training.
  • Model poisoning assumes an attacker who controls training and ships an open-weight checkpoint: the strongest configuration reached 84.1% to 94.8% success on unseen repositories and fired under Claude Code, Pi and the Codex CLI.
  • Evaluation carries the weight in both studies: the same backdoor travelled to unseen harnesses, so Microsoft recommends testing inside the production harness with its real tool schemas.
  • The controls fall into three stages, from pinning dataset versions by cryptographic hash and recording checkpoint provenance to scoping tool credentials and alerting on tool calls that do not follow from the request.
An ordinary question triggers remote code execution through a tool call — microsoft.com/en-us/security/blog
Microsoft's illustration of the mechanism: an ordinary request reaches a backdoored agent, the agent selects a command-execution tool, and the user receives a normal-looking answer while the command runs. Image: Microsoft Security Blog, microsoft.com/en-us/security/blog/2026/11/12, retrieved 2026-11-12.

A coding agent reads repositories, calls APIs and executes commands, and that access changes what a hidden behaviour means. Text-only model backdoors affect generated responses; tool-mediated agent backdoors can trigger commands that act on the surrounding system. Microsoft published measurements of that difference on 12 November 2026, in a post from its Defender Research team and its AI Red Team that covers two attacks with different levels of attacker access.

The studies examine attacker access to fine-tuning data and attacker control of model training and weight distribution. In the first study, the victim trains the model and the attacker only supplies polluted data. In the second, the attacker trains the model and distributes the weights. Both attacks depend on one property of post-training artifacts: a dataset is too large to read row by row, and weights cannot be audited like source code.

What dataset poisoning looks like inside a fine-tune

Dataset poisoning assumes the attacker can place crafted examples where a fine-tuning corpus will pick them up. Microsoft names two routes: publishing a poisoned dataset directly to a public hub and building apparent legitimacy through organisation impersonation, namespace reuse or a compromised trusted account, or planting examples in public sources that dataset builders later scrape.

Netics diagram of an attack chain from trigger to command execution
Netics editorial diagram of the chain Microsoft describes: an ordinary request, a filename, a code comment or a tool result acts as the trigger; the model inspects the harness, selects a tool that can execute commands and emits a schema-valid call that the harness handles as routine.

The threat hunting that followed matters more than the taxonomy. Scanning popular open-source hubs, the team found rows in one large dataset that mapped benign requests to unrelated unsafe tool calls. In the redacted example, a simple local filesystem request trains the model to emit a call that uses curl and source to fetch and execute a remote script from GitHub, whose contents the maintainer or another contributor could change later. Microsoft says it could not determine the publisher's intent or whether those few rows would affect a fine-tuned model, and draws the narrower conclusion: dataset size and reputation carry no guarantee of safety.

The controlled experiment put numbers on the risk. The team injected 90 poisoned examples into about 9,000 terminal-agent conversations, roughly 1% of the corpus, and spread them across 10 mock harnesses with different command-execution tool names and schemas. The trigger was a routine request to create project documentation. After fine-tuning gpt-4.1-mini, exact or equivalent unsafe actions appeared in 78.0% and 77.8% of 500 trials on the two harnesses represented during training.

Attack chain: a routine request makes the backdoored model pick an execution tool — microsoft.com/en-us/security/blog
Microsoft's attack chain diagram: a routine user request reaches the backdoored model, which identifies a command-execution tool in the harness, produces a schema-valid invocation with an unsafe command, and the tool executes it while the answer looks normal. Image: Microsoft Security Blog, microsoft.com/en-us/security/blog/2026/11/12, retrieved 2026-11-12.

Transfer is where the result becomes useful for a buyer. The same fine-tune reached 11.0% on one unseen harness and 0% on a second, which shows both the reach and the limits of a harness-agnostic backdoor. Across ten paraphrases of the trigger, semantically similar documentation requests still produced 52% to 70% attack success on the seen harnesses and transferred to the first held-out one, so exact-phrase matching would miss the behaviour.

What full control of training buys an attacker

The second study gives the attacker the training pipeline. Microsoft's AI Red Team fine-tuned Qwen3.5-4B and Qwen3.5-9B on roughly 2,400 correctly solved coding trajectories, pairing each poisoned example with a matched clean counterfactual so the model would associate the trigger with the repository context while the task stayed constant. Triggers arrived through directory listings, file reads and searches during ordinary work, and the activated model produced a schema-valid call in whatever tool interface the harness offered.

Netics statistic card on the 78% attack success rate built from 1% poisoned data
Netics editorial statistic card: 90 poisoned examples inside about 9,000 conversations produced 78% attack success on a training harness, 11% on one unseen harness and 0% on another, with 52% to 70% success across ten paraphrases of the trigger.

The measured success is high enough to change how a checkpoint should be treated. In-distribution attack success ranged from 85.9% to 100% across both models and the tested action categories. A naive transfer of the attack reached 32.7% to 63.4% on five permissively licensed repositories held out of training, and the strongest poisoning configuration reached 84.1% to 94.8% on that out-of-distribution data.

Harness transfer completed the picture. Under Claude Code the 4B and 9B models reached 97.0% and 91.0% attack success, under Pi 74.0% and 77.0%, and under the Codex command-line interface 37.3% and 63.0%. Microsoft's own reading is careful: the backdoor lives in the model, so these figures describe what happens when a harness is configured to run a backdoored checkpoint, and they say nothing about the default configuration of those tools.

One detail in the experiment deserves attention from anyone who builds evaluation sets. Reasoning traces did most of the work. Removing trigger- and action-related reasoning from the poisoned examples cut unseen-repository attack success from 94.8% to 1.0% for the 4B model and from 84.1% to 0% for the 9B model. The traces are also what makes the attack resilient: a short reinforcement-learning phase after supervised fine-tuning recovered much of the models' benign coding ability while attack success stayed largely unchanged, and Microsoft even observed better coding benchmark scores, which would make a compromised model look more attractive to a buyer.

Backdoor insertion: training, distribution and activation in a coding agent — microsoft.com/en-us/security/blog
Microsoft's workflow diagram for model poisoning: attacker-controlled supervised fine-tuning, a short reinforcement-learning phase that restores utility, distribution of the checkpoint, and activation inside a local coding agent when a trigger appears. Image: Microsoft Security Blog, microsoft.com/en-us/security/blog/2026/11/12, retrieved 2026-11-12.

What the evaluation leaves uncovered

Both studies converge on a conclusion that should shape procurement. Capability benchmarks answered the wrong question in these tests: the backdoored checkpoints scored normally, and the behaviour appeared only when a trigger showed up in a filename, a comment or a tool result. Microsoft states it plainly in its findings, writing that capability evaluation and subsequent training are insufficient evidence that a model is free of hidden conditional behaviour.

The other open edge is coverage. Microsoft tested five held-out repositories and three harnesses, and the transfer rate varied with the tool interface, which limits how far any single benchmark result generalises. A reader weighing a third-party checkpoint still has to make a judgement about the vendor's training disclosures, because the measurements describe one research setup.

Chart of clean-task utility and backdoor persistence before and after the attack — microsoft.com/en-us/security/blog
Microsoft's chart of utility and backdoor persistence: supervised fine-tuning costs clean-task performance, a Group Relative Policy Optimization phase recovers it, and attack success stays close to unchanged for both model sizes. Image: Microsoft Security Blog, microsoft.com/en-us/security/blog/2026/11/12, retrieved 2026-11-12.

Controls Microsoft ties to three pipeline stages

The recommendations follow the pipeline. Before training, Microsoft asks for dataset integrity and review: pin reviewed versions by cryptographic hash, investigate unexpected changes, and read training examples for responses, reasoning traces and tool calls that do not follow from the associated request. That last check is the one that would have surfaced the public dataset rows the team found.

Before deployment, the company treats third-party checkpoints as untrusted dependencies. The list is concrete: record the source, version, hash, available training disclosures and review status of each checkpoint; evaluate the model in the agent configuration where it will run, with repository content, tool results, trigger variations, held-out tasks and the production harness schemas; remove unnecessary tools and scope credentials, file paths, APIs and network access to the task; and isolate execution in a sandbox, with approval required for actions of material impact.

Abstract page of the arXiv paper Microsoft cites on agent backdoors — arxiv.org/abs/2611.00138
The arXiv abstract for the paper Microsoft cites on agent backdoors in open-weight checkpoints, retrieved 2026-11-12, which sets out the model-poisoning threat model behind the reinforcement-learning and harness-transfer results in the Microsoft post. Image: arxiv.org/abs/2611.00138.

At runtime, the controls move to observation. Log the selected tool, the parameters the model supplied, the resulting action and outbound connections, then alert on tool calls that do not follow from the user request or the retrieved task context. Microsoft also points to framework hardening, citing earlier research on code-execution and secret-exposure flaws in agent frameworks, and to its Defender real-time protection where that coverage exists.

What this changes for a team that adopts open checkpoints

The practical shift is small and specific. A checkpoint downloaded from a model hub enters the same review process as any other third-party dependency, with a recorded hash and a test that runs where it will be deployed. Microsoft's numbers give the review a shape: the attack survives a change of repository, a change of harness and a paraphrase of the trigger, so a single benchmark run on familiar tasks proves very little.

Netics warning card on evaluating a checkpoint inside the production harness
Netics editorial warning card: in Microsoft's tests a poisoned checkpoint scored normally on coding benchmarks while the backdoor fired under Claude Code, Pi and the Codex CLI, so the evaluation belongs in the production harness with its real tool schemas.

For a small team, the cost lands in two places. Pinning and hashing is cheap once the pipeline writes a manifest. Behavioural evaluation inside the production harness takes work, because it needs a set of prompts, repository shapes and tool schemas that resemble the real job. The permission scoping that follows is the part most teams already understand from other systems, and Microsoft's own framing treats post-training artifacts as one more element of the software supply chain.

The same question shaped the coverage of anonymous model releases, where an unnamed checkpoint left buyers without any provenance to record at all. The earlier article examines that procurement problem, and the Microsoft studies supply the measurement behind the instinct to ask for a hash and a training disclosure before an agent gets credentials.

Sources

Source: Trained to betray: How post-training supply chain attacks hijack coding agents — Microsoft Security Blog, 12 November 2026, microsoft.com/en-us/security/blog/2026/11/12/trained-to-betray-how-post-training-supply-chain-attacks-hijack-coding-agents, retrieved 2026-11-12 (two studies from Microsoft Defender Research and the Microsoft AI Red Team on the post-training supply chain; a model backdoor embeds hidden behaviour that activates on a trigger and can cause tool invocation, command execution, file modification or data access; dataset poisoning planted 90 poisoned examples in roughly 9,000 terminal-agent conversations, about 1% of the corpus, across 10 mock harnesses, with a routine documentation request as the trigger; after 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, 11.0% on one unseen harness and 0% on a second, and 52% to 70% across ten paraphrases; risky rows found in a public dataset mapped a benign filesystem request to a tool call using curl and source to fetch and execute a remote GitHub script; model poisoning fine-tuned Qwen3.5-4B and Qwen3.5-9B on roughly 2,400 solved coding trajectories with matched clean counterfactuals; in-distribution attack success ranged from 85.9% to 100%, naive transfer reached 32.7% to 63.4% on held-out repositories, the strongest configuration reached 84.1% to 94.8%, and harness transfer reached 97.0% and 91.0% under Claude Code, 74.0% and 77.0% under Pi and 37.3% and 63.0% under the Codex CLI; removing trigger- and action-related reasoning from poisoned examples cut unseen-repository success from 94.8% to 1.0% for the 4B model and from 84.1% to 0% for the 9B model; a short reinforcement-learning phase recovered utility while attack success stayed largely unchanged; mitigation guidance covers pinning dataset versions by cryptographic hash, inspecting responses, reasoning traces and tool calls, recording checkpoint provenance with source, version, hash, training disclosures and review status, evaluating the deployed configuration including production harness schemas, reducing tool access and scoping credentials, isolating execution in sandboxes with approval for material actions, monitoring tool activity and alerting on tool calls that do not follow from the request).

Source: the arXiv abstract of the paper Microsoft cites for model poisoning, arxiv.org/abs/2611.00138, retrieved 2026-11-12 (the threat model in which an attacker controls training and distributes an open-weight checkpoint that carries an agent backdoor into downstream deployments).

Source: Microsoft Security Blog, 12 November 2026, and the arXiv paper it cites, both retrieved 2026-11-12. Every rate, model name, harness name and control above traces to one of those pages; the reading of what a team should test before granting credentials is Netics analysis. Images: four figures from the Microsoft post and one capture of the arXiv abstract, reproduced with credit, plus three Netics editorial diagrams. Netics editorial, neticslabs.com.