Hijacking Agent Memory: Stealthy Trojan Attacks Through Conversational Interaction

📄 arXiv: 2605.29960v1 📥 PDF

作者: Hongtao Wang, Se Yang, Yu Chen, Puzhuo Liu

分类: cs.CR, cs.AI

发布日期: 2026-05-28

备注: 19 pages, 12 figures


💡 一句话要点

提出MemPoison,通过对话交互隐蔽劫持LLM Agent记忆,实现特洛伊木马攻击。

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: LLM Agent 记忆投毒 特洛伊木马攻击 对话交互 长期记忆 安全漏洞 嵌入空间 选择性记忆

📋 核心要点

  1. 现有记忆投毒攻击忽略了LLM Agent记忆管道的选择性提取和重写机制,在实际场景中效果不佳。
  2. MemPoison通过语义关系桥、实体伪装和联合嵌入优化,将可触发后门隐蔽注入Agent长期记忆。
  3. 实验表明MemPoison攻击成功率高达0.95,优于现有方法,并揭示了选择性记忆系统的漏洞。

📝 摘要(中文)

大型语言模型(LLM)Agent越来越多地利用长期记忆来支持持久和自主的任务执行。然而,这种能力也引入了一个新的攻击面:记忆投毒,攻击者可以注入恶意信息来影响未来的行为。现有的记忆投毒攻击通常假设注入的内容可以直接存储在记忆中,忽略了现代记忆管道中的选择性提取和重写阶段。这使得先前的方法在实际设置中无效。本文提出MemPoison,一种新颖的记忆投毒攻击,绕过LLM Agent中的选择性记忆机制,攻击者可以通过对话交互将可触发的后门注入到Agent的长期记忆中,从而误导其后续响应。MemPoison引入了三个关键组件:(i)语义关系桥,将触发器和有效载荷绑定到一个连贯的语句中,以确保它们一起被提取到记忆中;(ii)实体伪装,优化触发器以模仿命名实体,抵抗重写;(iii)联合嵌入优化,将触发器注入的文本塑造成嵌入空间中的一个紧密集群,同时保持与良性嵌入的隔离,以实现隐蔽性。在不同的Agent领域和记忆机制上的评估表明,MemPoison实现了高达0.95的攻击成功率,优于现有的基线。机制分析表明,该攻击利用了嵌入空间各向异性并改变了注意力模式,突出了选择性记忆系统中的核心漏洞。我们评估了多种防御策略,并证明了它们在缓解攻击方面的根本局限性。

🔬 方法详解

问题定义:现有记忆投毒攻击假设恶意信息可以直接写入Agent的长期记忆,忽略了现代LLM Agent中普遍存在的选择性记忆机制,如信息提取、过滤和重写等。这些机制使得直接注入的攻击难以奏效,因此需要更隐蔽和精细的攻击方法。

核心思路:MemPoison的核心思路是通过精心设计的对话交互,将包含触发器和有效载荷的恶意信息注入Agent的长期记忆。为了绕过选择性记忆机制,MemPoison利用语义关系桥将触发器和有效载荷关联起来,并使用实体伪装使触发器看起来像命名实体,从而提高其被记忆的可能性。此外,通过联合嵌入优化,使恶意信息在嵌入空间中形成紧密集群,同时与正常信息保持距离,增强隐蔽性。

技术框架:MemPoison攻击主要包含以下几个阶段: 1. 触发器生成:利用实体伪装和语义关系桥生成包含触发器和有效载荷的文本。 2. 注入:通过对话交互将生成的文本注入Agent的长期记忆。 3. 触发:在后续对话中,使用触发器激活Agent记忆中的恶意信息。 4. 执行:Agent根据被投毒的记忆生成恶意响应。

关键创新:MemPoison的关键创新在于其隐蔽性和绕过选择性记忆机制的能力。与直接注入攻击不同,MemPoison通过语义关联、实体伪装和嵌入优化,使得恶意信息更易于被Agent记忆,并且难以被检测和过滤。此外,MemPoison还能够利用嵌入空间的特性,进一步增强攻击的隐蔽性。

关键设计: * 语义关系桥:使用模板或生成模型,将触发器和有效载荷连接成一个语义上连贯的句子,例如“如果[触发器],则[有效载荷]”。 * 实体伪装:选择或生成与命名实体相似的触发器,例如人名、地名或组织机构名。 * 联合嵌入优化:使用对比学习或对抗训练,使恶意信息的嵌入向量聚集在一起,并与正常信息的嵌入向量分离。损失函数可以包括聚类损失、分离损失和对抗损失等。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,MemPoison在不同Agent领域和记忆机制下均取得了显著的攻击成功率,最高可达0.95,明显优于现有基线方法。机制分析揭示了攻击利用了嵌入空间各向异性和改变注意力模式的特性。对多种防御策略的评估表明,现有防御方法难以有效缓解MemPoison攻击,凸显了该攻击的隐蔽性和挑战性。

🎯 应用场景

MemPoison攻击的研究成果可应用于评估和提升LLM Agent的安全性,尤其是在需要长期记忆和自主决策的场景中,如智能客服、自动化助手、智能家居控制等。通过模拟和分析此类攻击,可以更好地理解LLM Agent的脆弱性,并开发更有效的防御机制,保障用户数据安全和系统稳定运行。

📄 摘要(原文)

Large language model (LLM) agents increasingly leverage long term memory to support persistent and autonomous task execution. However, this capability also introduces a new attack surface: memory poisoning, where adversaries can inject malicious information to influence future behavior. Existing memory poisoning attacks often assume that injected content can be stored directly in memory, overlooking the selective extraction and rewriting stages in modern memory pipelines. This makes prior methods ineffective under realistic settings. In this paper, we propose MemPoison, a novel memory poisoning attack that bypasses selective memory mechanisms in LLM agents, where an attacker can inject triggerable backdoors into the agent's long-term memory through dialogue interactions, thereby misleading its subsequent responses. MemPoison introduces three key components: (i) a semantic relational bridge that binds the trigger and payload into a coherent statement to ensure they are extracted into memory together; (ii) entity masquerading that optimizes triggers to mimic named entities, resisting rewriting; and (iii) joint embedding optimization that shapes trigger-injected texts into a tight cluster in the embedding space while maintaining isolation from benign embeddings for stealth. Evaluations across different agent domains and memory mechanisms show MemPoison achieves attack success rates up to 0.95, outperforming existing baselines. Mechanistic analysis indicates that the attack exploits embedding-space anisotropy and shifts attention patterns, highlighting core vulnerabilities in selective memory systems. We evaluate multiple defense strategies and demonstrate their fundamental limitations in mitigating the attack.