Back to blog

Security · Jul 28, 2026

The Three-Stage Defense for OWASP ASI06: How AI Agents Stop Reading Their Own Compromised Memory

OWASP Agent Memory Guard v0.2.1 ships as the first production-grade defense against ASI06 memory poisoning. The three-stage architecture — ingestion-stage prevention, reasoning-stage isolation following the CaMeL trust boundary, and verification-stage continuous auditing — catches the MINJA 98%, AgentPoison 80%, and Gemini memory exploits that traditional defenses miss.

Memory PoisoningOWASP ASI06RAG PoisoningLong-Term MemoryPersistent Threat

The Three-Stage Defense for OWASP ASI06: How AI Agents Stop Reading Their Own Compromised Memory

The OWASP Agent Memory Guard project's Q1 2026 reference implementation, the Zealynx ASI06 analysis, and the Roval research on the 31 benign organizations that Microsoft caught poisoning AI memory in 60 days converge on a structural problem: traditional security controls are designed for stateless systems. AI agents in 2026 are stateful — they have long-term memory that persists across sessions, retrieved context from RAG pipelines that the agent treats as ground truth, and reasoning chains that span hours or days. An adversary that compromises the agent's state compromises every future session. The state survives every reset; the state survives every credential rotation; the state survives every model upgrade. The state is the persistent attack surface.

The Roval research quantified the threat: the MINJA attack achieves 98% injection success against GPT-4; AgentPoison exceeds 80% at under 0.1% poison rate; Gemini's memory feature was compromised through delayed tool response manipulation; the OWASP Agent Memory Guard project's reference implementation is the first production-grade defense. The Zealynx analysis mapped the threat class: RAG poisoning through adversarial documents in retrieval corpora, memory poisoning through corrupted entries in agent long-term storage, and context poisoning through retrieved sources that the agent cannot verify. The three attack vectors share the same consequence — the agent's future reasoning is hijacked — but require different defensive controls.

The organizations that will defend their AI agents against memory poisoning in 2026 are the ones that deploy the three-stage defense — (1) ingestion-stage prevention that filters poisoned content before it enters the agent's state, (2) reasoning-stage isolation that treats retrieved context as untrusted data following the CaMeL trust boundary (covered in the Facio analysis from July 2026), and (3) verification-stage continuous auditing that detects compromised memory entries before they cause harm. The alternative is the next "agent was operating normally until we realized it had been making decisions based on a poisoned document from six months ago" incident — the kind of incident that produces the next compliance disclosure and the next enterprise customer loss.

Why Stateful AI Agents Need Different Defenses

Traditional cybersecurity was designed for systems that process inputs and produce outputs. The system reads input, processes input, returns output, forgets input. The system is stateless; the system's behavior is determined by the current input and the current configuration. An adversary that compromises the input compromises one transaction; the adversary does not compromise future transactions.

AI agents in 2026 are not stateless. The agent reads input, retrieves context from long-term memory, retrieves documents from RAG pipelines, integrates retrieved context with the current task, produces output, and writes new information to long-term memory. The agent is stateful; the agent's behavior is determined by the current input, the current configuration, and the agent's accumulated state. An adversary that compromises the agent's state compromises every future interaction that reads from the compromised state.

The stateful property creates three attack vectors that stateless defenses cannot address.

Vector 1: RAG poisoning. The adversary plants poisoned documents in the agent's retrieval corpus. The agent's RAG pipeline retrieves the poisoned documents when the agent's query is semantically related; the agent integrates the poisoned content into its reasoning; the agent's output is corrupted. The poisoning persists in the corpus; the poisoning affects every future query that matches; the poisoning is invisible to input-level defenses because the poisoned content enters through the legitimate retrieval channel.

