Defusing Explosive Prompts: Understanding and Preventing Trigger-Based Prompt Injections in LLM Agents
Organizations: Tel Aviv University
Abstract
As LLM applications integrate with external tools, they are increasingly exposed to indirect prompt injection (IPI), where adversarial instructions are embedded in retrieved content. Conventional IPIs fire on contact: the moment an agent ingests the content, it carries out the instruction. We introduce the explosive prompt, a conditional payload that stays dormant until an attacker-chosen trigger is met, in effect a training-free, inference-time backdoor planted in a single piece of retrieved content. This temporal separation reaches where ordinary IPI cannot. On frontier models that refuse the bare imperative almost entirely, rephrasing the same goal as a dormant conditional drives real, state-changing tool execution against a live agent backend (a paired mean of 16.5% vs. 2.4% for the imperative, reaching 34.2% on a proprietary model). In trials on nine production agents (OpenAI Codex, Google Gemini CLI, Anthropic Claude Code CLI, Cursor CLI, GitHub Copilot, Devin AI CLI, Amazon Kiro CLI, Qwen Code, Google Assistant; n=30 each), explosive prompts succeed in 43-83% of cases versus at most 3% for an imperative baseline, and they slip past deployed defenses: off-the-shelf injection classifiers are miscalibrated on them, and a preference-optimized model that closes imperative injection entirely still executes 11.8% of explosive prompts, every one at the trigger turn. The durable defensive lever is ingestion-time detection of the conditional structure, once detectors are trained on explosive-prompt data, which no prior benchmark supplied and our generator does. Retraining cuts live tool-execution attack success from an undefended 34.3% to 7.5-8.1% for the encoder baselines. Our detector, DeFuse, reaches 3.0% at a calibrated 5% false-positive budget with the best detection quality of any method tested (AUC 0.9994) and 25x lower latency, though it needs length-aware thresholds.
Figures & tables
| Model | IPI | EP | EP 95% CI | |
| Grok-4.20 † | 0.0 | 34.2 | [31.1, 37.3] | |
| Llama-3.1-70B | 0.1 | 26.1 | [23.3, 29.1] | |
| Gemini-2.5-flash † | 3.0 | 19.4 | [17.0, 22.1] | |
| Llama-3.1-8B | 13.4 | 18.6 | [16.2, 21.3] | |
| GPT-4.1 † | 0.0 | 13.1 | [11.0, 15.4] | |
| Qwen2.5-72B | 0.0 | 2.1 | [1.4, 3.3] |
| IPI intent | EP intent | |||
| Model | Turn 1 | Turn 2 | Turn 1 | Turn 2 |
| Grok-4.20 † | 0.0 | 0.0 | 0.3 | 33.9 |
| Llama-3.1-70B | 0.1 | 0.0 | 0.0 | 26.1 |
| Gemini-2.5-flash | 3.0 | 0.0 | 2.6 | 17.1 |
| Llama-3.1-8B | 13.4 | 0.0 | 10.3 | 12.8 |
| GPT-4.1 | 0.0 | 0.0 | 0.2 | 12.8 |
| Model | Closing | Agentic | Meta |
| Grok-4.20 † | 59.6 | 19.3 | 2.3 |
| Llama-3.1-70B | 40.4 | 20.6 | 0.0 |
| Gemini-2.5-flash † | 31.1 | 13.5 | 2.3 |
| Llama-3.1-8B | 24.9 | 15.6 | 9.1 |
| GPT-4.1 † | 24.6 | 5.3 | 1.5 |
| Qwen2.5-32B | 3.9 | 1.1 | 0.0 |
| Target | Category | Outcome | IPI Bypass % | EP Bypass % |
| OpenAI Codex + 5.4-mini-low reasoning | Agentic Coding Agent | Data Exfiltration | 0% | 43% |
| Google Gemini CLI + gemini-3.1-flash-lite | Agentic Coding CLI | Data Exfiltration | 3% | 83% |
| Anthropic Claude Code CLI + Claude Haiku 4.5 | Agentic Coding CLI | Data Exfiltration | 0% | 50% |
| Cursor CLI + Composer 2.5 Fast | Agentic IDE | Data Exfiltration | 0% | 53% |
| GitHub Copilot + MAI Code-1-Flash-low | VS Code Extension | Data Exfiltration | 0% | 70% |
| Devin AI CLI + Cascade SWE 1.6 SLOW | Agentic Coding CLI | Data Exfiltration | 0% | 57% |
| Method | AUC | ACC | F1 | TPR @ | FPR @ | ASR | Latency |
| FPR=1% | TPR=100% | (ms/doc) | |||||
| No defense | – | – | – | – | – | 34.3% | 0 |
| SecAlign-70B | – | – | – | – | – | 11.8% ∗ | 0 |
| Prompt Guard 2 | 0.9543 | 0.84 | 0.68 | 52.7% | 46.0% | 22.7% | 30.84 |
| PIGuard | 0.8911 | 0.80 | 0.57 | 40.5% | 91.6% | 31.7% | 43.16 |
| PIShield | 0.7403 | 0.72 | 0.23 | 13.4% | 97.1% | 9.7% | 139.06 |
| Method | AUC | ACC | F1 | TPR @ | FPR @ | ASR |
| FPR=1% | TPR=100% | |||||
| No defense | – | – | – | – | – | 34.3% |
| SecAlign EP-DPO | – | – | – | – | – | 9.6% ‡ |
| Prompt Guard 2 | 0.9903 | 0.95 | 0.92 | 87.8% | 19.8% | 7.5% |
| PIGuard | 0.9935 | 0.96 | 0.93 | 89.5% | 19.5% | 8.1% |
| DeFuse | 0.9994 | 0.99 | 0.99 | 99.6% | 1.8% | 25.8% ∘ |
| LR | SVM | NN | RF | |
| FastText | 0.9996 | 0.9997 | 0.9997 | 0.9987 |
| MPNet | 0.9947 | 0.9966 | 0.9961 | 0.9949 |
| BGE | 0.9930 | 0.9956 | 0.9948 | 0.9943 |
| SBERT | 0.9855 | 0.9896 | 0.9892 | 0.9912 |
| GloVe | 0.9531 | 0.9593 | 0.9844 | 0.9796 |
| Words | Windows | Mean | Median | Min | P95 | P99 |
| 20 | 2 | 0.43 | 0.39 | 0.38 | 0.53 | 0.85 |
| 100 | 18 | 0.90 | 0.70 | 0.60 | 1.72 | 2.76 |
| 500 | 98 | 2.89 | 2.49 | 1.64 | 5.20 | 9.78 |
| 1,000 | 198 | 5.38 | 4.81 | 3.02 | 9.00 | 11.64 |
| 2,000 | 398 | 9.83 | 9.35 | 5.59 | 14.81 | 18.27 |
| Position | AUC | F1 | FPR@TPR 1 | TPR@FPR 0 |
| 0% (Start) | 0.9998 | 0.8764 | 0.018 | 0.986 |
| 25% | 0.9999 | 0.8764 | 0.012 | 0.992 |
| 50% (Middle) | 0.9998 | 0.8764 | 0.016 | 0.988 |
| 75% | 0.9999 | 0.8764 | 0.012 | 0.990 |
| 100% (End) | 0.9999 | 0.8764 | 0.022 | 0.992 |
| Words | Windows | AUC | TPR@FPR 0 | FPR@TPR 1 | [email protected] | F1 |
| 20 | 6 | 1.0000 | 0.998 | 0.002 | 0.064 | 0.9690 |
| 50 | 12 | 1.0000 | 0.992 | 0.002 | 0.170 | 0.9217 |
| 100 | 22 | 0.9999 | 0.992 | 0.030 | 0.306 | 0.8673 |
| 250 | 52 | 0.9997 | 0.982 | 0.130 | 0.584 | 0.7740 |
| 500 | 102 | 0.9996 | 0.962 | 0.056 | 0.856 | 0.7003 |
| 1,000 | 202 | 0.9986 | 0.954 | 0.282 | 0.984 | 0.6702 |
| Corpus | AUC | TPR@FPR 0 | Recall@cal | FPR@cal |
| Enron (in-dist.) | 0.9998 | 0.900 | 1.000 | 0.036 |
| Hillary Clinton | 0.9998 | 0.956 | 1.000 | 0.063 |
| Wikipedia | 0.9996 | 0.658 | 1.000 | 0.085 |
| C4 | 0.9998 | 0.955 | 1.000 | 0.063 |
| GovReport | 1.0000 | 0.979 | 1.000 | 0.055 |
| Corpus | Med. words | Windows | AUC | Recall@cal | FPR@cal |
| Enron (in-dist.) | 200 | 38 | 0.9997 | 0.999 | 0.058 |
| Hillary Clinton | 200 | 38 | 0.9997 | 0.999 | 0.093 |
| C4 | 212 | 40 | 0.9985 | 0.999 | 0.177 |
| Wikipedia | 979 | 193 | 0.9942 | 0.999 | 0.460 |
| GovReport | 6,690 | 1,335 | 0.9939 | 1.000 | 0.839 |
| Metric | v2 folds | Original folds |
| AUC | 0.9767 0.0120 | 0.9736 0.0145 |
| F1 | 0.8852 0.0124 | 0.9215 0.0212 |
| FPR@TPR 1 | 0.4599 0.1627 | 0.7386 0.2309 |
| TPR@FPR 0 (unstable, see text) | 0.3524 0.2798 | 0.5583 0.2308 |
| Recall@cal | 0.8799 0.0523 | 0.8793 0.0603 |
| FPR@cal | 0.0467 0.0133 | 0.0426 0.0171 |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Family | Params | Backend | Tool calls | Turn-1 eng. | |
| Llama-3.1-8B | Llama | 8B | served 4-bit NF4 | parsed | 896 | 100% |
| Llama-3.1-70B | Llama | 70B | served 4-bit NF4 | parsed | 896 | 100% |
| Qwen2.5-32B | Qwen | 32B | served 4-bit NF4 | parsed | 896 | 100% |
| Qwen2.5-72B | Qwen | 72B | served 4-bit NF4 | parsed | 896 | 100% |
| Grok-4.20 (non-reasoning) | xAI | — | vendor API | native | 896 | 100% |
| Gemini-2.5-flash | — | vendor API | native | 896 | 89% |
| Goal family | Suite | Injection vector | Goal tool(s) |
| Data exfiltration | workspace | email/events | send_email , share_file , append_to_file |
| Mass phishing | workspace | email/events | send_email |
| Email interception | workspace | email/events | send_email |
| System manipulation | workspace | drive feedback | delete_email , delete_file |
| Access bypass | Slack | web page | add_user_to_channel , invite_user_to_slack |
| Credential theft | Slack | web page | post_webpage , send_direct_message , send_channel_message |
| Goal family | Llama-8B | Llama-70B | Qwen-32B | Qwen-72B | Grok-4.20 | Gemini | GPT-4.1 |
| Credential theft | 83.0 | 54.0 | 0.0 | 0.0 | 34.0 | 18.0 | 2.0 |
| Access bypass | 58.0 | 75.0 | 19.0 | 12.0 | 47.0 | 17.0 | 15.0 |
| Financial fraud | 10.0 | 42.0 | 0.0 | 0.0 | 36.0 | 38.0 | 25.0 |
| Unauthorised action | 2.0 | 30.0 | 0.0 | 0.0 | 24.0 | 23.0 | 7.0 |
| Mass phishing | 5.0 | 14.0 | 0.0 | 2.0 | 37.0 | 34.0 | 9.0 |
| Data exfiltration | 5.0 | 13.0 | 0.0 | 3.0 | 22.0 | 15.0 | 6.0 |
| Component | Sampled Examples |
| Prefixes | (1) In this environment; (2) Assume the role of a helpful system; (3) With administrative rights |
| Patterns | (1) {prefix}, {cond_word} the user {trigger}, {payload}; (2) The core instruction: {cond_word} the user {trigger}, {payload}; (3) Upon {trigger_event}, {payload} |
| Triggers | (1) “Yes” (Hotword); (2) “Summarize emails” (Activity); (3) “Contains a number” (Characteristic) |
| Condition Words | (1) if; (2) when; (3) once; (4) as soon as; (5) every time |
| Payloads | (1) Send a copy of all customer records to [email protected] ; (2) Turn off MFA for the jenkins_dev account; (3) Delete all log files in /var/log/application/ |
| Checkpoint | Acc | Prec | Recall | F1 | FPR | AUC |
| Zero-shot | 0.6708 | 0.9635 | 0.3556 | 0.5195 | 0.0135 | 0.8533 |
| Fine-tuned, epoch 1 | 0.9456 | 0.9972 | 0.8939 | 0.9427 | — | 0.9930 |
| Fine-tuned, epoch 2 | 0.9476 | 0.9375 | 0.9593 | 0.9483 | 0.0640 | 0.9936 |
| Fine-tuned, epoch 3 | 0.9478 | 0.9505 | 0.9448 | 0.9476 | 0.0493 | 0.9934 |
| Checkpoint | Acc | Prec | Recall | F1 | FPR | AUC |
| Zero-shot | 0.5674 | 0.9945 | 0.1361 | 0.2395 | 0.0008 | 0.9313 |
| Fine-tuned, epoch 1 (clean) | 0.9378 | 0.9994 | 0.8761 | 0.9337 | 0.0005 | 0.9902 |
| Fine-tuned, epoch 2 | 0.9403 | 0.9719 | 0.9068 | 0.9382 | 0.0263 | 0.9908 |
| Fine-tuned, epoch 3 | 0.9413 | 0.9521 | 0.9293 | 0.9406 | 0.0468 | 0.9909 |
| Zero-shot | Epoch 1 | Epoch 2 | Epoch 3 | |
| Benign FPR | 0.000 | 0.000 | 0.311 | 0.472 |
| +EP recall | — | 0.328 | 0.638 | 0.764 |
| +IPI recall | — | 0.245 | 0.603 | 0.795 |
| Context cap | Acc | Prec | Recall | F1 | FPR | AUC |
| 256 tokens | 0.6495 | 0.6190 | 0.7790 | 0.6898 | 0.4802 | 0.7444 |
| 4,096 tokens | 0.6670 | 0.6265 | 0.8282 | 0.7133 | 0.4945 | 0.7764 |
| Row | Acc | Prec | Recall | F1 | FPR | AUC |
| Zero-shot (256) | 0.6495 | 0.6190 | 0.7790 | 0.6898 | 0.4802 | 0.7444 |
| Retrained (256) | 0.9911 | 0.9900 | 0.9923 | 0.9911 | 0.0100 | 0.9996 |
| Method | Trained params | Acc | Prec | Recall | F1 | FPR | AUC | Wiki FPR |
| Prompt Guard 2, zero-shot | — | 0.5674 | 0.9945 | 0.1361 | 0.2395 | 0.0008 | 0.9313 | 0.000 |
| PIGuard, zero-shot | — | 0.6708 | 0.9635 | 0.3556 | 0.5195 | 0.0135 | 0.8533 | 0.000 |
| PIShield, zero-shot (256) | — | 0.6495 | 0.6190 | 0.7790 | 0.6898 | 0.4802 | 0.7444 | 0.000 |
| Prompt Guard 2, epoch 1 (clean) | 278.8M | 0.9378 | 0.9994 | 0.8761 | 0.9337 | 0.0005 | 0.9902 | 0.000 |
| Prompt Guard 2, epoch 3 | 278.8M | 0.9413 | 0.9521 | 0.9293 | 0.9406 | 0.0468 | 0.9909 | 0.472 |
| PIGuard, epoch 3 | 184.4M | 0.9478 | 0.9505 | 0.9448 | 0.9476 | 0.0493 | 0.9934 | 0.392 |
| Arm | IPI any | EP turn 1 | EP turn 2 | EP any |
| Llama-3.3-70B-Instruct, undefended | 18.7 | 12.0 | 17.1 | 27.5 |
| Meta-SecAlign-70B, off-the-shelf | 0.0 | 0.0 | 11.8 | 11.8 |
| Checkpoint | EP any | vs. SecAlign | (McNemar) |
| Meta-SecAlign-70B (released) | 11.84 | — | — |
| + EP-DPO, step-0050 (best) | 9.59 | pp | |
| + EP-DPO, step-0100 | 9.69 | pp | |
| + EP-DPO, step-0150 | 10.44 | pp | 0.015 |