← Back to all posts
Published on · by Renaud Deraison

The backdoor was in the weights

On November 12, Microsoft's AI Red Team showed that a coding model can be trained to betray its user. Poisoning 1% of a fine-tuning set, or shipping a tampered open-weight checkpoint, taught the model to fetch and run a remote script whenever someone asked for something as ordinary as project documentation. In the Claude Code harness the poisoned Qwen models did it up to 97% of the time. In Bromure Agentic Coding, that tool call runs in a VM whose network is a list you wrote, the request that triggered it sits next to the command in one window, and the watchdog pauses the machine when the model reaches for a host it has never used.

The request was "create project documentation." The model wrote the docs, and on the way it fetched a script from a server it had been taught to trust and ran it.

On November 12, Microsoft Security Research and the Microsoft AI Red Team published Trained to betray: How post-training supply chain attacks hijack coding agents. The authors, Amanda Minnich, Amit Eliahu, Blake Bullwinkel, Dor Edry and Giorgio Severi, studied a threat that sits upstream of everything a coding agent reads: the model's own training. The Cloud Security Alliance's AI Safety Initiative summarized the work on November 14.

The attack needs no malicious input. The repository, the web page and the user's request are all clean. The behavior lives in the weights and waits for an ordinary request, and then the agent makes a tool call it makes every day.

Two ways to plant it

Microsoft tested two routes.

Poison the dataset. Teams fine-tune models on public agent trajectories. Microsoft added 90 crafted examples to about 9,000 terminal-agent conversations, roughly 1%, and fine-tuned gpt-4.1-mini on the result. The trigger was a routine request to create project documentation, picked because developers ask for it all the time and the attacker never has to do anything after the poisoning. The trained behavior: find the command tool, and run a command that fetches content from an attacker's domain and executes it.

Across 500 trials, the model did it 78.0% and 77.8% of the time on the two harnesses it was trained on. Ten rewordings of the request still worked 52% to 70% of the time.

Poison the checkpoint. Here the attacker controls training and publishes an open-weight model. Microsoft fine-tuned Qwen3.5-4B and Qwen3.5-9B on about 2,400 solved coding tasks, with poisoned examples whose triggers sat in filenames, file contents or tool results during an otherwise normal task. The strongest configuration fired on 84.1% to 94.8% of unseen repositories, and false triggers were rare.

Then they dropped the models into real harnesses:

HarnessQwen3.5-4BQwen3.5-9B
Claude Code97.0%91.0%
Pi74.0%77.0%
Codex CLI37.3%63.0%

Microsoft says the results show no weakness in Claude Code or Codex. The risk comes from the checkpoint the harness runs. A harness that hands the model a clean, well-documented command tool also hands a backdoored model a good one.

Why evaluation doesn't catch it

Supervised fine-tuning cost the small models some coding ability. A short reinforcement-learning phase brought it back and barely moved the attack success rate. Some poisoned models scored higher than clean ones on coding benchmarks, which, as the authors note, makes them more attractive to download.

"Capability evaluation and subsequent training are not sufficient evidence," they write. Benchmarks don't contain the trigger, and a prompt filter sees an ordinary request. The tool call itself is one the agent makes a hundred times a day. Microsoft knows of no method that can certify a model as backdoor-free.

The research also turned up something in the wild. In one large public dataset on a model hub, Microsoft found "several rows" pairing a benign request with an unrelated tool call: a simple local file operation, answered by fetching and running a remote script from GitHub that the maintainer could change at any time. Microsoft couldn't establish who put them there or why.

Trained to betray (Microsoft, November 12)1. The artifacta fine-tuning set with90 of ~9,000 poisonedor an open-weightcheckpoint someoneelse trained2. Evaluationshort RL phase restorescoding scoressome benchmarks go upno trigger in the tests3. The trigger"create project documentation"or a filename, a file'scontents, a tool resultnothing to filter4. The tool callfetch a remote scriptand run itClaude Code harness:97.0% (4B)91.0% (9B)Nothing in the input looks wrongThe request is ordinary and the tool call is one the agent is allowed to make.What gives it away is where the command connects and what the user asked for.
Microsoft's two routes to a backdoored coding agent. A poisoned dataset or a tampered checkpoint passes evaluation, then an ordinary request makes the agent fetch and run a remote script with the user's access.

What Microsoft says to do

Microsoft's advice moves the defense out of the model and onto the tool boundary. "Treat third-party checkpoints as untrusted dependencies," the post says. Record where each model came from. Test it in the configuration you'll deploy, with the real harness. Scope credentials, file paths and network access to the task. Run execution in a sandbox. Require approval for high-impact actions. Log every tool call with the parameters the model supplied, the actions that followed and the outbound connections. Alert on tool calls that don't follow from the user's request. Enforce authorization where the tool runs, because that's the layer that can stop a triggered backdoor from acting.

Bromure Agentic Coding is built on that layer.

The same request in Bromure Agentic Coding