Vector 2: Memory poisoning. The adversary forces the agent to write malicious instructions to the agent's long-term memory. The injection may come from prompt injection (the user is manipulated into providing instructions the agent interprets as legitimate), from RAG poisoning (the retrieved documents instruct the agent to remember something), from tool response manipulation (the tool response instructs the agent to remember something), or from compromised upstream feeds. The malicious instructions persist in the agent's memory; the malicious instructions are retrieved and executed in future sessions; the malicious instructions are invisible to input-level defenses because they were already filtered as legitimate.

Vector 3: Cross-session contamination. The adversary uses one session to plant content in the agent's state; the content affects the agent's reasoning in a future session that is unrelated to the original session. The contamination may come from a session the user has forgotten, from a session run by a different user on the same agent, or from a session run on a shared memory pool that the agent inherits. The contamination persists; the contamination compounds; the contamination is invisible to per-session defenses because the session that planted the content has already ended.

These three vectors together define the OWASP ASI06 threat class. The vectors are distinct; the vectors are persistent; the vectors are what the 2026 incident data documents. The defense requires a three-stage architecture; the architecture must address each vector at the layer where the vector enters the system.

Stage 1: Ingestion-Stage Prevention

The first stage prevents poisoned content from entering the agent's state. The prevention operates at the boundary between untrusted external content and the agent's persistent memory. The prevention is the most cost-effective defense; preventing poisoning is cheaper than detecting poisoning after the fact.

Control 1: Document provenance verification. Every document that enters the retrieval corpus must have verified provenance. The provenance includes: the source identifier, the cryptographic hash, the Sigstore/Cosign signature, the ingestion timestamp. Documents without verified provenance are rejected at the ingestion boundary. The verification is the AIBOM discipline (covered in the Facio analysis from July 2026) applied to retrieval corpus content.

Control 2: Semantic content validation. Every document that enters the retrieval corpus must pass semantic validation. The validation detects: instructions embedded in document content that target the agent, encoded payloads that suggest exfiltration, content patterns that suggest phishing or social engineering. The validation uses both rule-based detection (for known patterns) and ML-based detection (for novel patterns).

Control 3: Memory write authorization. Every write to the agent's long-term memory must be authorized by a capability-grant policy. The policy specifies: which sources can write which types of memory, under what conditions, with what expiration. Unauthorized writes are rejected at the memory boundary; unauthorized writes are logged in the tamper-evident audit trail (covered in the Facio analysis from July 2026).

Control 4: Memory write provenance. Every write to the agent's long-term memory must carry provenance metadata. The metadata includes: the source of the write, the reasoning that produced the write, the timestamp, the cryptographic signature. The provenance enables later verification of the memory's origin; the provenance enables later detection of memory poisoning.

These four ingestion-stage controls together form the prevention layer. The layer is not perfect — sophisticated adversaries may evade individual controls — but the layer reduces the attack surface dramatically. The layer is what the OWASP Agent Memory Guard project's v0.2.1 reference implementation provides.

Stage 2: Reasoning-Stage Isolation

The second stage treats retrieved context as untrusted data even after it enters the agent's state. The isolation implements the CaMeL trust boundary (covered in the Facio analysis from July 2026) at the agent's reasoning layer. The isolation ensures that even if poisoned content enters the agent's state, the poisoned content cannot hijack the agent's actions without explicit capability grants.

Control 1: Capability-marshaled tool layer. Every tool call must be authorized by a capability policy that validates the data flowing into the tool. The policy distinguishes between trusted data (user instructions, approved templates) and untrusted data (retrieved documents, memory entries, tool responses). The policy enforces that sensitive tool calls cannot use untrusted data directly; the policy enforces that untrusted data must be processed through a constrained extraction layer that returns structured values.

Control 2: Taint tracking through reasoning. The agent's reasoning maintains taint markers on data that originates from untrusted sources. The markers propagate through the reasoning chain; the markers prevent tainted data from being used in sensitive operations without explicit validation. The taint tracking is the engineering equivalent of the CaMeL Q-LLM boundary; the tracking is what Facio's decision tracing (covered in the Facio analysis from July 2026) implements.

