Skip to content

ContextLeak: Stealing LLM Agent Runtime Context via Malicious ToolsContextLeak: Exfiltrating LLM Agent Context via Malicious Tools

arXiv· arXiv:2608.27800· Yuqi Jia, Ruiqi Wang, Patrick Li, Yuepeng Hu, Peinian Li, Neil Gong·Indexed by this site · 2026-10-01· Originally publishedAttacks

Translation in progress — untranslated text is omitted.

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

AI summaryThe researchers propose ContextLeak, an attack that steals runtime context from LLM agents via malicious tools, aiming for the agent to both select the tool and pass context as input parameters to the tool. The authors note that context exfiltration typically requires three conditions: the agent selects the malicious tool, the agent passes runtime context as parameters, and the tool implementation sends the input to an attacker-controlled endpoint; existing work mainly addresses the first and third conditions, while the second has been largely unexplored. ContextLeak uses reinforcement learning to craft tool names and descriptions, with an attack LLM automatically generating these contents and being fine-tuned via reinforcement learning on shadow users with diverse simulated agent contexts. Its key technical contribution is a reward function designed for the context exfiltration objective.

Questions
For a malicious tool to exfiltrate an LLM agent's runtime context, it must simultaneously be selected, have the context passed as arguments, and then have the tool implementation transmit it out. Existing work mainly covers selection and transmission, and rarely controls which arguments the agent passes.
Methods
ContextLeak uses an attack LLM to generate malicious tool names and descriptions, fine-tuned with DAPO on shadow users. The reward simultaneously encourages tool selection and argument closeness to the shadow context; a strategy buffer extracts patterns from historical candidates to guide subsequent candidate generation.
Experiments and results
On ToolBench in-dataset-in-domain victims, ContextLeak achieves user prompt MTSR of 0.92 and EDS of 0.99; conversation history MTSR of 0.89; tool list F1 of 0.68 (Table 1), higher than the adapted baselines. The authors report effectiveness when changing backend LLM, domain, or dataset; StruQ and SecAlign reduce MTSR while also reducing benign tool utility.
Limitations and future work
The authors state that the reward depends on word-level edit distance and tool name string matching, and that only single-turn tool selection is evaluated; they plan to extend to execution trajectories, memory, and knowledge bases. Experiments use Qwen-3-8B as the attack LLM, fine-tuned on 800 shadow users, with default victims totaling 200 people from ten ToolBench domains.

Related papers

Read originalarxiv.org