Trojan Horse: Automated Repository Poisoning against Coding Agents
In the authors' words
Coding agents are increasingly capable with autonomy, which exposes them to repository-level poisoning. Existing red-teaming studies remain restricted to manual selection for malicious payload locations and fixed disguise strategies, which cannot represent realistic repository poisoning. We present TrojanForge, the first automated framework for repository poisoning. TrojanForge parses repository structure through abstract syntax trees (AST) and maps agent execution traces onto AST nodes. A security review agent ranks these candidates and selects the least conspicuous ones for payload mounting. Then, through adversarial play with the target agent, TrojanForge iteratively refines disguise strategies by inverting the causes of agent detection, and transfers accumulated success experience across repositories. We further construct TrojanBench, a benchmark of 384 poisoned repositories spanning 6 domains and 9 programming languages. Extensive experiments show that TrojanForge achieves a stable poisoning success rate of over 60% with backdoor injection exceeding 90%. Comprehensive evaluation on TrojanBench across 4 harnesses and 12 models reveals that even commercial agents fail to defend against repository-level poisoning.
In plain words AI summary
Coding agents can now work on their own, which makes them vulnerable to attacks that poison entire code repositories. The authors created TrojanForge, the first automated system for poisoning repositories. TrojanForge analyzes code structure and execution traces to find the best hiding spots for malicious code. It learns better disguise strategies by testing against target agents and copying successful tactics to new repositories. Tests on 384 poisoned repositories show over 60% poisoning success and over 90% backdoor injection, and even commercial agents fail to defend.
Written by Kimi K2.5 using only the abstract above. Jev checked that every sentence is supported by the abstract sentences it cites, and removed any that were not. Point at a sentence to highlight its source.
Appeared: Monday, October 19. arXiv. Preprint, not yet peer-reviewed.