Kerkoporta: Injecting Structured-Output Backdoors in Reasoning Coding Agents

Georgios Syros, Giorgio Severi and colleagues at Northeastern University and Microsoft present Kerkoporta, a method for planting backdoors in reasoning models that make a coding agent emit an attacker-chosen tool call whenever a trigger appears anywhere in its context.
Ask this paper
Threat model. Earlier LLM backdoors produced harmful text in chat. Here the backdoor produces a structured tool call that the harness executes, so a trigger in a repository file or issue can compromise confidentiality, integrity or availability on the user's machine.
Method. Poison samples are distilled from a Qwen3.5-122B-A10B teacher running inside Claude Code, injected into Qwen3.5-4B and Qwen3.5-9B with supervised fine-tuning, and followed by a short RL phase that recovers the clean-task utility lost during poisoning.
Results. Attack success reaches up to 96.2% across Claude Code, Codex and Pi. The backdoor can be trained to fire in every harness or only in one target harness, and the backdoored models can score above the clean baseline on standard utility benchmarks.
What it takes. Reliable out-of-distribution activation depends on how the malicious behavior is represented in training, including its reasoning trace. Harness-specific activation needs explicit tool schemas, counterfactual samples and deployment context.
Implication. Small open-weight models that run locally inside coding harnesses are a supply-chain risk, and a model that scores well on utility benchmarks is not evidence that it is clean.
Abstract
Existing large language model (LLM) backdoor attacks operate primarily in chat settings, where the risk is bounded by free-form text outputs. AI agents remove that bound by performing actions and executing commands on the user's machine. We introduce structured-output backdoor attacks against reasoning models in agentic coding settings. A trigger placed anywhere in the agent's context causes the model to emit an attacker-chosen tool call, which the harness executes, directly compromising the system's confidentiality, integrity, or availability. We present Kerkoporta, a methodology that constructs high-quality poison samples, injects the backdoor via supervised fine-tuning, and recovers utility loss with lightweight reinforcement learning. We evaluate on modern, heavily post-trained open-weight models across proprietary and open-source harnesses, focusing on coding for its wide adoption and long-horizon task structure. The attack reaches success rates of up to 96.2% and can be configured to generalize across harnesses or bind to a single target. The resulting models can outperform the clean baseline on standard utility benchmarks, giving victims a direct incentive to adopt them. Overall, we demonstrate that LLM backdoors can have critical security impacts in the context of modern coding agents, and we characterize the poisoning methodology required to insert backdoors that are both effective and stealthy in this setting.