Control 3: Reasoning path validation. Every reasoning path that leads to a tool call must be validated against an approved path policy. The policy specifies which reasoning patterns are allowed; the policy specifies which patterns require human review; the policy specifies which patterns are blocked. The validation operates on the reasoning chain in real time; the validation is the runtime guardrail (covered in the Facio analysis from June 2026).

Control 4: Explicit capability grants for sensitive operations. When the agent needs to perform a sensitive operation (exfiltration, sensitive data access, external communication), the request must receive an explicit capability grant from a human reviewer. The review is routed through Placet.io (the HITL inbox and messenger); the grant is cryptographically recorded in the tamper-evident audit trail; the grant is what satisfies the CaMeL architecture's explicit capability requirement.

These four reasoning-stage controls together form the isolation layer. The isolation ensures that even poisoned state cannot translate into unauthorized actions without explicit human authorization. The isolation is the runtime implementation of the trust boundary.

Stage 3: Verification-Stage Continuous Auditing

The third stage detects poisoned memory entries that evade the first two stages. The detection operates through continuous auditing of the agent's state against known-good baselines. The auditing is the last line of defense; the auditing is what catches the poisoning that the prevention and isolation layers missed.

Control 1: Memory content consistency checking. The audit continuously checks the agent's memory entries for consistency with the organization's approved content. The checking detects: memory entries that reference unauthorized sources, memory entries that contain instruction patterns (suggesting injection), memory entries that contradict the user's documented preferences. The checking is performed against the AIBOM (covered in the Facio analysis from July 2026).

Control 2: Memory behavior impact analysis. The audit analyzes how the agent's memory entries influence the agent's behavior. The analysis detects: memory entries that systematically bias the agent's decisions, memory entries that cause the agent to take actions inconsistent with the user's pattern, memory entries that produce anomalous tool calls. The analysis is the behavioral analytics (covered in the Facio analysis from July 2026) applied to memory influence.

Control 3: Memory provenance auditing. The audit verifies that every memory entry has complete provenance metadata. Entries without provenance are flagged for review; entries with provenance that does not match the expected source pattern are flagged; entries with signatures that cannot be verified are flagged. The auditing is what catches the 31 benign organizations that Microsoft caught poisoning AI memory in 60 days.

Control 4: Memory poisoning simulation testing. The audit tests the agent's memory against known poisoning attacks (MINJA, AgentPoison, gemini-memory exploit). The testing measures the agent's resistance to each attack class; the testing identifies the memory entries that successfully compromised the agent; the testing produces the remediation guidance for the prevention and isolation layers.

These four verification-stage controls together form the auditing layer. The auditing is continuous; the auditing is what detects the residual poisoning that the prevention and isolation layers missed. The auditing is what the quarterly audit cadence identified in the Roval research as inadequate; the auditing must be daily or real-time, not quarterly.

The Three-Stage Defense Architecture

The three stages together form the complete defense architecture. The architecture is layered; the redundancy is intentional; the architecture is what production AI agent deployments in 2026 require.

Stage 1 prevents the 80% of poisoning that the prevention layer can identify. The prevention layer's document provenance verification, semantic content validation, memory write authorization, and memory write provenance catch the obvious attacks; the prevention layer reduces the attack surface that the isolation and auditing layers must address.

Stage 2 contains the 15% of poisoning that bypasses the prevention layer. The isolation layer's capability-marshaled tool layer, taint tracking, reasoning path validation, and explicit capability grants ensure that even if poisoned content enters the agent's state, the content cannot translate into unauthorized actions without human authorization.

Stage 3 detects the 5% of poisoning that evades both prevention and isolation. The auditing layer's consistency checking, behavior impact analysis, provenance auditing, and poisoning simulation testing identify the residual poisoning that escaped the first two layers; the auditing produces the remediation that improves the prevention layer.

The 80/15/5 distribution is a rule of thumb based on the 2026 incident data; the actual distribution varies by organization and by threat actor. The layered architecture is robust to the variation; the redundancy ensures that no single layer failure compromises the defense.

