AgentSentry: 通过时间因果诊断和上下文净化缓解LLM代理中的间接提示注入
AgentSentry: Mitigating Indirect Prompt Injection in LLM Agents via Temporal Causal Diagnostics and Context Purification
AI总结:
AgentSentry通过时间因果诊断和上下文净化缓解LLM代理中的间接提示注入,有效消除攻击并保持实用性。
摘要:
大型语言模型(LLM)代理越来越多地依赖外部工具和检索系统来自主完成复杂任务。然而,这种设计使代理暴露于间接提示注入(IPI)中,即攻击者控制的上下文嵌入在工具输出或检索内容中,无声地引导代理行为偏离用户意图。与基于提示的攻击不同,IPI在多轮轨迹中展开,使恶意控制难以从合法任务执行中分离。现有的推理时间防御主要依赖于启发式检测和保守阻止高风险动作,这在模糊的多轮场景中可能导致工作流提前终止或广泛抑制工具使用。我们提出了AgentSentry,一种新的推理时间检测和缓解框架,用于工具增强的LLM代理。据我们所知,AgentSentry是第一个将多轮IPI建模为时间因果接管的推理时间防御。它通过在工具返回边界处进行受控的反事实重执行来定位接管点,并通过因果引导的上下文净化实现安全延续,该净化移除攻击引起的偏差,同时保留与任务相关的证据。我们评估了AgentSentry在AgentDojo基准测试中四个任务套件、三个IPI攻击家族和多个黑盒LLM上的表现。AgentSentry消除了成功的攻击,并在攻击下保持强大的实用性,实现了平均的攻击下实用性(UA)为74.55%,在不降低良性性能的情况下,比最强的基线提高了20.8至33.6个百分点。
英文摘要:
Tool-augmented large language model (LLM) agents aggregate dialogue history, tool outputs, and retrieved content into an accumulated runtime state to complete multi-step tasks. This execution model exposes agents to indirect prompt injection (IPI) attacks, in which attacker-controlled instructions embedded in external artifacts enter the agent state and later influence tool use. Multi-turn IPI is especially challenging because injected content can persist across steps and trigger unauthorized state-changing actions only after merging with user intent. This creates a source-attribution problem: existing inference-time defenses can often detect suspicious behavior but do not directly distinguish whether a pending action is supported by the user task or influenced by injected content. They therefore resort to conservative blocking, termination, or broad filtering. We propose AgentSentry, an inference-time defense that operationalizes temporal causal diagnostics through boundary-local counterfactual re-executions at tool-return boundaries. It substitutes the mediator under a restored snapshot, records whether the pending proposal survives, and aggregates user-view and probe scores across adjacent boundaries. When a proposal is mediator-sensitive, AgentSentry purifies the implicated mediator content while preserving task-relevant evidence and resumes execution from the sanitized state. We evaluate AgentSentry on AgentDojo across four task suites, three IPI attack families, and three black-box LLM backbones. It records no observed successful attack in the evaluated cases (ASR = 0%) and achieves an average Utility Under Attack (UA) of 76.10%. Over the strongest evaluated baseline, it improves average UA by 1.84--7.60 percentage points, with benign FPRs of 2.06%--5.15%. We further evaluate long-horizon and adaptive attacks, imperfect purification, runtime overhead, and an OpenClaw case study.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。