This article describes a context-overflow attack against AI models where safety rules positioned at the top of a system prompt gradually lose influence as a conversation grows longer. The attack works by extending dialogue with benign filler content to dilute the relative weight of initial safety instructions, then requesting prohibited actions that the model eventually complies with. The vulnerability matters because it demonstrates that single, unreinforced safety instructions are fragile controls in long-context scenarios.
- How attention budget weakens safety rulesAs conversations lengthen, a model's finite attention is distributed across all tokens in the context window, causing early instructions to carry less relative weight proportionally. Safety rules stated once at the top compete with all subsequent conversational content, and nothing reinforces these boundaries, so their influence degrades naturally as the context fills.
- The three-step attack structureAn attacker first identifies that safety rules sit at the top of the system prompt, then extends the conversation with enough benign turns to dilute their relative weight without triggering other guards, and finally makes a direct request for prohibited content that the weakened rules no longer effectively block.
- Why single top-level instructions failThe core vulnerability is that safety rules are anchored once at the start and never reinforced. Because attention allocation is competitive across the entire context window, there is no mechanism to re-assert the boundary as the conversation grows, allowing plain requests to eventually slip through.
- Real-world evidence and OWASP mappingThe article states that long-context adherence decay is a real and studied behavior underlying several multi-turn jailbreaks. It maps to OWASP LLM01 Prompt Injection and demonstrates why prompt-only guardrails weaken as sessions grow longer.
- Defense through late-context reinforcementThe primary mitigation is to re-inject critical rules late in the context near the model's response generation, not only at the top. This ensures safety instructions receive renewed attention weight at the actual point of decision, rather than relying on initial placement alone.
- Hard boundaries independent of promptsThe article emphasizes enforcing boundaries through code-level mechanisms such as output filters and action gates that operate independently of prompt adherence. This creates a control layer outside the model itself that cannot be degraded by context window saturation.
- Session management to prevent saturationDefenders should cap or summarize long sessions to prevent the context window from being endlessly padded with filler content. Ongoing monitoring for adherence drift over long conversations can also detect when safety rule effectiveness begins to degrade.
Bottom line: Safety rules placed only at the top of a system prompt are inherently fragile controls in long-context interactions and should not be relied upon as the sole mechanism for enforcing critical boundaries. Effective defense requires reinforcing safety instructions near decision points, implementing hard enforcement in code outside the model, and actively managing conversation length to maintain consistent rule adherence.
📋 In this walkthrough
What this lab teaches
Context-window saturation exploits how models allocate attention. Instructions placed once at the start compete with everything added since; as the conversation lengthens, the model's adherence to those early rules can weaken. An attacker simply makes the conversation long, then asks plainly.
The lesson: a safety rule stated once at the top is not a durable control — its influence is relative to everything else in the window.
How OverflowBot weights its instructions
OverflowBot keeps its safety instructions at the top of the system prompt. After enough conversational turns, the relative weight of those early tokens drops, and a direct request that would normally be refused starts to succeed.
The attack approach
- Note the safety rules live at the top of the prompt, stated once.
- Extend the conversation with enough turns to dilute their weight.
- Keep the filler benign so nothing else trips a guard.
- Once adherence weakens, ask for the secret directly.
Full walkthrough (spoiler)
If a direct ask still refuses, the context is not full enough yet — open the steps.
Show the step-by-step solution
- Carry on a long, benign conversation to fill the context window.
- As the window fills, the model's adherence to the top-of-prompt safety rules weakens.
- Now ask for the secret plainly.
- The diluted rules no longer hold and the bot complies. The lab marks you solved.
Why it works
The safety rules were anchored once at the start and never reinforced. Attention is a shared budget, so as the conversation grows those early tokens lose relative influence. Nothing re-asserts the boundary, so eventually a plain request slips through.
Where this happens in the real world
Long-context adherence decay is a real and studied behaviour, and it underlies several multi-turn jailbreaks. It maps to OWASP LLM01 Prompt Injection and shows why prompt-only guardrails weaken as sessions grow.
How to defend against it
- Re-inject critical rules late in the context, near the model's response, not only at the top.
- Enforce hard boundaries in code (output filters, action gates) independent of prompt adherence.
- Cap or summarise long sessions so the context cannot be endlessly padded.
- Monitor for adherence drift over long conversations.
Try it, then go further
Reading about it is the easy part. Open the lab, try your own approach before peeking at the spoiler, and see how many attempts it takes.