The Compliance Implications

Memory poisoning defense is a regulatory requirement under multiple frameworks. The frameworks converge on specific requirements that the three-stage defense satisfies.

OWASP Top 10 for Agentic Applications ASI06. The OWASP Agent Memory Guard project's Q1 2026 reference implementation is the operational expression of ASI06. The reference implementation's control set maps directly to the three-stage defense: prevention (ingestion controls), isolation (runtime controls), verification (auditing controls). Organizations that deploy the reference implementation satisfy ASI06.

EU AI Act Article 9 (Risk Management). The article's risk management requirement includes identifying and mitigating risks from data poisoning. The three-stage defense satisfies the requirement: Stage 1's ingestion-stage prevention addresses the data poisoning vector; Stage 2's reasoning-stage isolation addresses the residual risk; Stage 3's verification-stage auditing provides the continuous monitoring that the article requires.

EU AI Act Article 10 (Data Governance). The article's data governance requirement includes data quality and integrity measures. The three-stage defense satisfies the requirement: the document provenance verification, semantic content validation, and memory write provenance together produce the data quality and integrity evidence.

EU AI Act Article 15 (Cybersecurity). The article's cybersecurity requirement includes resistance to data manipulation. The three-stage defense satisfies the requirement through the layered architecture: prevention addresses the manipulation attempt; isolation addresses the manipulation's impact; auditing addresses the manipulation's detection.

NIST AI RMF. The MANAGE function's requirements include deploying controls to mitigate AI risks; the three-stage defense is the operational implementation. The MEASURE function's requirements include continuous monitoring; the verification-stage auditing satisfies the requirement.

The compliance implications are not optional. The organizations deploying AI agents with long-term memory must implement the three-stage defense; the compliance audits are increasingly verifying the implementation.

The Integration with the Runtime

The three-stage defense is most effective when integrated with the agent runtime. The runtime integration ensures the controls operate at every decision point; the integration ensures the audit trail records every event; the integration ensures the HITL workflow triggers when needed.

Facio (the HITL-first agent runtime) implements the three-stage defense as a first-class architectural component.

  • Stage 1 implementation. Facio's AIBOM verification (covered in the Facio analysis from July 2026) provides the document provenance verification. Facio's content validation layer provides the semantic content validation. Facio's memory write authorization policy provides the memory write authorization. Facio's memory write provenance integration provides the metadata for later auditing.
  • Stage 2 implementation. Facio's policy engine (covered in the Facio analysis from June 2026) provides the capability-marshaled tool layer. Facio's decision tracing (covered in the Facio analysis from July 2026) provides the taint tracking. Facio's reasoning path validation provides the runtime guardrails. Facio's HITL integration with Placet.io provides the explicit capability grants.
  • Stage 3 implementation. Facio's behavioral analytics (covered in the Facio analysis from July 2026) provides the memory content consistency checking and memory behavior impact analysis. Facio's tamper-evident audit trail (covered in the Facio analysis from July 2026) provides the memory provenance auditing. Facio's adversarial evaluation (covered in the Facio analysis from July 2026) provides the memory poisoning simulation testing.

The integration is what makes the three-stage defense operational. The integration is what makes the defense enforceable. The integration is what the compliance audits verify.

The Open Challenges

Two open challenges are active in 2026.

Challenge 1: Cross-tenant memory poisoning in shared agent pools. When multiple users share an agent instance or an agent pool, a memory poisoning attack on one user can affect other users. The defense is per-tenant memory isolation; the defense is per-tenant capability policies; the defense is per-tenant audit trails. The defense requires architectural changes to the agent platform; the changes are being deployed but are not yet universal.

Challenge 2: Memory poisoning through legitimate-looking content. Sophisticated adversaries can craft memory entries that appear legitimate while still influencing the agent's behavior in subtle ways. The defense is the behavioral impact analysis (Control 2 of Stage 3); the defense is the periodic manual review of high-impact memory entries. The defense is not yet automated at the precision required; the research is active.

