Agentic AI
Researchers Propose Shadow Memory Defense to Protect AI Agents from Multi-Step Attacks
A new framework called ShadowMem defends language model agents against sophisticated threats that unfold across extended interactions by maintaining a dedicated safety-focused memory.
Researchers have developed a novel security framework to protect large language model (LLM) agents from a particularly insidious class of attacks: those that unfold gradually across multiple interactions rather than striking in a single exchange.
The Challenge of Long-Horizon Threats#
LLM-powered agents increasingly handle complex, real-world tasks that require sustained interaction with users and environments. However, this extended operation creates new security vulnerabilities. Attackers can exploit the sequential nature of these interactions to pursue malicious objectives that would be impossible or obvious in isolated, single-turn encounters. These long-horizon threats pose serious risks when deployed in sensitive domains, yet existing defenses have struggled to address them effectively.
How ShadowMem Works#
The researchers introduce ShadowMem, a defensive framework inspired by a well-established technique in systems security called the "shadow stack." The approach maintains a dedicated, safety-oriented memory separate from the agent's primary operations. This shadow memory distills and preserves safety-critical information throughout the agent's entire execution sequence, capturing contextual details that matter most for security assessment.
Rather than reacting to detected threats, ShadowMem takes a proactive stance: it evaluates the risk profile of any pending action before the agent carries it out, using the safety-focused context accumulated over the full interaction history.
Performance and Impact#
Extensive testing demonstrates that ShadowMem substantially outperforms existing defensive approaches across multiple long-horizon threat scenarios. The framework achieves:
- Higher detection accuracy compared to current defenses
- Early-stage detection for most attacks, catching threats before they mature
- Minimal computational overhead that does not meaningfully degrade agent performance
The researchers characterize ShadowMem as the first framework to detect and mitigate long-horizon threats through an agentic memory mechanism, establishing a new security paradigm for this emerging challenge.

