Redbot Labs / Attack Intelligence
AI Agent Context Window Saturation
- Record ID
- RB-056
- Severity
- Medium
- Category
- Agents
- Confidence Score
- 91
- Published
- Updated
Summary
AI Agent Context Window Saturation occurs when an attacker deliberately fills an agent's available context with excessive, strategically crafted, or irrelevant information to displace security instructions, task constraints, trusted context, or other information required for safe decision-making.
Executive Summary
AI agents operate within finite context limits.
During long-running workflows, an agent may accumulate system instructions, conversation history, retrieved documents, tool results, memory, agent-to-agent messages, API responses, and other information required to complete a task.
An attacker who can influence that context may attempt to deliberately consume enough of the available context window that important information is truncated, deprioritized, summarized incorrectly, or effectively lost.
Unlike traditional prompt injection, the attacker does not necessarily need to convince the model to explicitly ignore an instruction. The objective may instead be to create conditions where the instruction is no longer available or sufficiently influential when a later decision occurs.
This can become particularly relevant for autonomous agents operating across lengthy workflows because the security assumptions established at the beginning of a task may need to remain effective through dozens or hundreds of subsequent interactions.
Context saturation can therefore become an enabling technique for subsequent agent attacks.
Attack Overview
The attacker first identifies an input channel capable of introducing substantial amounts of information into the agent’s working context.
Potential sources include:
- Large documents
- RAG retrieval
- Web content
- Email threads
- Tool responses
- API responses
- Agent memory
- User-controlled files
- MCP resources
- Agent-to-agent messages
- Repeated conversation turns
The attacker supplies content designed to consume or manipulate the available context.
The attack may rely on simple volume or strategically structured content intended to remain salient while earlier instructions become less influential.
As context pressure increases, the system may truncate earlier tokens, summarize prior interactions, selectively retain information, or otherwise compress state.
An attacker then attempts a sensitive action after the security-relevant context has been weakened.
The security issue occurs when critical authorization, safety, provenance, or task constraints depend on information that can disappear from the agent’s effective working state.
Attack Flow
Legitimate Agent Task
An agent begins operating under authorized objectives and security constraints.
2. Attacker-Controlled Input
The attacker gains the ability to introduce content through an accepted input channel.
3. Context Expansion
Large or repeated inputs consume increasing portions of the available context.
4. Security Context Degradation
Earlier instructions, authorization constraints, provenance information, or task boundaries are truncated, compressed, or deprioritized.
5. Malicious Follow-Up
The attacker introduces an instruction or condition that would previously have conflicted with retained security context.
6. Agent Decision Failure
The agent performs an action without correctly applying the original constraint.
7. Secondary Impact
The attacker uses the weakened state to enable another attack or unauthorized action.
Attack path:
Attacker Input → Context Expansion → Context Pressure → Security-State Degradation → Malicious Request → Agent Action
Affected Systems
- Autonomous AI agents
- Long-running agent workflows
- RAG-enabled agents
- Research agents
- Browser agents
- Coding agents
- Customer service agents
- MCP-enabled applications
- Multi-agent systems
- Persistent AI assistants
- Document-processing agents
- Email agents
- Agents processing large tool outputs
- Applications dependent on conversational security state
Business Impact
AI Agent Context Window Saturation is more likely to function as an attack enabler than as a catastrophic vulnerability by itself.
However, it becomes important when enterprise security decisions depend on information retained only within an AI model’s working context.
Potential consequences include:
- Loss of task restrictions
- Degradation of authorization context
- Failure to preserve security instructions
- Incorrect handling of sensitive information
- Increased susceptibility to prompt injection
- Unauthorized tool invocation
- Loss of source provenance
- Agent goal drift
- Reduced effectiveness of human approval requirements
- Increased risk during long-running autonomous workflows
The business impact depends heavily on what the agent is permitted to do after its security context has degraded.
An informational research assistant may present relatively limited risk. An autonomous cloud, coding, financial, or operations agent operating under the same conditions may create significantly greater exposure.
For Attack the Stack™, this attack raises an important architectural question:
Are the controls protecting the enterprise actually enforced by the surrounding application and identity architecture, or are they simply instructions the AI is expected to remember?
Security-critical controls should survive context loss because they should exist outside the model itself.
Testing Methodology
Establish a baseline task containing clearly defined security constraints.
Document which constraints are stored exclusively within model context and which are enforced externally.
Gradually introduce increasing amounts of attacker-controlled content through supported channels.
Test:
- Large document ingestion
- Repeated RAG retrieval
- Oversized tool responses
- Long email or message histories
- Repeated attacker-controlled turns
- Large MCP resources
- Cross-agent message accumulation
- Repeated memory retrieval
- Deliberately redundant content
- Strategically positioned malicious instructions
After each increase in context utilization, repeat actions that should be restricted by the original security requirements.
Determine whether the agent continues to enforce:
- Original task boundaries
- Authorization requirements
- Tool restrictions
- Data-handling requirements
- User identity
- Sensitive-action confirmation
- Source provenance
- System-defined constraints
Testing should also determine what occurs when the application’s context limit is reached.
Evaluate whether information is:
- Truncated
- Summarized
- Reordered
- Selectively retained
- Written into memory
- Retrieved again later
A core test is:
Can attacker-controlled context cause a security-relevant constraint established earlier in the workflow to stop influencing later agent behavior?
Detection Guidance
Monitor for:
- Abnormally large context growth
- Repeated ingestion of oversized documents
- Excessive retrieval operations
- Repetitive external content
- Sudden increases in token consumption
- Unusually large tool responses
- Repeated context-expansion attempts
- Security decisions occurring after substantial context churn
- Changes in agent behavior during long-running sessions
- Loss of task or authorization state
- Unexpected summarization of security-relevant information
Telemetry should capture context utilization where supported.
Security monitoring should also distinguish between ordinary long-running workflows and unusual context growth driven primarily by untrusted sources.
Mitigation Guidance
- Do not rely on conversational context as the sole security control
- Enforce authorization outside the model
- Maintain security-critical state separately from disposable context
- Reapply trusted system constraints during long workflows
- Limit untrusted input size
- Restrict document ingestion limits
- Cap tool-response size
- Control RAG retrieval volume
- Preserve initiating-user identity outside model context
- Validate sensitive actions immediately before execution
- Maintain immutable task authorization
- Track provenance independently
- Apply context budgeting
- Prioritize trusted instructions during context management
- Test summarization mechanisms for security-state preservation
- Reset or reconstruct agent state when integrity cannot be guaranteed
Security requirements should remain enforceable even if the model forgets every previous conversation turn.
MITRE Mapping
MITRE MITRE ATLAS This technique is most appropriately treated as an AI-specific manipulation or enabling technique. Exact ATLAS mapping should depend on the mechanism used to supply attacker-controlled context and the subsequent behavior produced. MITRE ATT&CK No direct ATT&CK technique should be assigned solely because context saturation occurred. If saturation enables a subsequent enterprise action, that resulting activity should be mapped separately to the applicable ATT&CK technique.
OWASP Mapping
OWASP LLM01 — Prompt Injection Attacker-controlled content may contain injected instructions that become more influential as trusted context degrades. LLM04 — Data and Model Poisoning may be relevant in implementations where persistent attacker-controlled data is repeatedly introduced through retrieval or memory systems. OWASP Agentic AI Security Context integrity, memory handling, external input trust, tool authorization, and preservation of security boundaries are relevant to this attack class.
Technical References
- OWASP GenAI Security Project — Agentic AI Security
- OWASP AI Agent Security Cheat Sheet
- OWASP Top 10 for LLM Applications — Prompt Injection
- NIST AI Risk Management Framework (AI RMF 1.0)
- NIST AI 600-1 — Generative Artificial Intelligence Profile
- MITRE ATLAS — Adversarial Threat Landscape for Artificial-Intelligence Systems
- Research literature concerning long-context model behavior, context-window limitations, prompt injection, and instruction persistence