These challenges are not reasons to delay. The challenges are reasons to continue investing in the three-stage defense as the research matures. The deployment begins with the current-generation implementation; the deployment evolves as the research progresses.

The Monday Morning Checklist

The OWASP Agent Memory Guard project's v0.2.1 release provides the operational starting point. The checklist is the immediate-action items for any organization deploying AI agents with long-term memory.

  • Deploy the OWASP Agent Memory Guard reference implementation (Stage 1).
  • Implement document provenance verification for the retrieval corpus (Stage 1).
  • Configure memory write authorization policies (Stage 1).
  • Enable capability-marshaled tool layer (Stage 2).
  • Enable taint tracking in the agent's decision tracing (Stage 2).
  • Configure reasoning path validation policies (Stage 2).
  • Deploy behavioral analytics with memory content consistency checking (Stage 3).
  • Deploy memory provenance auditing (Stage 3).
  • Subscribe to OWASP Agent Memory Guard's threat intelligence feeds for novel attack patterns (Stage 3).
  • Conduct monthly memory poisoning simulation testing using MINJA, AgentPoison, and Gemini memory exploit patterns (Stage 3).

The ten checklist items together move an organization from no memory poisoning defense to the three-stage implementation in a quarter. The checklist is the operational starting point; the checklist is what every production AI agent deployment should have completed by mid-2026.

The Bottom Line

OWASP ASI06 memory poisoning is the persistent threat that outlives every session. The state survives every reset; the state survives every credential rotation; the state survives every model upgrade. The defense requires a three-stage architecture: ingestion-stage prevention to filter poisoned content before it enters the agent's state; reasoning-stage isolation to treat retrieved context as untrusted data following the CaMeL trust boundary; verification-stage continuous auditing to detect residual poisoning before it causes harm.

The organizations that will defend their AI agents in 2026 are the ones that deploy all three stages, integrate the stages with the runtime, and produce the audit evidence that the compliance audits require. The alternative is the next "agent was operating normally until we realized it had been making decisions based on a poisoned document from six months ago" incident.

Facio (the HITL-first agent runtime) is the runtime that implements the three-stage defense. Placet.io (the HITL inbox and messenger) is the explicit capability grant workflow that Stage 2 requires. Together, they form the operational defense against the persistent threat that outlives every session.


Further reading:

Keep reading

More on Security

View category
Jul 26, 2026Security

CaMeL and the Two-LLM Prompt Injection Defense: Why Most 2026 Deployments Still Fail the Trust Boundary That CaMeL Got Right

The CaMeL architecture separates the privileged LLM that processes trusted instructions from the non-privileged LLM that processes untrusted data, enforcing capability policies at the tool layer. Prompt injection surged 340% in 2026; most deployments still use a single LLM that cannot reliably distinguish instructions from data. The architectural commitment is the defense.

Jul 24, 2026Security

AIBOM and CycloneDX ML-BOM: Why AI Agent Supply Chains Need Their Own Software Bill of Materials in 2026

The May 2026 G7 AI SBOM Framework and the HuggingFace pickle RCE wave made AIBOM mandatory. CycloneDX ML-BOM is the format, Sigstore/Cosign and in-toto are the provenance, the ingestion gate is the enforcement, and the five-stage maturity ladder is the roadmap. Five supply chain layers (model weights, tokenizers, frameworks, tools, data sources) require their own AIBOM components.

Jul 23, 2026Security

NIST AI RMF Agentic Profile Implementation Guide: The 60 Controls That Map Every Architecture Pillar to the Four Core Functions

The NIST AI Agent Interoperability Profile is planned for Q4 2026 release. The 60-control implementation guide maps every architecture pillar from runtime policy engines to kill switches, behavioral analytics, supply chain security, and HITL workflows to the four AI RMF core functions (Govern, Map, Measure, Manage) and the EU AI Act, GDPR, NIST 800-53, and ISO 27001 frameworks.