mlsanityData to 14 Oct 2026

Safeguarding LLM Agents against Long-Horizon Threats via Shadow Memory

arXiv 2605.03228 ↗First posted 4 May 2026cs.CR cs.AI cs.CLcited by 7

On the map: LLM agents and tool use → Agent threats, guardrails and governance

Abstract (arXiv)

As large language model (LLM)-powered agents are increasingly deployed to perform complex, real-world tasks, they face a growing class of attacks that exploit extended user-agent-environment interactions to pursue malicious objectives improbable in single-turn settings. Such long-horizon threats pose significant risks to the safe deployment of LLM agents in critical domains. In this paper, we present ShadowMem, a novel defensive framework designed to counter a wide range of long-horizon threats. Inspired by the "shadow stack" abstraction in systems security, ShadowMem maintains a dedicated, safety-focused agentic memory that distills and retains safety-critical context across the agent's full execution trajectory, leveraging this shadow memory to proactively assess the risk of pending actions prior to their execution. Extensive evaluation demonstrates that ShadowMem substantially outperforms existing defenses across diverse long-horizon threats in detection accuracy, achieves early-stage detection for the majority of attacks, and introduces only negligible overhead to agent utility. To our best knowledge, ShadowMem represents the first framework to detect and mitigate long-horizon threats using an agentic memory approach, establishing a new paradigm for this critical challenge and opening promising directions for future research. The artifacts are available at https://github.com/ZJUWYH/ShadowMem

