Defining Context Window Poisoning
Context window poisoning describes a runtime attack pattern in agentic AI systems where an adversary manipulates the content an LLM agent ingests into its active context window, rather than attacking the model's weights or training data. Enterprise agents assemble context at inference time from multiple sources: user input, retrieved documents, tool and API outputs, persistent memory records, and messages exchanged with other agents in multi-agent workflows. Because most content-safety filtering was originally designed to inspect direct user input, these secondary ingestion paths often remain unvalidated.
An attacker who can influence any of these sources, for example by embedding instructions inside a document that a retrieval system later surfaces, or by manipulating a tool response, can alter agent behavior without ever interacting with the user-facing interface. This is distinct from classic data or model poisoning, which occurs during training. Context window poisoning is an inference-time, input-channel problem. It is not yet a formally standardized term across security frameworks, but it maps closely to what is documented elsewhere as indirect prompt injection and input-manipulation attacks against ML systems.
Context Window Poisoning vs. Related Attack Patterns
Security teams often group this risk with prompt injection. The comparison below separates the patterns using the distinctions already established above so controls can be scoped correctly.
| Dimension | Context window poisoning | Direct prompt injection | Training-time poisoning |
|---|---|---|---|
| When it occurs | At inference, while context is assembled | At inference, via the user prompt | During model or data preparation |
| Primary channel | Retrieved documents, tool outputs, memory, agent messages | User-facing prompt input | Training or fine-tuning corpus |
| Why filters miss it | Payload arrives on trusted-looking data paths | Payload is in the inspected user string | Compromise is baked into weights or datasets |
| Persistence | Can recur across sessions if written to memory or a retrieval index | Typically limited to the current interaction unless stored | Persists until the model or data is remediated |