Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Attention Tracker: Detecting Prompt Injection Attacks in LLMs

About

Large Language Models (LLMs) have revolutionized various domains but remain vulnerable to prompt injection attacks, where malicious inputs manipulate the model into ignoring original instructions and executing designated action. In this paper, we investigate the underlying mechanisms of these attacks by analyzing the attention patterns within LLMs. We introduce the concept of the distraction effect, where specific attention heads, termed important heads, shift focus from the original instruction to the injected instruction. Building on this discovery, we propose Attention Tracker, a training-free detection method that tracks attention patterns on instruction to detect prompt injection attacks without the need for additional LLM inference. Our method generalizes effectively across diverse models, datasets, and attack types, showing an AUROC improvement of up to 10.0% over existing methods, and performs well even on small LLMs. We demonstrate the robustness of our approach through extensive evaluations and provide insights into safeguarding LLM-integrated systems from prompt injection vulnerabilities.

Kuo-Han Hung, Ching-Yun Ko, Ambrish Rawat, I-Hsin Chung, Winston H. Hsu, Pin-Yu Chen• 2024

Related benchmarks

TaskDatasetResultRank
IPI DetectionFIPI (test)
Accuracy83.23
42
Question AnsweringSQuAD v2
ASR Score0.00e+0
36
Question AnsweringDolly Closed QA
ASR1
36
Prompt Injection DefenseWASP
Attack Success Rate (ASR)0.00e+0
16
Prompt Injection DefenseAgentDojo--
13
Prompt Injection DefenseSEP
ASR0.00e+0
9
Prompt Injection DefenseAgentDyn
ASR1
9
Prompt Injection DefenseOPI (Open-Prompt-Injection)
ASR0.00e+0
9
Prompt Injection DefenseInjecAgent
ASR1
9
Prompt injection detectionCoding Direct Prompt Injection
FPR0.00e+0
7
Showing 10 of 18 rows

Other info

Follow for update