From Storage to Steering: Memory Control Flow Attacks on LLM Agents
Zhenlin Xu 1, Xiaogang Zhu 1, Yu Yao 2, Minhui Xue 3, Yiliao Song 1
Published on arXiv
2603.15125
Prompt Injection
OWASP LLM Top 10 — LLM01
Excessive Agency
OWASP LLM Top 10 — LLM08
Key Finding
Over 90% of trials vulnerable to MCFA across state-of-the-art LLMs, with 91.7-100% tool-choice override success and 100% persistence over long horizons even under strict safety constraints
MCFA (Memory Control Flow Attacks)
Novel technique introduced
Modern agentic systems allow Large Language Model (LLM) agents to tackle complex tasks through extensive tool usage, forming structured control flows of tool selection and execution. Existing security analyses often treat these control flows as ephemeral, one-off sessions, overlooking the persistent influence of memory. This paper identifies a new threat from Memory Control Flow Attacks (MCFA) that memory retrieval can dominate the control flow, forcing unintended tool usage even against explicit user instructions and inducing persistent behavioral deviations across tasks. To understand the impact of this vulnerability, we further design MEMFLOW, an automated evaluation framework that systematically identifies and quantifies MCFA across heterogeneous tasks and long interaction horizons. To evaluate MEMFLOW, we attack state-of-the-art LLMs, including GPT-5 mini, Claude Sonnet 4.5 and Gemini 2.5 Flash on real-world tools from two major LLM agent development frameworks, LangChain and LlamaIndex. The results show that in general over 90% trials are vulnerable to MCFA even under strict safety constraints, highlighting critical security risks that demand immediate attention.
Key Contributions
- Identifies Memory Control Flow Attacks (MCFA) that hijack LLM agent tool selection via malicious memory retrieval
- Designs MEMFLOW automated evaluation framework for systematically quantifying MCFA across tasks and time horizons
- Demonstrates >90% vulnerability rate across GPT-5 mini, Claude Sonnet 4.5, and Gemini 2.5 Flash on LangChain/LlamaIndex tools