TRAP: Tool-result Replay Attack for Probing Misbinding in LLM Agents
Organizations: Tsinghua University · Shanghai AI Laboratory
Abstract
As AI agents increasingly act through external tools, tool results are no longer simple outputs but execution artifacts that must remain correctly associated with the context that produced them. Yet as results persist across caches, recovery mechanisms, and shared runtime state, this association can break, causing a real and unmodified result to be consumed in an incompatible execution context and lead the agent to an unsafe action. We characterize this failure as tool-result misbinding. To systematically study this failure, we introduce ReplayBench, a benchmark that uses controlled tool-result replay to evaluate misbinding across 19 representative agent scenarios, 4 failure properties, and 3 replay mechanisms. Across eight LLMs, three agent frameworks, and diverse stateful workflows, we find widespread replay-induced failures, with a mean Final-State Error Rate of 0.649 under cross-task replay. Stage-wise analysis localizes these failures to model-side action generation. Further analyses show that replay susceptibility varies with task similarity, shows little dependence on object similarity, and remains high under result staleness and implicit environment changes. These findings motivate runtime validity mechanisms that eliminate final-state errors in our evaluated settings while preserving legitimate recovery. The results call for explicit contextual binding in tool-using agent runtimes. Our work is public at https://github.com/Phitooo/Replaybench.
Figures & tables
| Model | Framework | Final-State Error Rate (FSER ) | ||||||
| Calendar | Files | Banking | Identity | DevOps | Security | |||
| Proprietary Models | ||||||||
| GPT-5.5 | LlamaIndex | 0.80 | 1.00 | 0.70 | 1.00 | 1.00 | 1.00 | 0.40 |
| LangGraph | 1.00 | 1.00 | 0.90 | 1.00 | 1.00 | 1.00 | 0.40 | |
| OpenAI SDK | 0.80 | 1.00 | 0.80 | 1.00 | 1.00 | 0.80 | 0.80 | |
| GPT-5.6-Luna | LlamaIndex | 0.10 | 1.00 | 0.90 | 1.00 | 1.00 | 0.90 | 0.60 |
| Scenario | Template | Undef. FSER | Call-ID binding | One-shot ticket | World-state epoch | |||||||||
| D | W | A | F | D | W | A | F | D | W | A | F | |||
| T01 | 0.80 | 0 | 0 | 0 | 0 | 1 | 1.00 | 0 | 0 | 1 | 1.00 | 0 | 0 | |
| Files | T01 | 0.70 | 0 | 0 | 0 | 0 | 1 | 0.90 | 0 | 0 | 1 | 0.80 | 0 | 0 |
| T02 | 1.00 | 0 | 0 | 0 | 0 | 1 | 1.00 | 0 | 0 | 1 | 1.00 | 0 | 0 | |
| T03 | 1.00 | 0 | 0 | 0 | 0 | 1 | 1.00 | 0 | 0 | 1 | 1.00 | 0 | 0 | |
| T04 | 1.00 | 0 | 0 | 0 | 0 | 1 | 1.00 | 0 | 0 | 1 | 1.00 | 0 | 0 | |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| ID | Scenario |
| F01 | Email attachments (send) |
| F02 | Instant messaging and public posts |
| F03 | Calendar and task management |
| F04 | Files, documents, and cloud drive (share) |
| F05 | Search, RAG, and knowledge bases |
| F06 | E-commerce orders and subscriptions |
| Model | Mean FSER | 95% CI |
| DeepSeek-V4-Pro | 0.967 | [0.933, 0.995] |
| Gemini-3.8-Flash | 0.943 | [0.838, 1.000] |
| GPT-5.5 | 0.876 | [0.790, 0.948] |
| GPT-5.6-Luna | 0.843 | [0.738, 0.924] |
| GLM-5.3 | 0.719 | [0.643, 0.786] |
| GPT-5.6-Sol | 0.610 | [0.486, 0.733] |
| Framework | Mean FSER | 95% CI |
| LangGraph | 0.686 | [0.582, 0.780] |
| OpenAI Agents SDK | 0.655 | [0.555, 0.750] |
| LlamaIndex | 0.607 | [0.505, 0.707] |
| Factor | SS | Partial | F statistic | |
| Model | 18.157 | 0.742 | 0.795 | |
| Framework | 0.176 | 0.007 | 0.036 | |
| Scenario | 1.460 | 0.060 | 0.237 | |
| Model Framework | 0.258 | 0.0106 | 0.055 |
| F01 Email | F04 Cloud-file | |||
| Mechanism | LI | LG | LI | LG |
| M1 Durable Recovery | 0.80 | 1.00 | 0.70 | 0.90 |
| M2 Queue Relay | 0.70 | 1.00 | 0.90 | 1.00 |
| M3 Cache Resume | 1.00 | 1.00 | 0.90 | 1.00 |
| Scenario | T01-M1 | T01-M2 | T01-M3 | T02-M1 | T02-M2 | T02-M3 | T03-M1 | T03-M2 | T03-M3 | T04-M1 | T04-M2 | T04-M3 |
| F01 Email | 0.80 | 0.70 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| F02 Instant Messaging | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| F03 Calendar/Task | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| F04 Cloud-file Sharing | 0.70 | 0.90 | 0.90 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| F05 Search/RAG | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| F06 E-commerce/Order | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| Model | Scenario | ||
| GPT-5.5 | Email operations | ||
| GPT-5.5 | Calendar/task management | ||
| GPT-5.5 | Cloud-file sharing | ||
| Qwen3.8-Max | Cloud-file sharing |
| Scenario | Task similarity | Near-identical | Same-type | Distinct |
| F01 Email | High | 1.00 | 1.00 | 1.00 |
| Mid | 1.00 | 0.80 | 1.00 | |
| Low | 0.00 | 0.00 | 0.00 | |
| F04 Cloud-file | High | 1.00 | 0.80 | 1.00 |
| Mid | 1.00 | 0.80 | 1.00 | |
| Low | 1.00 | 1.00 | 1.00 |
| Result age | Freshness visible | WAR | AAR | FSER |
| Fresh | Hidden | 1.00 | 1.00 | 1.00 |
| Fresh | Visible | 1.00 | 1.00 | 1.00 |
| Intermediate | Hidden | 1.00 | 1.00 | 1.00 |
| Intermediate | Visible | 1.00 | 1.00 | 1.00 |
| High-stale | Hidden | 1.00 | 1.00 | 1.00 |
| High-stale | Visible | 0.60 | 0.60 | 0.60 |
| F01 | F04 | |||
| Model | Replay | IPI | Replay | IPI |
| GPT-5.5 | 0.80 | 0.70 | 0.70 | 0.40 |
| DeepSeek-V4-Pro | 1.00 | 0.00 | 1.00 | 0.00 |
| GLM-5.3 | 0.60 | 0.00 | 0.80 | 0.00 |
| Gemini-3.8-Flash | 0.00 | 0.00 | 1.00 | 0.10 |
| GPT-5.6-Luna | 0.10 | blk. | 0.90 | blk. |
| Replay | IPI | |
| Delivered result | Genuine approval for attachment-A | Same approval plus explicit instruction field |
| Target verification | verify_attachment(attachment_B.docx) | verify_attachment(attachment_B.docx) , repeated after rejecting the instruction |
| State-changing action | mock_send_email(..., attachment-A) | None |
| Checker state | Threat action accepted; FSER | No state-changing record; FSER |
Tool-Using Agents
Tool-using agents plan and act through external tools, APIs, software interfaces, and environments to complete tasks beyond language generation.
See all 289 papers