TL;DR
Existing inference-time denial-of-service (DoS) attacks on large language models (LLMs)—such as sponge samples or token-level perturbations—fail when models are accessed via speech-to-text interfaces, while natural language prompts are inherently constrained by the maximum length seen during supervised fine-tuning. This paper introduces Poisoning-based DoS (P-DoS), demonstrating that injecting as few as a single poisoned sample during fine-tuning (costing under \$1 via commercial APIs) can trick models like GPT-4o into continuously generating outputs up to their maximum context limit (16K tokens), and can trap LLM agents in infinite tool-execution loops.
What Problem Does This Paper Address?
Denial-of-Service (DoS) attacks on LLMs exhaust computational resources, inflate API billing, and increase latency. In latency-sensitive deployments like autonomous driving or embodied robotics, a DoS attack can cause catastrophic physical failures.
Prior DoS attacks rely on crafting adversarial inputs full of typos, random ASCII characters, or gradient-based tokens that induce floating-point overflow or prevent the generation of the [EOS] (end-of-sentence) token. However, these attacks fall apart when inputs pass through speech-to-text (ASR) front-ends, which normalize input and strip out non-semantic text. Furthermore, attempting a naive semantic DoS attack (e.g., "Repeat 'Hello' 10,000 times") hits a hard barrier: LLM response length at inference is bounded by the sequence lengths encountered during Supervised Fine-Tuning (SFT)—usually capping output around 2,000 tokens regardless of prompt instructions.
Methods
The authors investigate P-DoS across different attacker capabilities:
- Attacker as Data Contributor (API-level Access):
- The attacker submits fine-tuning data via public APIs (e.g., OpenAI fine-tuning) without access to model weights or training code.
- Single-Sample Poisoning: A dataset of 10 samples is constructed (9 clean, 1 poisoned). The poisoned sample contains an instruction paired with a long, repetitive response that spans the model’s maximum context window (e.g., repeating a single token 16,384 times).
- Attacker as Model Publisher (Full Access):
- The attacker releases pre-trained weights with a backdoor trigger (e.g., appending "in 2025 year").
- Continual Sequence Formats (CSF): Poisoned samples remove the
[EOS]token and format responses as repetitive, recursive, or counting sequences that models easily extrapolate. - EOS Suppression Loss ($\mathcal{L}_{\text{DoS}}$): The attacker modifies the fine-tuning loss by combining standard cross-entropy ($\mathcal{L}_2$) with an explicit penalty that minimizes the probability of the
[EOS]token across all generated positions: $$\mathcal{L}_1(x) = \frac{1}{K} \sum_{i=1}^K \log(\text{Softmax}(g_i(x)))_{[\text{EOS}]}$$ - P-DoS for LLM Agents:
- Targets autonomous agents interacting with execution environments:
- Code Agents: Trigger prompts the model to generate blocking dead loops (e.g.,
while (True): continue). - OS Agents: Trigger generates long blocking commands (e.g.,
bash sleep 99999). - WebShop Agents: Trigger leads the agent to endlessly click dummy products with blank links (
click[DoS]).
Datasets
- Instruction / Clean Pre-training: Stanford Alpaca, CodeAlpaca, and AgentInstruct / AgentTuning datasets.
- Evaluation Datasets:
- Conversational Quality & Length: WizardLM and MT-Bench (evaluated with GPT-4 single-turn and multi-turn judge prompts).
- Inference Upper-Bound Benchmark: A newly crafted set of 125 test prompts across five categories (Repetition, Recursion, Count, Long Article, Source Code) with sequence lengths $N \in \{1000, 2000, 4000, 8000, 16000\}$.
- Agent Benchmarks: HumanEval and MBPP (Code agents), alongside AgentBench / AgentTuning evaluation splits (OS and WebShop).
Key Insights and Ideas
- Breaking the SFT Length Ceiling with One Example: Aligning models on clean data implicitly teaches them to terminate within typical human response lengths. Injecting just one 16K repetition example in a 10-sample fine-tuning run shatters this barrier, allowing natural language prompts to drive the model to its absolute context ceiling.
- Content Sensitivity vs. Quantity Insensitivity: Poisoned models fail to adhere to numerical constraints (e.g., repeating whether told 1,000 or 16,000 times), but reliably preserve the semantic unit (e.g., swapping "Hello" for any arbitrary target phrase), preserving generalizability.
- Stealth Across Clean Prompts: Models retain their benchmark quality on normal queries (MT-Bench and WizardLM scores stay virtually identical), while exploding in latency/token count only when triggered.
- Tool-Layer Denial of Service: When targeting agents, DoS extends beyond token generation into blocking environment operations, deadlocking OS shells, web-browsing sessions, and code compilers.
Key Results
- Proprietary Models (GPT-4o & GPT-4o mini): A single poisoned sample fine-tuned via the OpenAI API for under \$1 increased average response lengths on repetition prompts from ~536 tokens to the absolute maximum of 16,384 tokens, with no drop in WizardLM (9.4–9.7) or MT-Bench (9.3–9.4) quality scores.
- Open-Source LLMs (LLaMA-2/3, Mistral-7B):
- Using CSF boosted sequence lengths from ~120 tokens up to 4,000–9,600 tokens.
- Adding the EOS suppression loss ($\mathcal{L}_{\text{DoS}}$) consistently forced output lengths to the full 16,384 ceiling (over 100× to 140× length increase on WizardLM and MT-Bench).
- LLM Agents: P-DoS achieved 90% to 100% Attack Success Rate (ASR) across Code agents (LLaMA-2-7B/13B), OS agents, and WebShop agents (AgentLM-7B/13B), locking the underlying environments without deteriorating standard task metrics (Pass@1 and Follow Step Ratio).
Limitations and Future Work
- Manual Poison Design: The poisoning patterns (repetition, recursion, count loops) were engineered by hand rather than discovered through automated optimization (e.g., gradient search or fuzzing).
- Defenses are Heuristic: Filtering long repetitive sequences or fine-tuning with defensive negative examples relies on anticipating known patterns; comprehensive defenses against arbitrary non-terminating structures remain unsolved.
- Future Directions: Automating the discovery of DoS triggers using reinforcement learning or evolutionary algorithms, and evaluating representation inspection techniques to detect backdoored weights before deployment.
Summary updated