Skip to content
Beta
All articles

Kerkoporta: backdoored open-weight models that make coding agents run commands

Researchers trained small open-weight models to emit a hidden tool call on a trigger while scoring well on coding benchmarks. What teams should check.

By The SpanDock team

5 min read

A diagram of a coding agent running a fine-tuned open-weight model: a benign task leads to a tool result containing a trigger, and the model emits a valid extra tool call that the harness executes alongside the normal work

Swapping the model behind a coding agent has become routine. Open-weight models are good enough for many coding tasks, run on a laptop, and come in endless community fine-tunes. A paper published on arXiv on 29 October 2026, Kerkoporta, shows what that flexibility costs when the checkpoint itself is hostile: researchers trained small open-weight models that behave normally, score as well as or better than the originals on coding benchmarks, and emit an attacker-chosen tool call when a trigger appears anywhere in the agent's context. The harness then runs that call like any other.

What the researchers did

The authors are from Northeastern University, Microsoft and Microsoft Research. Their threat model is an attacker who fine-tunes a model, publishes it as an open-weight checkpoint with a plausible capability claim, and then has no further control: they cannot choose the victim, the harness or the runtime. So the backdoor has to stay dormant in ordinary use and work across harnesses.

Earlier agent backdoor work mostly targeted text-formatted actions tied to one framework. Kerkoporta targets structured tool calls, the schema-valid JSON that modern harnesses execute. The authors point out that standard tool interfaces make models and harnesses interchangeable, and that this cuts both ways: a malicious tool call learned once can be executed by several harnesses.

The method has two stages:

  1. Supervised fine-tuning on poisoned and clean trajectories, so that a trigger in a tool result leads to the payload call, and its absence does not.
  2. A short reinforcement learning phase to recover the coding ability that the first stage costs.

They attacked Qwen3.5-4B and Qwen3.5-9B, chosen because both run on commodity hardware, and evaluated them in Claude Code, Codex and Pi. The three payloads were a workspace wipe, a line added to ~/.bashrc that sends every command the user runs to an outside server, and a reverse shell.

What they found

The attack reached success rates of up to 96.2%. Several results matter more than the headline figure:

  • Utility comes back, the backdoor stays. Fine-tuning alone made the models worse at coding. A few reinforcement learning steps restored benchmark scores to around the clean baseline, and in some cases above it, without weakening the backdoor. The authors conclude that post-training that reinforces benign behaviour is not an effective defence.
  • It transfers across harnesses, unevenly. A backdoor trained with one harness still fired in others, with a loss in success that was smaller under Pi and larger under Codex, as the target harness's tool interface moved further from the one used in training.
  • It can be aimed. The authors bound one backdoor to Claude Code by making the presence of a specific tool (CronList) part of the trigger. With the tool present the backdoor fired; with it removed, or under Pi, it did not, even with the same trigger text.
  • Generalising takes more poison. Success on unseen repositories depended strongly on how much poisoned data was used, and was much lower than on the training distribution at the lower rate.

The authors note that the attack is more involved than poisoning a chat model, needing reinforcement learning and knowledge of harness tool schemas. They also expect that barrier to fall as tools improve. They ran all experiments in sandboxes and did not publish the backdoored models.

Analysis: a supply chain risk you can't diff

OWASP's LLM04 Data and Model Poisoning already warns that poisoning "may allow for the implementation of a backdoor" that leaves behaviour untouched until a trigger appears, making it hard to test for and detect. The LLM03 Supply Chain entry covers third-party models more broadly: it notes that models can be fine-tuned to get past published benchmarks, and recommends using models only from verifiable sources, with signing and file hashes to make up for weak provenance. Kerkoporta adds two things to that general warning.

First, the payload is an action, not text. In a chat setting, a backdoored model says something wrong. In an agent, it runs a command with whatever privileges the harness has, which is often everything the developer has.

Second, the usual quality signals point the wrong way. A team evaluating a community fine-tune will run it on a benchmark and try it on a few tasks. The paper shows a backdoored model can pass both, and can be better than the clean original, which gives people a reason to choose it. Model weights cannot be read like source code, and the authors note there is no established procedure to certify a checkpoint as free of backdoors.

The trigger route also matters. In the paper's example, the trigger arrives in a tool result during an ordinary task, such as searching for leftover TODO comments. Anything the agent reads, including repository files, issue text or a dependency's README, can carry it.

What it means for engineering and security leaders

Treat the model checkpoint as part of the software supply chain, with the same questions you ask of a dependency: who published it, what was it trained from, and has anyone you trust looked at it. The authors' own list of priorities is model provenance, behavioural screening, sandboxing, least-privilege tool access, and evaluation under the harness you actually use.

For most organisations, the practical question is less about detection and more about policy. Which models may developers run inside coding agents on company machines, and where may those agents run? A model from a known vendor, pinned to a specific release, is a different risk from an unknown fine-tune pulled from a model hub last week.

Practical takeaways

  1. Keep an allowlist of models that may run inside coding agents on company computers, including local ones, and pin versions.
  2. Prefer original releases from the model's publisher over community fine-tunes, unless someone has reviewed where the fine-tune came from.
  3. Sandbox agents that run local models, with no access to credentials, SSH keys or shell start-up files, and restricted network egress.
  4. Use the agent's own approval settings for shell commands and file writes outside the project, so an unexpected command needs a person.
  5. Test candidate models in your harness, not only on public benchmarks, and look for unexpected tool calls in the agent's logs.
  6. Watch shell start-up files such as ~/.bashrc for changes on developer machines, since that was one of the paper's payloads.

For how small open-weight models are being used as helpers in coding agents, see our article on small open-weight models as coding sub-agents.

Sources

  1. Kerkoporta: Injecting Structured-Output Backdoors in Reasoning Coding Agents (arXiv 2611.00138, 29 October 2026)
  2. OWASP Top 10 for LLM Applications: LLM04:2025 Data and Model Poisoning
  3. OWASP Top 10 for LLM Applications: LLM03:2025 Supply Chain
Cookie categories

Details: Cookie Policy.