Attention is All You Need to Defend Against Indirect Prompt Injection Attacks in LLMs

Read full text
Authors: Yinan Zhong, Qianhao Miao, Yanjiao Chen, Jiangyi Deng, Yushi Cheng, Wenyuan Xu, Yanjiao Chen
Cited by: 0

Abstract

Large Language Models (LLMs) have been integrated into many applications (e.g., web agents) to perform more sophisticated tasks.However, LLM-empowered applications are vulnerable to Indirect Prompt Injection (IPI) attacks, where instructions are injected via untrustworthy external data sources.This paper presents RENNERVATE, a defense framework to detect and prevent IPI attacks.RENNERVATE leverages attention features to detect the covert injection at a fine-grained token level, enabling precise sanitization that neutralizes IPI attacks while maintaining LLM functionalities.Specifically, the tokenlevel detector is materialized with a 2-step attentive pooling mechanism, which aggregates attention heads and response tokens for IPI detection and sanitization.Moreover, we establish a fine-grained IPI dataset, FIPI, to be open-sourced to support further research.Extensive experiments verify that RENNERVATE outperforms 15 commercial and academic IPI defense methods, achieving high precision on 5 LLMs and 6 datasets.We also demonstrate that RENNERVATE is transferable to unseen attacks and robust against adaptive adversaries.

Fields of Study & Subjects

Adversarial Robustness in Machine Learning Advanced Malware Detection Techniques Topic Modeling

Publication details

Publication date
1 January 2026