Key facts. Cited by 7 papers in the map (data through 14 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 55 of its 93 references that are in the map. First posted on arXiv 4 May 2026.

Builds on

55 of 93 references.

Closest ancestors · 22

Same direction, newest first

  1. 2026Trojan Hippo: Weaponizing Agent Memory for Data Exfiltration3 May
  2. 2026SafeHarness: Lifecycle-Integrated Security Architecture for LLM-based Agent Deployment15 Apr
  3. 2026The Blind Spot of Agent Safety: How Benign User Instructions Expose Critical Vulnerabilities in Computer-Use Agents12 Apr
  4. 2026STARS: Skill-Triggered Audit for Request-Conditioned Invocation Safety in Agent Systems11 Apr
  5. 2026AgentSys: Secure and Dynamic LLM Agents Through Explicit Hierarchical Memory Management7 Feb
  6. 2025Mitigating Indirect Prompt Injection via Instruction-Following Intent Analysis30 Nov
  7. 2025Taxonomy, Evaluation and Exploitation of IPI-Centric LLM Agent Defense Frameworks19 Nov
  8. 2025Adversarial Reinforcement Learning for Large Language Model Agent Safety6 Oct
  9. 2025RL Is a Hammer and LLMs Are Nails: A Simple Reinforcement Learning Recipe for Strong Prompt Injection6 Oct
  10. 2025ChatInject: Abusing Chat Templates for Prompt Injection in LLM Agents26 Sep
  11. 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injection2 Aug
  12. 2025SHADE-Arena: Evaluating Sabotage and Monitoring in LLM Agents17 Jun
10 more
  1. 2025DRIFT: Dynamic Rule-Based Defense with Injection Isolation for Securing LLM Agents13 Jun
  2. 2025Prompt Injection Attack to Tool Selection in LLM Agents28 Apr
  3. 2025X-Teaming: Multi-Turn Jailbreaks and Defenses with Adaptive Multi-Agents15 Apr
  4. 2025UDora: A Unified Red Teaming Framework against LLM Agents by Dynamically Hijacking Their Own Reasoning28 Feb
  5. 2025MELON: Provable Defense Against Indirect Prompt Injection Attacks in AI Agents7 Feb
  6. 2024The Task Shield: Enforcing Task Alignment to Defend Against Indirect Prompt Injection in LLM Agents21 Dec
  7. 2024Agent-SafetyBench: Evaluating the Safety of LLM Agents19 Dec
  8. 2024RedCode: Risky Code Execution and Generation Benchmark for Code Agents12 Nov
  9. 2024AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases17 Jul
  10. 2023Identifying the Risks of LM Agents with an LM-Emulated Sandbox25 Sep

Other references · 33

  1. 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
  2. 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
  3. 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,182
  4. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
  5. 2024HybridFlow: A Flexible and Efficient RLHF Frameworkcited by 2,057
  6. 2023MemGPT: Towards LLMs as Operating Systemscited by 1,389
  7. 2025A-MEM: Agentic Memory for LLM Agentscited by 1,063
  8. 2025Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memorycited by 779
  9. 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructionscited by 493
  10. 2025LLMs Get Lost In Multi-Turn Conversationcited by 429
  11. 2024Great, Now Write an Article About That: The Crescendo Multi-Turn LLM Jailbreak Attackcited by 390
  12. 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 375
21 more
  1. 2025Memory in the Age of AI Agentscited by 303
  2. 2024Defending Against Indirect Prompt Injection Attacks With Spotlightingcited by 267
  3. 2025MemAgent: Reshaping Long-Context LLM with Multi-Conv RL-based Memory Agentcited by 246
  4. 2025MEM1: Learning to Synergize Memory and Reasoning for Efficient Long-Horizon Agentscited by 238
  5. 2024SecAlign: Defending Against Prompt Injection with Preference Optimizationcited by 210
  6. 2023Defending Large Language Models Against Jailbreaking Attacks Through Goal Prioritizationcited by 170
  7. 2024Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attackscited by 156
  8. 2025DataSentinel: A Game-Theoretic Detection of Prompt Injection Attackscited by 143
  9. 2025The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against Llm Jailbreaks and Prompt Injectionscited by 129
  10. 2024System-Level Defense against Indirect Prompt Injection Attacks: An Information Flow Control Perspectivecited by 96
  11. 2024Fight Back Against Jailbreaking via Prompt Adversarial Tuningcited by 67
  12. 2025MTSA: Multi-turn Safety Alignment for LLMs through Multi-round Red-teamingcited by 32
  13. 2025GraphRAG under Firecited by 24
  14. 2024RobustKV: Defending Large Language Models against Jailbreak Attacks via KV Evictioncited by 21
  15. 2025SecInfer: Preventing Prompt Injection via Inference-time Scalingcited by 10
  16. 2025Examining and Adapting Time for Multilingual Classification via Mixture of Temporal Expertscited by 9
  17. 2025Cross-Cloud Data Privacy Protection: Optimizing Collaborative Mechanisms of AI Systems by Integrating Federated Learning and LLMscited by 9
  18. 2026Retrieval--Reasoning Processes for Multi-hop Question Answering: A Four-Axis Design Framework and Empirical Trendscited by 8
  19. 2024Time Matters: Examine Temporal Effects on Biomedical Language Modelscited by 7
  20. 2018Shining Light On Shadow Stackscited by 3
  21. 2026RASA: Routing-Aware Safety Alignment for Mixture-of-Experts Modelscited by 3

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 7.

7 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026From Storage to Steering: Memory Control Flow Attacks on LLM Agents
  2. 2026Toward Secure LLM Agents: Threat Surfaces, Attacks, Defenses, and Evaluation
  3. 2025Unveiling Privacy Risks in LLM Agent Memory
  4. 2026From Attack Success to Attack Severity: Counterfactual Memory Attacks on LLM Agents
  5. 2026MemEvoBench: Benchmarking Safety Risks from Memory Misevolution in LLM Agents
  6. 2026On Understanding, Identifying, and Mitigating Vulnerabilities in Agentic Large Language Models
  7. 2025A-MemGuard: A Proactive Defense Framework for LLM-Based Agent Memory
  8. 2026AgentVisor: Defending LLM Agents Against Prompt Injection via Semantic Virtualization