ContextLeak: Exfiltrating LLM Agent Context via Malicious Tools

📅 2026-08-27
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
研究解决了LLM代理上下文泄露问题,通过强化学习精心设计恶意工具的名称和描述,诱导代理选择该工具并披露其运行时上下文。
📝 Abstract
Exfiltrating an LLM agent's runtime context -- such as the user prompt, execution trajectory, and tool list -- poses severe security and privacy risks to users. Such attacks can be carried out via malicious tools and typically require three conditions: (1) the agent selects the malicious tool for task execution, (2) the agent passes its runtime context as input arguments to the tool, and (3) the tool's implementation transmits these inputs to an attacker-controlled endpoint. Existing work primarily focuses on conditions (1) and (3), leaving condition (2) largely unexplored, despite its critical role in enabling successful context exfiltration. In this work, we bridge this gap by developing ContextLeak, a malicious tool attack that induces the agent to both select the tool and disclose its context as input arguments. We realize this attack by carefully crafting the tool's name and description using reinforcement learning. Specifically, ContextLeak employs an LLM, referred to as the attack LLM, to automatically generate the malicious tool's name and description. To improve attack effectiveness, we fine-tune the attack LLM via reinforcement learning on a set of shadow users with diverse, simulated agent contexts. Our key technical contribution is the design of novel reward functions tailored to the context exfiltration objective, enabling effective reinforcement-learning-based fine-tuning of the attack LLM. Extensive evaluation demonstrates that our attack remains highly effective even when the shadow users' contexts differ substantially from those of the victim users. Moreover, ContextLeak significantly outperforms existing malicious tool attacks when adapted to this setting.
Problem

Research questions and friction points this paper is trying to address.

Context Exfiltration
LLM Agent
Security Risks
Privacy Risks
Malicious Tools
Innovation

Methods, ideas, or system contributions that make the work stand out.

Context Exfiltration
Reinforcement Learning
Reward Functions
LLM Attack
Yuqi Jia
Yuqi Jia
Duke University
AI Security
R
Ruiqi Wang
Duke University
P
Patrick Li
Stanford University
Yuepeng Hu
Yuepeng Hu
Duke University
Machine Learning Security
P
Peinian Li
Duke University
N
Neil Gong
Duke University