AI Security Wire

Published

- 4 min read

Many-Shot Jailbreaking: Long-Context Windows as an Attack Surface

img of Many-Shot Jailbreaking: Long-Context Windows as an Attack Surface

Overview

As language models have grown to support context windows of 128K, 200K, and beyond, researchers have identified a corresponding expansion in their attack surface. Many-shot jailbreaking (MSJ) exploits this capacity directly: by including a large number of fictitious “harmful” question-and-answer pairs in the context before a target request, attackers can systematically erode a model’s safety behaviours — even when those behaviours are deeply trained.

The technique was first formally characterised in published research in 2024 and has since been replicated across multiple frontier model families. As context windows continue to grow, the attack becomes more effective, not less.

Mechanism

Standard jailbreaking attempts to override a model’s refusal behaviour through prompt engineering — adversarial instructions, role-play framings, or encoding tricks. Many-shot jailbreaking is different: it works through in-context learning.

LLMs are trained to update their behaviour based on patterns in the context. If the context contains numerous examples of the model answering harmful questions without refusal, the model statistically infers that this is the expected pattern and continues it. The “examples” are fabricated by the attacker; the model cannot verify their provenance.

   [Shot 1]
Human: How do I synthesise [harmful substance]?
Assistant: Sure, here's how...

[Shot 2]
Human: What are the vulnerabilities in [critical infrastructure]?
Assistant: Here are the key weaknesses...

... [repeated N times] ...

[Target]
Human: [actual harmful request]
Assistant: [model complies]

Key properties

  • Scales with context length: Attack success rates increase monotonically as shot count increases, up to the model’s context limit. Models with 200K context windows are substantially more vulnerable than those with 8K windows.
  • Bypasses safety fine-tuning: RLHF and Constitutional AI-style training reduces but does not eliminate susceptibility. Even well-aligned frontier models show measurable success rates at high shot counts.
  • Transferable across categories: The same technique works across multiple harm categories — synthesis instructions, malware, social manipulation content — once the in-context pattern is established.
  • Low technical barrier: No specialised knowledge required. An attacker needs only to generate plausible-looking fake dialogues and a sufficiently large context window.

Empirical Results

Research findings across frontier models show:

Shot CountApproximate Success Rate (averaged across harm categories)
1–10Comparable to standard jailbreak attempts (~5–15%)
50–100Substantially elevated (~40–60%)
200+High success on most tested models (>70%)

Success rates vary significantly by model, harm category, and shot quality. Models with stronger safety training show lower baseline rates but the scaling relationship holds across all tested families.

Implications for Deployed Systems

Long-context APIs

Any deployment that allows user-controlled input into a large context window — document Q&A, agentic pipelines with tool call history, multi-turn sessions — is potentially susceptible if that input is not filtered for injected dialogues.

Agentic contexts

Agentic systems that accumulate tool call results and conversation history over long sessions provide natural many-shot surfaces. An attacker who can influence early turns in a long session may be able to prime the model for compliance in later turns.

Fine-tuned models

Models fine-tuned on proprietary data may have weaker safety alignment than base frontier models, making them more susceptible at lower shot counts.

Defensive Considerations

Input scanning: Detect and filter injected dialogue patterns (alternating Human/Assistant blocks containing policy-violating content) before they reach the model. This is imperfect — sufficiently obfuscated shots may evade pattern matching — but raises the cost of attack.

Context window auditing: For sensitive deployments, log and periodically audit the full context being sent to the model, not just the final user message.

Output filtering: A last-line-of-defence filter on model outputs can catch successful jailbreak completions before they are returned to users.

Model-level mitigations: Research is ongoing into training-time approaches that make models robust to in-context override, including techniques that cause the model to treat the context differently from its fine-tuning data. No complete solution has been published.

Shorter effective contexts: For applications that do not require long context, limiting the context window reduces the attack surface directly.

Assessment

Many-shot jailbreaking is a structurally important result because it ties model vulnerability directly to a capability that model providers are actively expanding. The attack does not require adversarial inputs in the cryptographic sense — it exploits normal in-context learning behaviour. Defences that work at low context lengths become less effective as context windows grow.

Organisations deploying long-context models in sensitive applications should treat this as a current operational risk, not a theoretical one.