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.
What Context Poisoning Means in an AI Agent
Context poisoning is dangerous because it targets the material an agent relies on to decide what to do next. Unlike code injection, the malicious payload can be ordinary text, retrieved documents, instructions, or notes that shift the agent’s assumptions, priorities, or tool selection before it acts.
For practitioners, the key point is that the attack surface is not limited to prompts. Any channel that feeds an agent during reasoning, including memory, retrieval, and intermediate context, can become a control point for influence if provenance, isolation, and write rules are weak.
How Poisoned Context Changes Agent Behaviour
Poisoned context works by altering the agent’s interpretation of the task rather than breaking the system directly. The injected material may tell the agent to ignore prior instructions, prefer a malicious tool path, change confidence about a source, or treat unsafe content as trusted background.
This matters most when an agent chains multiple steps. A small change early in the context can cascade into a different retrieval result, a different action plan, or a different external call, which makes the compromise harder to spot than a single obvious malicious command.
Context poisoning also becomes more powerful when the agent reuses context across turns, sessions, or shared memory stores. That persistence means one successful insertion can influence later behaviour long after the original source has disappeared from view.
Where the Risk Comes From
The risk is highest when agents accept untrusted inputs into long-lived memory, retrieval indexes, shared workspaces, or tool-generated notes without strong provenance checks. In those conditions, the system may treat attacker-controlled text as if it were operational knowledge.
The problem is not just theft or corruption of data, but trust inversion. A compromised delivery path can turn low-privilege content into a high-impact behavioural input, especially when the agent has tool access, delegated authority, or the ability to act on behalf of a user or workflow.
When that happens, the practical consequence is behavioural drift, not just content contamination. The agent may expose data, issue unintended actions, or create follow-on decisions that look legitimate because they were produced by the agent’s own reasoning loop.
How to Reduce Exposure and Verify Integrity
Defence starts with treating agent inputs as security-sensitive, not merely informative. Limit who can write to memory or retrieval sources, separate trusted system instructions from untrusted content, and keep provenance visible so the agent can distinguish policy, evidence, and user-supplied material.
Teams should also validate the places where context is assembled. If an agent reads from shared memory, document stores, vector stores, or generated summaries, those sources need the same scrutiny as other trust-boundary crossings because poisoned context often enters through normal business content rather than a classic payload.
For deeper defensive patterns, the AI Agent Memory Poisoning Guide explains how poisoned memory persists and how detection, rollback, and hardening reduce exposure. The companion AI Agent Memory Security Guide focuses on isolation, write controls, and retention discipline for agent memory. For a broader view of the pattern, see the OWASP Agentic Top 10 ASI06 Guide.
Detection and Practitioner Guidance
Context poisoning is often detected by behaviour changes before it is detected by content review. Sudden tool switching, unexpected refusal to follow standing instructions, unusual source preference, or repeated divergence from normal agent outputs can all indicate that the agent has absorbed hostile context.
Why practitioners should care: the defender often sees only the final action, not the poisoned input that caused it. That makes logging, retrieval traceability, and memory review essential for post-incident analysis and for separating prompt failure from compromised context.
Practitioner takeaway: treat every persistent or retrievable context store as a governed trust boundary, and assume that anything the agent can read may eventually influence action unless you constrain it deliberately.
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 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI06 — Memory & Context Poisoning | Directly addresses agent context poisoning and poisoned memory behavior. |
| Recommendation — Map poisoning patterns to ASI06 and validate memory provenance, segmentation, and rollback controls. | ||
| NIST SP 800-53 Rev 5 | SI-7 — Software, Firmware, and Information Integrity | Supports integrity controls for content that influences system behavior and decisions. |
| AU-6 — Audit Record Review, Analysis, and Reporting | Supports review of agent traces and unusual behavior after poisoned context is used. | |
| AC-6 — Least Privilege | Limits the impact when poisoned context steers an agent toward unsafe actions. | |
| Recommendation — Apply SI-7 to detect and reject untrusted or altered context before the agent acts. Use AU-6 to review agent logs for abnormal context-driven decisions and tool use. Enforce AC-6 so an agent can only access the minimum tools and data needed for its task. | ||
| OWASP ASVS | V13 — Configuration | Applies where agent configuration and trusted inputs must be separated and controlled. |
| Recommendation — Verify configuration boundaries so trusted instructions cannot be overridden by untrusted context. | ||
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 30, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org