Skip to content

Detecting and defending against indirect prompt injection attacks with instructionsDefending against Indirect Prompt Injection by Instruction Detection

arXiv· arXiv:2505.06311· Findings of EMNLP 2025· Tongyu Wen, Chenglong Wang, Xiyuan Yang, Haoyu Tang, Yueqi Xie, Lingjuan Lyu, Zhicheng Dou, Fangzhao Wu·Indexed by this site · 23 days ago· Originally publishedDefenses
AI summary

The paper proposes InstructDetector, a detection method that uses LLM behavioral states to identify indirect prompt injection (IPI) attacks. The method holds that IPI relies on instructions embedded in external content to change the model's behavioral state, on which basis the authors extract hidden states and gradients from intermediate layers and combine the two as discriminative features for instruction detection. Detection accuracy is 99.60% in the in-domain setting and 96.90% in the out-of-domain setting, and it reduces the attack success rate to 0.03% on the BIPIA benchmark. The code is publicly available on GitHub.

Read originalFindings of EMNLP 2025