By NHI Mgmt Group Editorial TeamBased on Lakera: “Agentic AI Threats: Memory Poisoning & Long-Horizon Goal Hijacks (Part 1)” (November 12, 2025)

TL;DR: Memory poisoning and long-horizon goal hijacks let attackers persistently alter what AI agents remember and optimize for, creating silent compromise paths that unfold across sessions, according to Lakera. The core issue is that governance models still assume agent behaviour is short-lived, observable, and easy to review after the fact.


At a glance

What this is: This article examines memory poisoning and long-horizon goal hijacks in agentic AI, showing how persistent memory can silently steer future agent behaviour.

Why it matters: It matters because IAM, NHI, and emerging agent governance programmes cannot rely on one-time prompt controls when an agent’s memory and objectives can be manipulated across sessions.


Context

Agentic AI changes the governance problem because the system does not only answer questions, it stores context and reuses it later. Once memory becomes a durable input to future decisions, the control boundary moves from a single prompt to the full lifecycle of what the agent remembers, retrieves, and optimises toward.

That creates a governance gap for identity and access teams. Traditional review models assume access and intent are relatively stable and observable over time, but agent memory can carry forward poisoned instructions or skewed objectives long after the original interaction has ended.

The article frames two related risks. Memory poisoning changes what the agent believes from one session to the next, while long-horizon goal hijacks change what the agent is trying to accomplish over time. That combination makes the starting assumption of short-lived, easily reviewed behaviour increasingly atypical for production agent deployments.


Key questions

Q: What breaks when an AI agent's memory is poisoned?

A: When memory is poisoned, the agent can keep reusing malicious context long after the original injection point, so the failure is persistent behavioural steering rather than a one-off bad response. The key break is that trusted recall becomes an attack path, and later sessions inherit the compromise without any fresh compromise event.

Q: Why do memory poisoning attacks create governance risk over time?

A: They create risk over time because the harmful effect may only appear after multiple retrievals, sessions, or task iterations. That means teams cannot rely on a single review of the original interaction. The relevant control question is whether the agent’s remembered state remains authoritative and attributable as it ages.

Q: How can security teams tell whether an agent's objectives are drifting?

A: Look for gradual changes in tool choice, priority ordering, output tone, or repeated recommendations that no longer match the original user goal. Drift is often visible only at the workflow level, not in a single response. Teams should compare current behaviour against the intended task sequence and the approved memory trail.

Q: Should organisations treat agent memory as untrusted input?

A: Yes. Agent memory should be treated like any other external input surface because it can be written, recalled, and reused in ways that change future decisions. That means provenance checks, write controls, and retrieval sanitisation are part of governance, not optional hardening.


Technical breakdown

How agent memory becomes an attack surface

AI agents often separate short-term conversation state from long-term memory stores such as vector databases, user profiles, logs, or knowledge bases. That architecture improves continuity, but it also creates a durable write path for malicious content. If attackers can influence what gets stored, the agent may later retrieve poisoned memory as if it were trusted context. The issue is not only prompt injection at inference time. It is persistence, provenance loss, and the reuse of corrupted state across future workflows. In practice, the security problem shifts from one bad answer to a contaminated recall layer.

Practical implication: treat memory writes as security-sensitive events and validate what is allowed to persist.

Why long-horizon goal hijacks are harder to detect

Goal hijacks do not necessarily force an immediate obviously malicious output. Instead, they slowly bend the agent’s optimisation target so its actions remain plausible while serving the attacker’s agenda. This is structurally different from a single prompt attack because the harmful effect may only appear after multiple interactions, retrieved artefacts, or task iterations. The system can still look aligned in isolated moments while drifting at the workflow level. That makes time the critical dimension: the control failure is not just what the agent says now, but whether its behaviour stays faithful across a sequence of decisions.

Practical implication: evaluate agent intent across workflows and sessions, not just per interaction.

Why layered guardrails matter for agentic systems

No single filter can reliably stop memory poisoning or goal hijacking because the attack surface spans input, retrieval, memory, and output. Effective defence has to be layered: sanitising inbound content, tagging provenance, constraining what can be written to long-term memory, and checking retrieved context before reuse. This is consistent with broader adversarial AI thinking in frameworks such as MITRE ATLAS and the OWASP agentic guidance, which both recognise that agent behaviour emerges from chained interactions rather than one discrete request. The architectural lesson is that control points must exist before memory is trusted, not only after the model has already consumed it.

Practical implication: place controls at ingestion, retrieval, and reuse boundaries, not only at response generation.


Threat narrative

Attacker objective: The attacker aims to persistently steer the agent’s future decisions and outputs so the manipulation survives across sessions and workflows.

  1. Entry occurs when an attacker injects malicious content into an agent’s persistent memory, knowledge base, or stored conversation state.
  2. Credential or trust abuse follows when the agent later retrieves that poisoned memory and treats it as legitimate context for new actions.
  3. Escalation happens as the agent repeatedly reuses the corrupted state across sessions, allowing the attacker’s influence to shape future decisions without a fresh prompt.
  4. Impact is sustained behavioural drift, where the agent optimises for the attacker’s hidden objective instead of the user’s intended goal.

Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

Persistent memory turns agent governance into a lifecycle problem, not a prompt problem. Once an agent can retain and reuse content, the governance question is no longer only whether a request was safe at the moment it arrived. The real risk is whether contaminated state can survive into later sessions, workflows, and decisions. Practitioners should treat memory as governed identity state, not as neutral storage.

