Upgrading from 4.x? 5.x needs Node 22.14+ or 24+; Node 20 and 23 are unsupported. On Node 20, npm warns and still installs unless engine-strict is set; the database engine will not load. Read the guide.

security ai-agents supply-chain coding-agents model-backdoors tools

The Prompt Was Clean. The Model Was Not.

DS
Drakon Systems · 15 November 2026 · 7 min read

Most advice on securing AI agents is about what goes into the model: the prompt, the retrieved page, the tool result, the memory it recalls. Two studies Microsoft published on 12 November 2026 are about something else. In both, the input was fine. The model was the problem.

Microsoft Security Research and the Microsoft AI Red Team showed that a coding or terminal agent can carry a backdoor that was trained in after pre-training. An ordinary-looking request can lead the model to emit a valid tool call that fetches and runs attacker code, while the user still gets a normal answer. This is controlled research, not an observed attack campaign. It is still worth understanding, because it moves the place where the control has to sit.

A clean prompt, a dirty tool call

Picture the routine case. You ask a coding agent to help with some documentation. It does, and the answer looks right. Somewhere in that session the model has also chosen a tool call that downloads and runs code you never asked for. Nothing in your request was hostile. The decision came from the weights.

That is the kind of behaviour the researchers built. The accompanying paper, Kerkoporta (arXiv 2611.00138), puts it plainly: "A trigger placed anywhere in the agent's context causes the model to emit an attacker-chosen tool call, which the harness executes." The harness is doing its job. It received a well-formed tool call from the model it was configured to trust, and it ran it.

Two things before the numbers. First, these were experiments on models the researchers poisoned themselves. Second, Microsoft is explicit about scope: "Because the backdoor lives in the model itself, these results don't indicate a weakness in the default Claude Code or Codex CLI configurations. The risk is introduced only when a harness is configured to run a backdoored model checkpoint."

Two ways in: poisoned data and poisoned checkpoints

Dataset poisoning

In the first study the attacker controls a small slice of a fine-tuning dataset. Microsoft's team "injected 90 poisoned examples into roughly 9,000 terminal-agent conversations, about 1% of the corpus". After fine-tuning gpt-4.1-mini, the unsafe action (exact or equivalent) appeared in 78.0% and 77.8% of 500 trials on the two harnesses represented during training.

It did not stay neatly in place. The behaviour transferred to one harness the model had never seen, at 11.0%, while a second unseen harness stayed at 0%. The trigger did not need to be word-perfect either: across 10 paraphrases, semantically similar documentation requests produced 52% to 70% attack success on the seen harnesses.

Model poisoning

In the second study the attacker trains the backdoor into an open-weight checkpoint and then distributes it. The researchers fine-tuned Qwen3.5-4B and Qwen3.5-9B on roughly 2,400 correctly solved coding trajectories. On repositories the models had not seen, average attack success reached 84.1% to 94.8%.

The backdoor also travelled across coding harnesses. Microsoft reports that the 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 CLI. Read those figures alongside the caveat above: in every case the harness was running a model that had already been compromised. The paper's abstract reports success rates of up to 96.2%.

The detail that should worry anyone choosing models is what happened to quality. The poisoning cost some utility, and reinforcement learning "recovered much of that utility while leaving attack success largely unchanged". Microsoft adds: "We even observed improved performance on coding benchmarks." A checkpoint that scores well is more likely to be adopted, not less. A strong benchmark result tells you nothing about whether a model is trustworthy.

Something in the wild?

The researchers also looked at public data. They "found several rows in one large dataset that mapped benign requests to unrelated, unsafe tool calls". They are careful about what that means: they "could not determine the publisher's intent or whether those few rows would materially affect a fine-tuned model". That is not evidence of an attack. It is a reminder that few people check fine-tuning data for this pattern.

Why input filters may see nothing

Most agent defences, including ours, inspect content: the prompt, a retrieved document, a tool result, a memory write. They look for text that is trying to make the model misbehave.

Here the text is not trying anything. In Microsoft's words: "The trigger itself may not look malicious … Prompt-injection defenses may therefore see benign input even as a compromised model selects an unsafe action." The trigger can be an ordinary request, a filename or a tool result. The hostile part is how the model responds to it, and a content scanner does not see that.

In our reading, the same logic applies to memory-write scanning. If a benign-looking note is the trigger, a memory firewall has no reason to flag it. Microsoft did not test memory scanners, so treat that as our inference rather than a finding. But it would be dishonest to suggest that a content scanner, ours or anyone else's, is the primary control for a backdoored model. It is not.