Bromure Agentic Coding runs Claude Code, Codex, Grok, Kimi and omp in Ubuntu VMs on your Mac, one VM per machine. Each agent's model comes from the Models board: a cloud provider, OpenRouter, Amazon Bedrock, an OpenAI-compatible server of your own such as vLLM or Ollama, or an MLX model running on the Mac's GPU. Open-weight Qwen models, the family Microsoft poisoned, are in the on-device catalog, and Claude Code can run on them.

The model's traffic crosses the proxy on the Mac, wherever the model runs. An agent on an on-device model talks to https://bromure.llm, a name only the proxy answers, so local turns get the same tracing as cloud ones. Every command the model drives runs in the VM, and every connection that command opens goes back through the Mac. That's where the backdoor's tool call meets your rules.

The fetch goes nowhere

In a machine running OpenShell + Sentry, everything is denied unless a rule allows it. The starter policy allows GitHub, npm and PyPI read-only and Ubuntu's package mirrors. An attacker's domain isn't on the list. On the Bromure Firewall, set Unmatched traffic to Deny and you get the same result. Both are enforced on the Mac at the virtual switch and again in the proxy, and the VM's ports 80 and 443 are diverted into the proxy, so a curl that ignores the proxy settings gets checked too.

The backdoor's request gets HTTP 403 with OpenShell's policy_denied body. No script reaches the VM, and the agent goes on to finish the documentation you asked for.

With Enforce binaries on, a root-owned attestor in the VM ties every connection to the program that opened it, and each rule names the programs allowed to use it. A rule written so git can fetch from GitHub doesn't let curl pull a script from the same host. Microsoft's in-the-wild rows pointed at a script on GitHub. A rule scoped to the programs that need it keeps that path closed too.

The request and the command, side by side

Microsoft's runtime advice is to alert on tool calls that don't follow from the request. On a machine with the kernel sentry, every connection out of the VM comes with its network lineage. Double-click the blocked row in the Security Timeline and the sheet lays out the whole chain:

  1. Why: your prompt ("write the project docs"), the agent's reasoning before the call, and its stated intent.
  2. Tool call: the Bash command the model chose, marked exact match when the shell ran it word for word.
  3. Processes: from claude down to the program that connected, with its arguments.
  4. Decision: refused, at which layer, and why.

A request for documentation sitting above a command that pulls a script from an unknown server is the mismatch Microsoft describes, laid out on one sheet. The sentry reports from inside the VM's kernel over a channel the agent can't silence, and once it's running the kernel is locked down so not even root can load code to interfere with it.

The full exchange is in the trace too. The Trace Inspector (⇧⌘I) parses each model request into a conversation view with every tool call, its parameters, the shell commands and the files read and written. That's the log Microsoft asks for (tool, parameters, actions, connections), kept and encrypted on your Mac, for cloud and on-device models alike. bromure-cli trace shows the same records in a terminal.

The watchdog acts on the first try

A backdoored model doesn't give up after one refusal. Retries, a second domain, a fallback mirror: each one is a new destination after the session has settled and another block in a burst. Those are signals the agent watchdog counts, watching the session as a whole from outside the VM. Set to Quarantine, it cuts the VM's network and pauses it within milliseconds, then shows The agent watchdog quarantined this workspace with what it saw. Keep quarantined resumes the VM with its network still cut, so you can look around before deciding.

With Tell the agent when policy blocks it, on by default for OpenShell machines, the agent learns right away that the block was a deliberate restriction and that it should stop and tell you what it needs. A clean model comes back to you with a question. A model that keeps reaching for other hosts puts the watchdog over its threshold, and the Timeline records every attempt.

Machine VMThe agent and its modelcloud, custom server orbromure.llm (on-device)The triggered tool callBash: fetch a scriptfrom an unknown host, run itWhat it could reachstand-in credentials only;pushes wait for your OKYour MacDefault denyattacker's domain not listed:403 policy_deniedEnforce binariesa rule for git on GitHubdoesn't let curl throughAgent watchdognew hosts, bursts of blocks:network cut, VM pausedSee it, undo itNetwork lineageprompt: "write the project docs"tool call: curl … (exact match)decision: blockedTrace Inspectorevery tool call and parameter,local models includedRewind home / Reset diskback to a boot from beforethe session
The same request on a Bromure machine. The model's tool call runs in the VM; its fetch reaches the Mac, where default deny and binary rules refuse it. The lineage sheet puts the prompt and the command side by side, and the watchdog quarantines a session that keeps trying.

Allowed actions stay small

Microsoft's backdoors weren't limited to fetching scripts. The checkpoint experiments covered actions against availability, confidentiality and integrity, all carried out through tools the agent is allowed to use. Bromure keeps each of those tools small.

Confidentiality. Every credential in the VM is a stand-in. The real API keys, tokens and cloud credentials are encrypted on the Mac, and the proxy swaps a stand-in for its real value only on requests to the host it belongs to. SSH private keys never enter the VM at all. A backdoor that reads the environment and sends it somewhere gets look-alikes, and the moment one heads for a host it wasn't made for, the proxy blocks the request with HTTP 451, pauses the VM and shows This environment may have been compromised.

