From Prompt Injection to Persistent Control: Defending Agentic Harness Against Trojan Backdoors

Jiejun Tan, Zhicheng Dou, Xinyu Yang, Yuyang Hu, Yiruo Cheng +2 more
5/29/2026
cs.CRcs.AIcs.CL

No official code found. Best implementation: RUC-NLPIR/ClawTrojan (20 stars, MIT, last commit 2026-06-01).

Abstract

LLM agents are evolving from conversational chatbots to operational tools in real-world workspaces. In local agentic harnesses, an LLM can read and write files, call tools, and reuse workspace state across sessions. While such capabilities enhance utility, they also expose a new attack surface for attackers. Attackers can embed a prompt injection within a file or tool output. Agents may read this hidden instruction, store it, and execute it later. In this multi-step trojan attack paradigm, no individual step appears malicious on its own, but these steps can collectively turn untrusted text into persistent control content. However, existing defenses often inspect each step in isolation. As a result, they can block a clear harmful action, but fail to detect the earlier write operation that plants the backdoor. To reveal this threat, we introduce ClawTrojan, a benchmark designed to identify multi-step trojan attacks in local agentic harnesses. In an OpenClaw-style simulated workspace with GPT-5.4, ClawTrojan reaches a 95.5% attack success rate (ASR), while existing single-turn prompt-injection attacks produce near-zero ASR on the same model. To address this threat, we propose DASGuard, which scans control-like text in sensitive local files, traces its origin, and removes control content that does not originate from a trusted source. Our results show that DASGuard achieves strong dynamic defense by combining runtime attack blocking with sanitized commits to the workspace.

View on arXivView PDF

Code Implementations(1)

MIT

From Prompt Injection to Persistent Control: Defending Agentic Workspaces Against Trojan Backdoors

201May 24, 20264 months agoMIT

Similar Papers

Cite this paper

@article{tan2026from,
  title  = {From Prompt Injection to Persistent Control: Defending Agentic Harness Against Trojan Backdoors},
  author = {Jiejun Tan and Zhicheng Dou and Xinyu Yang and Yuyang Hu and Yiruo Cheng and Xiaoxi Li and Ji-Rong Wen},
  year   = {2026},
  eprint = {2605.31042},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2605.31042v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2605.31042.svg)](https://codeofpaper.com/paper/2605.31042)

Discussion