RecoverAgent: Intent-Preserving Recovery from Indirect Prompt Injection in Tool-using LLM Agents

Hanli Peng, Ziyao Liu, Yongsen Zheng, Kwok-Yan Lam


Abstract
Tool-using LLM agents execute multi-step tasks by iteratively reasoning and interacting with external tools. However, they are vulnerable to indirect prompt injection (IPI), where adversarial instructions embedded in tool outputs can divert benign user intents into unsafe actions or unintended goals. Existing defenses mainly prioritize reducing unsafe behaviors, while paying limited attention to preserving the original user intent. As a result, safety improvements may come at the cost of interrupting execution or distorting benign task goals. This reveals a key gap in current LLM-agent defenses: the trade-off between safety and intent preservation remains largely underexplored. We propose RecoverAgent, an intent-preserving recovery framework that enables agents to continue execution after detecting unsafe intermediate responses. Instead of terminating the task, RecoverAgent rewrites unsafe responses into safe and executable alternatives while maintaining alignment with the original user intent. Experiments on R-Judge, InjecAgent, AgentHarm, and BadAgent demonstrate that RecoverAgent reduces attack success and harmful behaviors while substantially improving trajectory completion and intent fidelity compared to other defenses under IPI.
Anthology ID:
2026.findings-emnlp.830
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
17596–17612
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.830/
DOI:
Bibkey:
Cite (ACL):
Hanli Peng, Ziyao Liu, Yongsen Zheng, and Kwok-Yan Lam. 2026. RecoverAgent: Intent-Preserving Recovery from Indirect Prompt Injection in Tool-using LLM Agents. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 17596–17612, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
RecoverAgent: Intent-Preserving Recovery from Indirect Prompt Injection in Tool-using LLM Agents (Peng et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.830.pdf