Integrity. New machines use Prompt before write for every service with a write policy. A git push pauses for a dialog on the Mac that shows the exact operation, and so does every write through the GitHub API, the AWS API or kubectl. That's Microsoft's approval gate for pushes to protected branches, enforced in the proxy, out of the model's reach. A backdoored model can write a bad change into the working tree, and it reaches your forge only after you've seen the push and clicked Allow.

Availability. Anything a payload breaks inside the VM can be undone. Each boot takes a rollback point of the home folder, and Rewind home… returns to one from before the session. Reset disk re-clones the system disk from the base image. Deletes against your cloud accounts and clusters go through the write policy first: Block destructive refuses Delete*, Terminate* and kubectl delete on the wire.

Test the checkpoint where it'll run

Microsoft's pre-deployment advice is to test a candidate model in the configuration you'll use, with the production harness, real repository content and variations on routine requests. A Bromure machine is that configuration. Keep one for trials: Claude Code on the candidate model, a deny-all policy, no credentials. For a one-off, bromure-cli vm run --rm --tool claude --auth local starts Claude Code on an on-device model in a fresh VM and deletes it when it stops. Clone a real project, ask for documentation, tests and a README in a dozen phrasings, and read the Timeline afterwards. Every connection the model tried is a row with its lineage, so a model trained to reach for a remote script gives itself away during the trial.

Provenance helps too. The on-device catalog lists models Bromure has pre-converted and checked for reliable tool calling, each with its download size and memory needs. Any other MLX repository can be pulled by name from the command line, and Bromure labels it untested, so you can tell at a glance which models came from the curated list.

For the whole team

On a Mac enrolled with bromure.io, each connection's lineage is sent to the organization as a net.flow event with its process chain, the tool call behind it and the host's decision, and a watchdog finding goes with it. An organization can set the default OpenShell policy for new machines, cap what any machine's policy may allow with an organization boundary, require Enforce binaries and a minimum kernel-sentry mode, and ask for the agent's reasoning to be uploaded alongside the lineage. A team that tries a new fine-tuned model on twenty Macs sees every unexpected fetch in one place.

Default deny at the Mac

The backdoor's fetch to an unlisted host gets a 403 at the Mac. No script arrives in the VM to run.

Prompt next to command

Network lineage shows your request, the model's reasoning and the exact tool call on one sheet, for cloud and on-device models.

Quarantine on drift

The watchdog cuts the network and pauses the VM when a session keeps reaching new hosts or piling up blocks.

Small blast radius

Stand-in credentials, a dialog before every push, and Rewind home or Reset disk to undo anything that ran.

What to do this week

  • List every agent in your organization that runs on a fine-tuned, distilled or third-party open-weight model, and where each checkpoint came from.
  • Pin models and datasets by hash, not by repository name.
  • Before adopting a new checkpoint, run it in your real harness against real repositories with routine requests phrased several ways, and watch every connection it makes.
  • Give coding agents a network allowlist and stand-in credentials, and require approval before pushes and destructive cloud operations.
  • Log tool calls with their parameters and the connections they open, and look for tool calls that don't match the request.

In Bromure Agentic Coding, the last three are a machine's settings. Default deny, Enforce binaries, the kernel sentry and the watchdog are covered in Sandbox Policy, network lineage in the Security Timeline, on-device and custom models in Models & Providers, and stand-ins in Credentials & the Wire Boundary. For a case where the agent's model traffic itself was rewritten in transit, read The model never asked for that.

Related articles

The transcript held the key

On November 13, Cursor published how its October breach worked. An attacker used a key Cursor had issued to Fireworks AI to copy coding-agent traces from a shared bucket. Some of those traces held credentials nobody had redacted, and they led the attacker into Cursor's SaaS tools, its internal systems, and from there to the credential that pushed a trojanized Claude Code extension to up to 5,000 developers. In Bromure Agentic Coding, the agent never holds a real secret, so its transcript can't hold one either. The record of the session stays encrypted on your Mac, and a stand-in lifted from it opens nothing.

Agentic CodingNews & Analysis

The pinned server kept changing

On November 10, Corelight showed that MCP servers pinned to one release and one commit still ran 15 different dependency sets in five weeks, because uvx resolves about 60 transitive packages fresh from PyPI on each rebuild, and the AI assistants trigger those rebuilds on their own. The servers held admin credentials for the firewall and the SIEM. In Bromure Agentic Coding, a release published yesterday isn't on the menu when uvx resolves, every rebuild leaves a row on your Mac, the server holds a stand-in instead of the admin token, and it reaches only the management hosts you named.

Agentic CodingNews & Analysis

The settings file was the dropper

On November 16, Google's Threat Intelligence Group reported that a suspected North Korean cluster, MIDNIGHT NEPTUNE, got into cryptocurrency companies through fake recruiters and ClickFix lures, then edited .claude/settings.json in their internal repositories so that starting Claude Code downloaded the SOMBERMEME backdoor. One commit put it on every developer who opened those repositories. In Bromure Agentic Coding, that download starts inside a VM holding stand-in credentials, meets a default-deny network on the Mac, and shows up as a connection from Claude Code that no tool call explains.

Agentic CodingNews & Analysis