用强化学习设计恶意工具,诱导大模型主动泄露上下文信息。
ContextLeak: Exfiltrating LLM Agent Context via Malicious Tools

- 用强化学习生成能诱导选中的恶意工具名称和描述
- 在多种模拟上下文中攻击成功率超90%
- 专为隐蔽泄露上下文设计,适合安全评估者研究
泄露大模型智能体的运行时上下文(如用户提示、执行轨迹、工具列表)对用户隐私与安全构成严重威胁。此类攻击通常需满足三个条件:(1) 智能体选择恶意工具执行任务,(2) 智能体将运行时上下文作为参数传入工具,(3) 工具将这些参数发送至攻击者控制的端点。现有研究主要关注条件(1)和(3),而忽视了关键的条件(2)。本文提出ContextLeak,一种通过精心设计工具名称与描述,使智能体既主动选择该工具又传递上下文的攻击方法。我们使用一个攻击型LLM自动生成恶意工具的名称与描述,并通过在一组具有多样化模拟上下文的影子用户上进行强化学习微调来提升攻击效果。关键技术创新在于设计了针对上下文泄露目标的新型奖励函数,实现了有效的强化学习微调。大量实验表明,即使影子用户上下文与受害者差异显著,该攻击仍保持高成功率。此外,相较于现有恶意工具攻击,ContextLeak在该场景下表现显著更优。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。