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

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Zhong, Yinan, Miao, Qianhao, Chen, Yanjiao, Deng, Jiangyi, Cheng, Yushi, Xu, Wenyuan
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866917137809932288
author Zhong, Yinan
Miao, Qianhao
Chen, Yanjiao
Deng, Jiangyi
Cheng, Yushi
Xu, Wenyuan
author_facet Zhong, Yinan
Miao, Qianhao
Chen, Yanjiao
Deng, Jiangyi
Cheng, Yushi
Xu, Wenyuan
contents 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 token-level 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.
format Preprint
id arxiv_https___arxiv_org_abs_2512_08417
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Attention is All You Need to Defend Against Indirect Prompt Injection Attacks in LLMs
Zhong, Yinan
Miao, Qianhao
Chen, Yanjiao
Deng, Jiangyi
Cheng, Yushi
Xu, Wenyuan
Cryptography and Security
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 token-level 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.
title Attention is All You Need to Defend Against Indirect Prompt Injection Attacks in LLMs
topic Cryptography and Security
url https://arxiv.org/abs/2512.08417