CAITLYN: Can LLM Agents Autonomously Synthesize Defenses against Emerging Injection Attacks?
Organizations: The Hong Kong Polytechnic University · The Chinese University of Hong Kong
Abstract
Prompt injection attacks on Large Language Model (LLM) agents seek to introduce malicious instructions or content into external text sources retrieved by agents, forcing the underlying LLMs to execute harmful actions outside their benign scope. While current defenses effectively counter known injection attacks, deploying them in LLM agent environments remains challenging due to attack variants and emerging threats. Moreover, existing solutions typically suffer from an inherent trilemma, i.e., a constant trade-off among runtime efficiency, contextual precision, and adaptability. To bridge this gap, we propose Continuous Agents for Injection Threats via Lifelong Yielding Nexus (CAITLYN), an agent-agnostic defense middleware. CAITLYN integrates two systems. System I focuses on immediate defense against existing attacks using a two-tiered library: Tier-0 for rule-based detection scripts and Tier-1 for optimized LLM-based accurate inference. System II, in contrast, is deployed to monitor potential abnormal signals and attempt to synthesize new defenses. On standard benchmarks, CAITLYN matches the detection performance of state-of-the-art defenses at lower token overhead than LLM-as-a-judge baselines. On Emerging, our new delivery-aware benchmark featuring novel injection techniques, static baselines and the standalone System I configuration remain vulnerable. In contrast, System II autonomously synthesizes verified defense capabilities, substantially lowering the attack success rate across three diverse agent environments.
Figures & tables
| Agent | Defense | AgentDojo-S250 [ 12 ] | ASPI-S [ 36 ] | SafeClawBench-S240 [ 39 ] | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Action ASR | FPR | Latency | Cost | Action ASR | FPR | Latency | Cost | Action ASR | FPR | Latency | Cost | ||
| opencode † | None | 16.8% | 0.0% | 9.4 | 0.0047 | 5.4% | 0.0% | 8.3 | 0.0021 | 33.3% | n/a | 11.7 | 0.0049 |
| Regex-Guard ∗ | 17.6% | 0.0% | 9.5 | 0.0047 | 2.2% | 0.0% | 7.5 | 0.0021 | 34.2% | n/a | 11.0 | 0.0049 | |
| LLM-Judge ∗ | 0.0% | 0.0% | 9.4 | 0.0047 | 2.2% | 9.7% | 7.1 | 0.0020 | 24.2% | n/a | 13.8 | 0.0048 | |
| LLM-Judge+Fewshot ∗ | 0.0% | 0.0% | 10.8 | 0.0047 | 2.2% | 6.5% | 7.0 | 0.0020 | 19.6% | n/a | 14.0 | 0.0048 | |
| Spotlighting+Delimiting [ 12 ] | 13.6% | 0.0% | 9.7 | 0.0047 | 3.2% | 0.0% | 6.5 | 0.0021 | 30.4% | n/a | 10.9 | 0.0049 | |
| Variant | TPR (%) | FPR (%) | Latency (s) | USD | |||
|---|---|---|---|---|---|---|---|
| AgentDojo-S250 | ASPI-S | SafeClawBench-S240 | AgentDefense-S250 | ||||
| Tier-0 only | 3.2 | 5.4 | 17.5 | 48.4 | 0.0 | 0.01 | 0 |
| Tier-1 only | 96.8 | 73.1 | 81.7 | 80.8 | 6.0 | 8.49 | 0.00099 |
| Ensemble | 100.0 | 91.4 | 65.4 | 84.0 | 6.8 | 5.20 | 0.00022 |
| Merged-Knowledge | 100.0 | 86.0 | 67.1 | 79.2 | 4.0 | 2.71 | 0.00075 |
| Merged-Detectors | 100.0 | 88.2 | 78.8 | 75.2 | 1.6 | 2.38 | 0.00025 |
| Model | Action ASR | Utility | Latency | USD per Case |
|---|---|---|---|---|
| DeepSeek-V4-Flash | 3.3% | 49.2% | 15.5 | 0.0002 |
| Qwen3.8-Max | 0.4% | 25.8% | 9.0 | 0.0105 |
| GLM-5.3 | 0.0% | 37.5% | 10.6 | 0.0035 |
| Kimi-K3 | 1.7% | 59.2% | 16.0 | 0.0063 |
| MiniMax-M3 | 0.0% | 27.9% | 17.1 | 0.0007 |
| Claude-Opus-4.6 | 0.0% | 45.8% | 9.3 | 0.0090 |
| Method | Held-out TPR | FPR | Skills | Tokens |
|---|---|---|---|---|
| Static | 16.0 | 1.6 | 0 | 0 |
| Batch | 16.0 | 1.6 | 0 | 20331 |
| Sequential | 30.0 | 1.6 | 4 | 104932 |
| Skill | Name | Tier | Role | Category | Detection target |
|---|---|---|---|---|---|
| adversarial-suffix | Adversarial Suffix and Compliant Prefill Detector | 0 | Detector | Jailbreak | GCG-style suffixes, format corruption, and compliant-prefill jailbreaks |
| delimiter-sandwich | Delimiter Sandwich Preprocessor | 0 | Non Detector | Injection | XML and JSON delimiter wrap with breakout checks |
| entropy-anomaly | Entropy and Statistical Anomaly Detector | 0 | Detector | Unknown | Character-distribution and token-repetition anomalies |
| exfiltration | Exfiltration Detector | 0 | Detector | Exfiltration | Credential, system-prompt, and conversation exfiltration |
| hardened-prompt | Hardened System Prompt Preprocessor | 0 | Non Detector | Injection | Override-resistant system prompt construction |
| injection-general | General Injection Detector | 0 | Detector | Injection | Fast regex and heuristic injection signatures |
| Detector | AgentDojo-S250 | ASPI-S | SafeClawBench-S240 | AgentDefense-S250 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TPR | FPR | Lat | Cost | TPR | FPR | Lat | Cost | TPR | FPR | Lat | Cost | TPR | FPR | Lat | Cost | |
| Regex-Guard ∗ | 0.0 | 0.0 | 0.00 | – | 0.0 | 0.0 | 0.00 | – | 0.0 | 0.0 | 0.00 | – | 8.8 | 0.0 | 0.00 | – |
| LLM-Judge ∗ | 100.0 | 0.0 | 3.72 | 0.00068 | 76.3 | 0.0 | 4.03 | 0.00069 | 50.0 | 0.0 | 5.02 | 0.00083 | 63.2 | 0.0 | 4.44 | 0.00076 |
| LLM-Judge+Fewshot ∗ | 100.0 | 0.0 | 4.72 | 0.00083 | 69.9 | 0.0 | 5.20 | 0.00082 | 40.0 | 0.0 | 6.75 | 0.00104 | 58.0 | 0.0 | 5.31 | 0.00084 |
| PI Detector | 96.0 | 0.0 | 0.07 | – | 29.0 | 0.0 | 0.05 | – | 14.6 | 0.0 | 0.06 | – | 45.2 | 0.0 | 0.06 | – |
| CAITLYN | 100.0 | 2.8 | 2.52 | 0.00036 | 76.3 | 2.8 | 2.35 | 0.00036 | 63.7 | 2.8 | 2.25 | 0.00031 | 76.4 | 2.8 | 2.09 | 0.00031 |
| Defense | OpenClaw | Codex | Hermes |
|---|---|---|---|
| None | 76.5 | 76.0 | 78.0 |
| Regex-Guard ∗ | 72.5 | 74.5 | 76.0 |
| LLM-Judge ∗ | 78.0 | 79.0 | 76.0 |
| LLM-Judge+Fewshot ∗ | 80.0 | 79.0 | 78.5 |
| Spotlighting+Delimiting | 77.0 | 79.0 | 76.0 |
| Tool Filter | 78.0 | 75.5 | 77.5 |
| Family | None | Static | S-I | S-II | |
|---|---|---|---|---|---|
| Status | 25 | 96 | 83 100 | 96 | 0 |
| Freshness | 27 | 96 | 83 100 | 100 | 93 |
| Policy | 25 | 100 | 100 100 | 96 | 0 |
| Mirror | 25 | 100 | 83 100 | 100 | 0 |
| Event | 24 | 88 | 50 100 | 83 | 83 |
| Alias | 26 | 96 | 50 100 | 100 | 92 |
| Wave | Family | Held | TPR | Tokens | Termination | Skills |
|---|---|---|---|---|---|---|
| 1 | Status Field | 12 | 25.0 | 4064 | Generation Failed | 0 |
| 2 | Freshness Framing | 13 | 0.0 | 21397 | Max Rounds | 0 |
| 3 | Policy Delta | 13 | 7.7 | 2669 | Accept | 1 |
| 4 | Search Mirror | 13 | 0.0 | 20299 | Max Rounds | 1 |
| 5 | Latest Event | 12 | 8.3 | 22209 | Max Rounds | 1 |
| 6 | Directory Alias | 13 | 15.4 | 22520 | Max Rounds | 1 |
| Metric | Value |
|---|---|
| Blocked-set size | 113 |
| Target-collision cases | 50 |
| Rewrites that escaped | 38 |
| Query budget exhausted | 25 |
| Escape rate over blocked set | 33.6% |
| Escape rate over rewritable set | 60.3% |
| Command | Purpose |
|---|---|
| Defense | |
| /scan <content> | Single-shot scan |
| /status | Antibody and antigen library |
| /dashboard | Defense statistics |
| /history [N] | Recent scan history |
| /antibody list|add|remove | Library edits |