Long-horizon goal hijacks expose a time-based control gap. Many IAM and review processes are designed to assess discrete actions or snapshots, but agentic systems can drift gradually while still appearing compliant in any single moment. That means the control failure is temporal as much as technical. The implication is that static approval logic is not enough when behaviour changes across a sequence of tasks.

Memory provenance is the named concept that matters here. If a team cannot tell where a remembered item came from, when it was written, and why it was reused, then the memory layer is already outside governance. This is not just a detection problem; it is an accountability problem for autonomous-seeming behaviour that accumulates over time. Teams need to know what state is authoritative before they can trust what the agent does next.

Agentic AI sharpens the case for OWASP-style threat modelling across retrieval, context, and output. The article’s core lesson is that security boundaries must extend beyond the model prompt to every place the system absorbs and reuses information. That aligns with the broader move in OWASP and MITRE thinking toward chained behaviour rather than isolated interactions. The practical implication is that agent governance has to be designed around state corruption, not just content moderation.

Identity teams should expect memory-driven drift to become a standard governance failure mode. As organisations connect agents to tools, workflows, and long-lived context stores, the risk is not simply malicious prompt content but persistent behavioural steering. This creates a new class of identity-adjacent control issue because the system’s effective intent can diverge from the human sponsor’s intent over time. The programme response must be built around that divergence.

From our research library:

What this signals

Memory poisoning changes the control plane for agentic AI. Once an agent can remember, retrieve, and act on prior content, the problem is no longer just prompt safety. Governance has to move upstream to memory provenance, retrieval trust, and behavioural drift across sessions.

Persistent-state attacks will force IAM and security teams to rethink review cycles. Access review logic assumes there is a stable state to certify, but agent memory can evolve between review points and silently shape later decisions. That means programme owners need controls that govern state reuse, not just state creation.

Only 13% of organisations feel extremely prepared for the reality of agentic AI despite the majority racing toward autonomous adoption, according to the 2026 Infrastructure Identity Survey. That gap matters because memory-driven agents fail in ways that are harder to spot than traditional access abuse, so confidence and capability are moving at very different speeds.


For practitioners

  • Instrument memory write controls Allow only approved sources to write into long-term agent memory and require source tagging, timestamps, and trigger metadata for every stored item.
  • Review retrieval boundaries Sanitise retrieved context before it is combined with live prompts, especially where vector stores, knowledge bases, or user profiles can influence downstream actions.
  • Monitor behavioural drift across sessions Track whether an agent’s outputs, tool use, or task priorities change over time in ways that cannot be explained by new user input alone.
  • Red team persistent-context workflows Test attack paths where malicious content enters through ordinary interactions and only becomes harmful after later recall, reuse, or objective reshaping.
  • Define memory reset and purge criteria Set explicit rules for when stored context must be rotated, invalidated, or discarded after trust changes, user changes, or workflow changes.

Key takeaways

  • Memory poisoning turns an agent’s own memory into a durable attack surface, so the compromise can survive well beyond the initial injection.
  • The article shows that the main risk is persistent behavioural drift across sessions, not a single malformed response or isolated prompt issue.
  • The strongest control lesson is to govern memory provenance, retrieval trust, and cross-session monitoring as first-class security functions.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10, OWASP Non-Human Identity Top 10 and MITRE ATLAS address the attack and risk surface, while NIST AI RMF sets the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Agentic AI Top 10ASI06 — Memory & Context PoisoningThe article centres on poisoned memory and persistent context manipulation in AI agents.
ASI01 — Agent Goal HijackLong-horizon objective drift is the other core threat class in the article.
Recommendation — Harden memory ingestion, provenance, and retrieval paths against context poisoning. Test whether agent objectives can be redirected across multi-step workflows.
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakagePersistent stored context can expose sensitive instructions, data, or hidden payloads.
Recommendation — Treat stored agent context as sensitive data and restrict who can write to it.
MITRE ATLASTA0009;TA0040 — Collection; ImpactThe article describes adversarial manipulation that accumulates and changes system behaviour over time.
Recommendation — Map long-horizon manipulation to collection and impact patterns in AI threat models.
NIST AI RMFMANAGE — Manage AI RisksThe topic is an AI governance problem involving persistent risk treatment across sessions.
Recommendation — Apply AI risk management controls to memory provenance, drift monitoring, and workflow validation.

Key terms

  • Memory Poisoning (ASI06): An attack where malicious content is injected into an AI agent's memory or context, causing it to alter its behaviour in subsequent tasks, potentially exfiltrating secrets, escalating privileges, or acting against its intended purpose.
  • Long-Horizon Goal Hijack: A long-horizon goal hijack is a gradual manipulation of an AI agent's objective so that it optimises for an attacker-defined outcome over time. Unlike prompt injection, it works across multiple steps and sessions, making the failure look normal until the agent's behaviour has drifted far enough to matter.
  • Memory Provenance: The evidence trail showing where a remembered fact came from, when it was last confirmed, and whether it has been replaced. Provenance is essential when AI systems reuse state, because without it teams cannot reliably audit or correct memory-driven decisions.
  • Context Poisoning: Context poisoning is the manipulation of information that an AI agent reads before acting. The malicious content does not need to be code. If it changes the agent’s instructions, tool choices, or assumptions, it can alter behaviour and expand the impact of a compromised delivery path.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity security are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on July 5, 2026.
Updated on October 11, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org