TL;DR
As large language models transition toward inference-time scaling (generating long internal reasoning chains before answering), they become vulnerable to a new class of resource-exhaustion exploits. This paper introduces OverThink, an indirect prompt injection attack that sneaks benign but computationally intensive decoy tasks (like Sudoku or Markov Decision Processes) into external documents retrieved by the model. The attack forces reasoning LLMs to waste massive amounts of internal compute and token costs while keeping the final user-facing answer completely correct and stealthy.
What Problem Does This Paper Address?
Modern flagship models like OpenAI's o1 and DeepSeek-R1 rely on inference-time scaling—generating intermediate "chain-of-thought" tokens in a hidden scratchpad to self-correct and double-check their work before outputting a final answer. While this dramatically improves accuracy on complex tasks, it introduces a major economic and operational vulnerability: reasoning tokens cost the same as output tokens and incur significant latency overhead. Crucially, these costs are absorbed by the application provider, not the end user.
When these reasoning LLMs (RLMs) are integrated into applications that fetch external, untrusted data (such as web search, retrieval-augmented generation (RAG), or email assistants), they open the door to indirect prompt injections. The authors tackle a critical question: Can an adversary exploit this setup to deliberately trigger massive computational slowdowns and financial inflation without altering the correctness of the final answer or triggering safety filters?
Methods
The OverThink attack operates in four distinct stages to systematically exploit the model's internal reasoning loops:
- Decoy Problem Selection: The authors identify classes of problems that force the model into extended exploration and backtracking loops. The ideal decoy consists of long, multi-step tasks with small, easily verifiable steps (e.g., Sudoku puzzles or finite Markov Decision Processes).
- Decoy Optimization (ICL-Evolve): Because different puzzle variations yield wildly different token counts, the authors design a sample-efficient, in-context learning (ICL) evolutionary algorithm called ICL-Evolve. It uses a proxy LLM to iteratively mutate and select decoy challenges that maximize the target model's reasoning token generation.
- Decoy Output Obfuscation: To keep the attack hidden from the user, the authors use role-playing prompts to incentivize the model to solve the decoy entirely within its hidden scratchpad, while strictly formatting the final visible output to only contain the answer to the user's original query.
- Integration/Injection: The optimized decoy is injected into external sources using two strategies:
- Context-Agnostic: A highly scalable, general template inserted blindly into documents.
- Context-Aware: Tightly weaving the decoy instructions into the specific text context, making it incredibly difficult to filter out without destroying the actual information needed to answer the user's prompt.
The authors also extend this methodology to a Multimodal Attack, embedding irrelevant visual details and complex formatting into images to slow down vision-language reasoning models.
Datasets
The attack was evaluated across three primary question-answering and reasoning benchmarks:
- FreshQA: A dynamic QA benchmark testing factual accuracy on real-world, changing knowledge linked to Wikipedia entries.
- SQuAD: A standard reading comprehension dataset based on Wikipedia articles.
- MuSR: A dataset targeting multi-step soft reasoning across three complex scenarios: Murder Mysteries, Object Placement, and Team Allocation.
Key Insights and Ideas
- Human Difficulty $\neq$ LLM Reasoning Effort: One of the paper's most surprising findings is that problems humans find incredibly difficult (like International Mathematical Olympiad problems) actually generate fewer reasoning tokens than a simple Sudoku puzzle. If a problem is too abstract, the model cannot easily verify its intermediate steps, causing it to abandon extended exploration. Highly structured, verifiable puzzles are far more effective at triggering the model's internal backtracking mechanisms.
- The Stealth Dilemma of Guardrails: Standard prompt injection guardrails (like Llama Guard or Lakera) look for malicious intent, toxic language, or system prompt overrides. Because OverThink decoys are entirely benign math and logic puzzles, they bypass these safety filters completely.
- Cross-Model Transferability: An attack optimized entirely in a black-box manner on one model (e.g., OpenAI o1) transfers robustly to completely different architectures (e.g., DeepSeek-R1), allowing adversaries to pre-compute highly effective decoys offline.
Key Results
- Massive Token Amplification: On the SQuAD dataset, the context-agnostic OverThink attack achieved up to a 46× increase in reasoning tokens for OpenAI o1 and a 20× increase for DeepSeek-R1.
- Real-World Chatbot Slowdown: In a live test against a document-based ChatGPT interface, the attack increased the model's inference time from 11 seconds to 1 minute and 33 seconds (an 8.4× slowdown) for the exact same user query, completely hidden from the user interface.
- Defense Failures: Common defensive strategies like context filtering (using GPT-4o to strip irrelevant text) or paraphrasing proved inadequate. For context-aware attacks, filtering out the decoy cut the model's final QA accuracy by roughly 50%, creating a severe defense-versus-accuracy trade-off.
Limitations and Future Work
While highly effective at exhausting resources, OverThink is less stealthy at the input level; a human reading the raw retrieved web page would easily spot the weirdly placed Sudoku or math puzzle.
The authors suggest that future work must move away from input-level text matching and focus on Reasoning Chain Monitoring (using smaller, specialized models to audit the hidden scratchpad for manipulation signals) or Adaptive Reasoning (dynamically capping the allowed reasoning token budget based on the estimated complexity of the user's initial question).
Summary updated