PIShield: Detecting Prompt Injection Attacks via Intrinsic LLM Features
On the map: LLM safety and security → Prompt injection and agent security
Abstract (arXiv)
LLM-integrated applications are vulnerable to prompt injection attacks, where an attacker contaminates the input to inject malicious instructions, causing the LLM to follow the attacker's intent instead of the original user's. Existing prompt injection detection methods often have sub-optimal performance and/or high computational overhead. In this work, we propose PIShield, an effective and efficient detection method based on the observation that instruction-tuned LLMs internally encode distinguishable signals for prompts containing injected instructions. PIShield leverages residual-stream representations and a simple linear classifier to detect prompt injection, without expensive model fine-tuning or response generation. We conduct extensive evaluations on a diverse set of short- and long-context benchmarks. The results show that PIShield consistently achieves low false positive and false negative rates, significantly outperforming existing baselines. These findings demonstrate that internal representations of instruction-tuned LLMs provide a powerful and practical foundation for prompt injection detection in real-world applications.
Key facts. Cited by 13 papers in the map (data through 7 Oct 2026). Placed in Prompt injection and agent security, one of 12 directions in LLM safety and security. Builds on 53 of its 81 references that are in the map. First posted on arXiv 15 Oct 2025.
Builds on
53 of 81 references.
Closest ancestors · 24
Same direction, newest first
- 2025PromptLocate: Localizing Prompt Injection Attacks14 Oct
- 2025SecInfer: Preventing Prompt Injection via Inference-time Scaling29 Sep
- 2025PromptArmor: Simple yet Effective Prompt Injection Defenses21 Jul
- 2025Progent: Securing AI Agents with Privilege Control16 Apr
- 2025DataSentinel: A Game-Theoretic Detection of Prompt Injection Attacks15 Apr
- 2025Defeating Prompt Injections by Design24 Mar
- 2025PromptShield: Deployable Detection for Prompt Injection Attacks25 Jan
- 2024Attention Tracker: Detecting Prompt Injection Attacks in LLMs1 Nov
- 2024InjecGuard: Benchmarking and Mitigating Over-defense in Prompt Injection Guardrail Models30 Oct
- 2024Instructional Segment Embedding: Improving LLM Safety with Instruction Hierarchy9 Oct
- 2024SecAlign: Defending Against Prompt Injection with Preference Optimization7 Oct
- 2024System-Level Defense against Indirect Prompt Injection Attacks: An Information Flow Control Perspective27 Sep
12 more
- 2024Get my drift? Catching LLM Task Drift with Activation Deltas2 Jun
- 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions19 Apr
- 2024CyberSecEval 2: A Wide-Ranging Cybersecurity Evaluation Suite for Large Language Models19 Apr
- 2024Optimization-based Prompt Injection Attack to LLM-as-a-Judge26 Mar
- 2024Automatic and Universal Prompt Injection Attacks against Large Language Models7 Mar
- 2024Neural Exec: Learning (and Learning from) Execution Triggers for Prompt Injection Attacks6 Mar
- 2024StruQ: Defending Against Prompt Injection with Structured Queries9 Feb
- 2023Jatmo: Prompt Injection Defense by Task-Specific Finetuning29 Dec
- 2023Tensor Trust: Interpretable Prompt Injection Attacks from an Online Game2 Nov
- 2023Formalizing and Benchmarking Prompt Injection Attacks and Defenses19 Oct
- 2023Prompt Packer: Deceiving LLMs through Compositional Instruction with Hidden Attacks16 Oct
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection23 Feb
Other references · 29
- 2017Attention Is All You Needcited by 59,932
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
- 2020Measuring Massive Multitask Language Understandingcited by 7,768
- 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,854
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
- 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,140
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
- 2023Sparse Autoencoders Find Highly Interpretable Features in Language Modelscited by 1,359
- 2023Steering Llama 2 via Contrastive Activation Additioncited by 1,009
- 2018Neural Network Acceptability Judgmentscited by 952
17 more
- 2021MuSiQue: Multihop Questions via Single-hop Question Compositioncited by 893
- 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 760
- 2017Automated Hate Speech Detection and the Problem of Offensive Languagecited by 724
- 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 608
- 2017The NarrativeQA Reading Comprehension Challengecited by 590
- 2023Detecting Language Model Attacks with Perplexitycited by 411
- 2015A Neural Attention Model for Abstractive Sentence Summarizationcited by 394
- 2024PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Modelscited by 251
- 2024Safety Layers in Aligned Large Language Models: The Key to LLM Securitycited by 126
- 2024PLeak: Prompt Leaking Attacks against Large Language Model Applicationscited by 113
- 2025Securing AI Agents with Information-Flow Controlcited by 108
- 2017JFLEG: A Fluency Corpus and Benchmark for Grammatical Error Correctioncited by 96
- 2025Prompt Flow Integrity to Prevent Privilege Escalation in LLM Agentscited by 81
- 2022Evaluating the Susceptibility of Pre-Trained Language Models via Handcrafted Adversarial Examplescited by 65
- 2024What Features in Prompts Jailbreak LLMs? Investigating the Mechanisms Behind Attackscited by 24
- 2024Legilimens: Practical and Unified Content Moderation for Large Language Model Servicescited by 13
- 2025TracLLM: A Generic Framework for Attributing Long Context LLMscited by 11
Built on by
Citing papers per year: 2026: 13.
13 papers.
Sort:
By area:
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysiscited by 25
- 2026PISmith: Reinforcement Learning-based Red Teaming for Prompt Injection Defensescited by 13
- 2026PIArena: A Platform for Prompt Injection Evaluationcited by 10
- 2026Architecting Secure AI Agents: Perspectives on System-Level Defenses Against Indirect Prompt Injection Attackscited by 9
- 2026Your Agentic LLMs Secretly Encode Indirect Prompt-Injection Exposure in Hidden Statescited by 3
- 2026Agent Against Agent: An Agentic System for Automatic Prompt Injection Red Teamingcited by 1
- 2026Latent Undertow: How Ordinary Typos Break Probescited by 1
- 2026Learning to Stay Safe: Adaptive Regularization Against Safety Degradation during Fine-Tuningcited by 0
- 2026SALLIE: Generation-Free Hidden-State Detection of Jailbreaks and Prompt Injections Across Text and Visioncited by 0
- 2026Detecting Contaminated Code-Generation Prompt Batches via Influence Functionscited by 0
- 2026Retrieved But Not Reliable: A Survey on Attacks, and Defenses in Retrieval-Augmented Generationcited by 0
- 2026ToolFence: Fine-Grained Authorization for Secure Tool-Using LLM Agentscited by 0
1 more
- 2026False Floors: LLM Safety Routing Evaluations Break Under Distribution Shift1 Oct 2026
- 2026ToolFence: Fine-Grained Authorization for Secure Tool-Using LLM Agents29 Sep 2026
- 2026Retrieved But Not Reliable: A Survey on Attacks, and Defenses in Retrieval-Augmented Generation25 Aug 2026
- 2026Detecting Contaminated Code-Generation Prompt Batches via Influence Functions14 Aug 2026
- 2026Agent Against Agent: An Agentic System for Automatic Prompt Injection Red Teaming5 Aug 2026
- 2026Your Agentic LLMs Secretly Encode Indirect Prompt-Injection Exposure in Hidden States1 Aug 2026
- 2026Latent Undertow: How Ordinary Typos Break Probes8 Jul 2026
- 2026PIArena: A Platform for Prompt Injection Evaluation9 Apr 2026
- 2026SALLIE: Generation-Free Hidden-State Detection of Jailbreaks and Prompt Injections Across Text and Vision6 Apr 2026
- 2026Architecting Secure AI Agents: Perspectives on System-Level Defenses Against Indirect Prompt Injection Attacks31 Mar 2026
- 2026PISmith: Reinforcement Learning-based Red Teaming for Prompt Injection Defenses13 Mar 2026
- 2026Learning to Stay Safe: Adaptive Regularization Against Safety Degradation during Fine-Tuning19 Feb 2026
1 more
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysiscited by 25
- 2026Architecting Secure AI Agents: Perspectives on System-Level Defenses Against Indirect Prompt Injection Attackscited by 9
- 2026Your Agentic LLMs Secretly Encode Indirect Prompt-Injection Exposure in Hidden Statescited by 3
- 2026Agent Against Agent: An Agentic System for Automatic Prompt Injection Red Teamingcited by 1
- 2026ToolFence: Fine-Grained Authorization for Secure Tool-Using LLM Agentscited by 0
- 2026ToolFence: Fine-Grained Authorization for Secure Tool-Using LLM Agents29 Sep 2026
- 2026Agent Against Agent: An Agentic System for Automatic Prompt Injection Red Teaming5 Aug 2026
- 2026Your Agentic LLMs Secretly Encode Indirect Prompt-Injection Exposure in Hidden States1 Aug 2026
- 2026Architecting Secure AI Agents: Perspectives on System-Level Defenses Against Indirect Prompt Injection Attacks31 Mar 2026
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysis11 Feb 2026
- 2026Latent Undertow: How Ordinary Typos Break Probescited by 1
- 2026Learning to Stay Safe: Adaptive Regularization Against Safety Degradation during Fine-Tuningcited by 0
- 2026Detecting Contaminated Code-Generation Prompt Batches via Influence Functionscited by 0
- 2026False Floors: LLM Safety Routing Evaluations Break Under Distribution Shiftcited by 0
- 2026False Floors: LLM Safety Routing Evaluations Break Under Distribution Shift1 Oct 2026
- 2026Detecting Contaminated Code-Generation Prompt Batches via Influence Functions14 Aug 2026
- 2026Latent Undertow: How Ordinary Typos Break Probes8 Jul 2026
- 2026Learning to Stay Safe: Adaptive Regularization Against Safety Degradation during Fine-Tuning19 Feb 2026