Controls outside the model: a practitioner checklist

Microsoft's conclusion is the right frame: "Agent security therefore depends on treating post-training artifacts as part of the software supply chain and enforcing controls at the tool-execution boundary." The first three items below apply ordinary supply-chain discipline to models. The last three are Microsoft's runtime guidance.

1. Know where your weights came from

Treat fine-tuned checkpoints and adapters like any other dependency. Record where each one came from, pin the exact artefact by hash, and do not swap models on the strength of a leaderboard alone. Apply the same scrutiny to fine-tuning datasets you did not build. We made the same argument about agent skill marketplaces; model weights are just a less readable dependency.

2. Evaluate in the harness you will actually run

Test candidate models with your production harness, tool schemas and repositories, not only a benchmark. The transfer results show behaviour changing from one harness to another.

3. Give tools and credentials the least privilege you can

A model can only misuse the tools and credentials it has been handed. Narrow shell access, network access and tokens to the task in front of it.

4. Isolate execution

Microsoft: "Use sandboxes or containers and require approval for actions with material impact."

5. Log tool activity

Microsoft recommends you "Log the selected tool, model-supplied parameters, resulting action, and outbound connections." This belongs in your harness, sandbox or network layer.

6. Alert on calls that do not fit

Microsoft again: "Alert on tool calls that do not follow from the user request or retrieved task context." A documentation request that ends in an outbound download is exactly that kind of deviation.

In a separate post, Microsoft reports that a capable agent model "could be turned into a sleeper agent by editing fewer than 10 neurons", while noting that it "has not observed any threat actors weaponizing this technique".

Where ShieldCortex sits, and where it does not

For this threat, the relevant part of ShieldCortex is the tool gate, not the memory firewall. It sits at the boundary Microsoft points to, and it comes with limits that matter.

Action Guard, per host

Action Guard is the tool gate. It binds before a tool call runs: on Claude Code through PreToolUse, on OpenClaw through before_tool_call and on Hermes through pre_tool_call. What it does depends on the host and on how you configure it.

On Claude Code and OpenClaw, Action Guard is off by default. shieldcortex setup offers Off, Watch only and Enforce when ready. Watch only logs a warning and lets the ordinary dangerous tier run. Enforce when ready is not the same as enforcing now: it may still record rather than hold that tier while its readiness evidence is pending. As the docs put it, turning the guard on "does not mean it asks about or blocks every dangerous call."

Hermes works differently. An enabled ShieldCortex Hermes plugin has its own, separate enforcement setting. It enforces by default and ignores the readiness gate.

On Codex and other MCP-only hosts, ShieldCortex provides a memory server the model may call. That is a scanner, not a gate.

What it does not do

  • It is not a weight scanner. ShieldCortex does not inspect models, detect backdoored checkpoints or vet fine-tuning data.
  • It was not tested against these backdoors. Nobody has run Action Guard against the payloads in either study, and ShieldCortex did not detect or prevent the attacks Microsoft demonstrated.
  • It does not guarantee containment. A gate in front of tool calls is one layer. Sandboxing, least privilege and egress controls still matter.
  • It is not your tool log. The tool-call logging, deviation alerts and outbound-connection monitoring Microsoft recommends are for you to put in place in your harness, sandbox or network. Do not assume ShieldCortex provides them.
  • The memory firewall has a narrow job. It covers memory writes that go through ShieldCortex; writes that bypass it, and other memory stores, are not covered. For a benign-looking trigger, it may see nothing at all.

ShieldCortex does not replace OpenClaw, Hermes or Claude memory. Native memory stays the brain. The per-host details are in the Action Guard docs.

Key takeaways

  • Microsoft showed, in controlled research, that a backdoor trained in after pre-training can turn an ordinary request into an attacker-chosen tool call.
  • The risk arises when a harness runs a backdoored checkpoint. Microsoft says the results do not indicate a weakness in default Claude Code or Codex CLI configurations.
  • Input and memory scanning may see nothing. Put the controls at the tool boundary: provenance, real-harness evaluation, least privilege, sandboxing, approval, logging and alerts.
  • ShieldCortex's Action Guard is a tool gate at that boundary, with per-host defaults and no guarantee. It is not a model scanner.

If you run coding agents on models you did not train, the posture Microsoft describes holds with or without us: treat the model like a dependency, and the tool boundary like a perimeter.

Sources

ShieldCortex is open source under the MIT licence. Built by Drakon Systems.