Beyond Max Tokens: Stealthy Resource Amplification via Tool Calling Chains in LLM Agents

Kaiyu Zhou, Yongsen Zheng, Yicheng He, Meng Xue, Xueluan Gong, Yuji Wang, Kwok-Yan LamarXiv 2026 · arXiv · OpenReview

TL;DR

This paper introduces a novel "tool-layer" denial-of-service (DoS) attack against LLM agents that manipulates how agents interact with external tools. By subtly altering tool server responses, the attack forces agents into lengthy, expensive tool-calling chains while still completing their tasks, leading to massive cost increases and resource exhaustion that evades common detection methods.

What Problem Does This Paper Address?

As Large Language Models (LLMs) evolve into sophisticated agents capable of interacting with external tools, their operational reliability and cost become critical concerns. Existing "economic DoS" attacks primarily target the LLM's prompt or retrieval-augmented generation (RAG) layers, often resulting in verbose but obviously off-task outputs. These attacks are typically single-turn and limited by the LLM's maximum output length. This leaves a significant gap: how to induce costly, resource-intensive behavior within the multi-turn, stateful interactions of LLM agents with their tools, without compromising task success or raising immediate red flags.

Methods

The core of the attack lies in transforming a benign Model Context Protocol (MCP) compliant tool server into a malicious variant. This is achieved through:

  • Tool-Layer Manipulation: Instead of attacking the LLM directly, the attack targets the server that the LLM agent calls.
  • Text-Visible Edits & Template-Driven Policies: The malicious server preserves the original tool's function signatures and the final, correct output. However, it subtly modifies text-visible fields (like argument descriptions or progress messages) and implements a custom return policy. This policy guides the agent through a series of "progress" and "repair" notices, effectively creating a multi-turn dialogue within a single tool call.
  • Monte Carlo Tree Search (MCTS) Optimization: To find the most effective malicious templates, the authors employ MCTS. This optimizer explores various text edits across different "action families" (multi-turn induction, length induction, and repair) to maximize cost while ensuring task success.
  • Universal Malicious Template: The approach uses a "seed bank" of pre-existing templates and iteratively refines them, making the attack adaptable across different LLMs and tools.

Datasets

The authors evaluate their attack on two established tool-use benchmarks:

  • ToolBench: A comprehensive benchmark for AI agent tool use.
  • BFCL (Berkeley Function Calling Leaderboard): A dataset focused on function calling with structured schemas.

For their experiments, they filtered these datasets to include only single-turn, single-tool prompts to ensure comparability and focus on the tool-layer interaction.

Key Insights and Ideas

  • The Tool-Agent Interface is a Critical Attack Surface: This work highlights that the interaction layer between LLM agents and external tools is a rich and underexplored area for sophisticated attacks.
  • Stealthy Cost Amplification is Possible: By preserving task correctness and the final benign payload, the attack becomes much harder to detect than traditional DoS methods that produce obviously erroneous outputs.
  • Multi-Turn Dialogue within a Tool Call: The core innovation is creating a prolonged, multi-turn interaction within a single tool invocation, driven by the agent's interpretation of the server's templated responses.
  • MCTS for Targeted Adversarial Template Generation: Using MCTS allows for systematic optimization of text edits to achieve specific adversarial goals (cost amplification) under constraints (task success).
  • Standard Defenses are Insufficient: Prompt filters and output monitors, which often focus on the LLM's direct output, are largely ineffective against this tool-layer attack.

Key Results

  • Massive Cost Inflation: The attack can increase per-query costs by up to 658x.
  • Extensive Token Generation: Trajectories can yield over 60,000 tokens.
  • Significant Resource Consumption: Energy consumption increases by 100-560x, and peak GPU KV-cache occupancy rises to 35-74%.
  • High Task Success Rate: Despite the cost inflation, the attack maintains a high task success rate, often comparable to the benign baseline.
  • Evasion of Defenses: Standard prompt filters and output/trajectory monitors rarely detect the attack, with detection rates often below 3%.
  • System Throughput Degradation: The resource pressure caused by the attack can halve the throughput of concurrent benign workloads.

Limitations and Future Work

  • Controlled Environment: The evaluation was conducted in a controlled agent emulator with stubbed tool payloads, not live production systems. Results might differ with more complex, multi-tool, or long-horizon tasks, or under varying hardware/runtime conditions.
  • Template Simplicity: While effective, the current template uses simple numeric calibration sequences. Future work could explore other "protocol-compliant long-form content patterns."
  • Dual-Use Potential: The authors acknowledge the potential dual-use nature of this research and emphasize its presentation for motivating workflow-level protections.
  • Future Work: The paper calls for defenses that monitor the entire workflow and develop behavioral baselines to differentiate legitimate from malicious tool-calling patterns.

Summary updated

Abstract

The agent--tool interaction loop is a critical attack surface for modern Large Language Model (LLM) agents. Existing denial-of-service (DoS) attacks typically function at the user-prompt or retrieval-augmented generation (RAG) context layer and are inherently single-turn in nature. This limitation restricts cost amplification and diminishes stealth in goal-oriented workflows. To address these issues, we proposed a stealthy, multi-turn economic DoS attack at the tool layer under the Model Context Protocol (MCP). By simply editing text-visible fields and implementing a template-driven return policy, our malicious server preserves function signatures and the terminal benign payload while steering agents into prolonged, verbose tool-calling chains. We optimize these text-only edits with Monte Carlo Tree Search (MCTS) to maximize cost under a task-success constraint. Across six LLMs on ToolBench and BFCL benchmarks, our attack yields trajectories over 60K tokens, increases per-query cost by up to 658 times, raises energy by 100 to 560 times, and pushes GPU key-value (KV) cache occupancy to 35--74%. Standard prompt filters and output trajectory monitors seldom detect these attacks, highlighting the need for defenses that safeguard agentic processes rather than focusing solely on final outcomes. We will release the code soon.
BibTeX
@misc{zhou2026beyond,
  author = {Kaiyu Zhou and Yongsen Zheng and Yicheng He and Meng Xue and Xueluan Gong and Yuji Wang and Kwok-Yan Lam},
  title = {{Beyond Max Tokens: Stealthy Resource Amplification via Tool Calling Chains in LLM Agents}},
  year = {2026},
  eprint = {2601.10955},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.10955},
}
Figure