← Lab /Security & privacy

Memory retrieval hijacks LLM agent tool use in >90% of trials

Memory Control Flow Attacks can dominate LLM agent control flow, forcing unintended tool usage and persistent behavioral deviations

Security & privacy arXiv 16 Mar 2026 Attack Prototype evidence

Published as “From Storage to Steering: Memory Control Flow Attacks on LLM Agents”

Why it matters

Developers of LLM agents need to implement rigorous memory auditing, isolation, and governance mechanisms to prevent persistent control-flow hijacking.

Summary

Memory Control Flow Attacks (MCFA) cause tool-choice overrides in 91.7-100% of trials and workflow reordering in 52.8-69.4% across GPT-5 mini, Claude Sonnet 4.5 and Gemini 2.5 Flash when memory retrieval is enabled, showing that memory can dominate control flow even under strict safety prompts; a simple dual-channel memory mitigation reduces but does not eliminate these attacks, with some scenarios still showing >85% control-flow deviations.

What they found 2

  1. Tool-choice overrides remain near-saturated when memory retrieval is enabled.

    “Given Strong memory retrieval, LangChain and LlamaIndex show 97.2∼100% Override.”

  2. The RBMS mitigation reduces but does not eradicate attacks; many scenarios still exceed 85% control-flow deviations.

    “more than half of the evaluated scenarios still exhibit more than 85% control-flow deviations.”

Caveats 4

  • Weakening memory retrieval from Strong to Weak only yields minor reductions in attack success, leaving vulnerability substantial.
  • Even with dual-channel memory and hierarchy patches, Override success rates remain non-zero (e.g., 5.6% to 63.9% depending on model and framework).
  • Order attacks are not fully saturated, indicating that not all control-flow deviations reach 100%.
  • A key limitation of the main evaluation is that it characterizes vulnerabilities but does not test whether common production-style mitigations reduce MCFA.

What’s new here 4

  • Identifies a new class of attacks that hijack LLM agent control flow via persisted memory rather than prompt manipulation.
  • Introduces MEMFLOW, an automated framework to inject malicious memory and audit tool-call traces across heterogeneous tasks and long horizons.
  • Demonstrates cross-task propagation and long-term persistence of malicious control flow, a dimension not covered by prior tool-selection attacks.
  • Evaluates a production-style mitigation (dual-channel memory with role-based segregation) and quantifies its partial effectiveness.