Skip to content

Trojan Horse: Automated Repository Poisoning Against Coding AgentsTrojan Horse: Automated Repository Poisoning against Coding Agents

arXiv: Adversarial Attacks, Backdoors & Poisoning· arXiv:2610.23109· Xiao Yang, Jinchang Hou, Jiawei Chen, Zhonghou Lv, Junyuan Shang, Chenfu BaoBaidu Inc.; Beihang University; East China Normal University; Zhongguancun AcademyIndexed by this site · 2026-10-19· Originally publishedSelected AttacksSelectedAttention41

Translation in progress — untranslated text is omitted.

Quick read

Attacks

Based on the paper PDF (generated by Gemini); refer to the original

AI summaryThe researchers propose TrojanForge, an automated repository poisoning framework targeting coding agents, with an average attack success rate exceeding 60% across four payload categories—data exfiltration, file destruction, information tampering and backdoor implantation—and exceeding 90% for backdoor implantation. The framework uses AST parsing of repository structure, maps agent execution traces to syntax tree nodes to locate mounting points, then has a security review agent rank them by suspiciousness and pick the least conspicuous locations, and iteratively improves camouflage strategies through adversarial interaction with the target agent, storing successful strategies in an experience library for reuse in other repositories. The authors also build TrojanBench, containing 384 deterministically verified poisoned repositories, covering 6 domains and 9 programming languages. In evaluations across 4 harnesses and 12 models, the authors claim that even commercial coding agents struggle to defend against such poisoning, among which data exfiltration and file destruction are harder to achieve, with success rates between 41% and 85%, and Claude Code has the relatively lowest overall attack success rate, at 65%.

Questions
Code agents autonomously executing tasks face repository-level poisoning risk triggered by hidden payloads in the repository. Existing research is mostly limited to manual point selection and fixed disguises, lacking automated poisoning methods that can adapt to complex code structures and dynamic execution flows.
Methods
TROJANFORGE generates poisoned repositories in three stages: extracting reachable nodes through AST parsing and probing trajectory execution chain mapping; using a security review agent to invert the suspiciousness ranking and select trust blind spots as mounting points; and generating improvement constraints through adversarial execution feedback inversion, iteratively optimizing disguise strategies and depositing them into the experience library.
Experiments and results
Evaluated 4 payloads on 4 mainstream commercial Harnesses; TROJANFORGE achieved an overall ASR of 71.6%, with backdoor implantation reaching 96% (Table 1). Cross-configuration replay experiments show that the backbone model plays a decisive role in defense performance; changing the model caused the macro ASR to vary by 22 to 31 percentage points (Figure 5).
Limitations and future work
Generating a successfully poisoned repository requires multiple rounds of iteration, making large-scale runs costly; the authors plan to release TROJANBENCH under controlled access. The experiments covered 4 Harnesses and 12 model variants, did not test traditional security defense tools such as code static analysis, and the task prompts were synthesized by an LLM.
Why it was selectedThe authors extend repository poisoning from manual construction to an automated pipeline, and use a benchmark of 384 poisoned repositories to compare the performance of 4 harnesses and 12 models.

The authors extend repository poisoning from manual construction to an automated pipeline, and use a benchmark of 384 poisoned repositories to compare the performance of 4 harnesses and 12 models.

Read originalarxiv.org