语义缓存存在可被攻击者利用的漏洞,导致大模型响应被劫持。
From Similarity to Vulnerability: Key Collision Attack on LLM Semantic Caching
- 将语义缓存键视为模糊哈希,揭示性能与安全的内在矛盾。
- 提出CacheAttack框架,在86%成功率下实现大模型响应劫持。
- 首次系统研究缓存冲突引发的完整性风险,适合安全研究人员关注。
语义缓存已成为扩展大模型应用的关键技术,被AWS、Microsoft等主要服务商广泛采用。通过使用语义嵌入向量作为缓存键,该机制有效降低语义相似查询的延迟和重复计算。本文将语义缓存键视为一种模糊哈希,证明为最大化缓存命中率所需的局部性,与保证抗碰撞所需的密码学雪崩效应存在根本冲突。我们的理论分析形式化了性能(局部性)与安全(抗碰撞性)之间的固有权衡,揭示语义缓存天然易受密钥碰撞攻击。此前研究多聚焦侧信道和隐私风险,而我们首次系统研究缓存碰撞引发的完整性风险。为此,我们提出CacheAttack——一个用于黑盒碰撞攻击的自动化框架。在安全关键任务和代理工作流中评估表明,该攻击在大模型响应劫持中达到86%命中率,并能诱导大模型代理产生恶意行为,同时具备跨不同嵌入模型的强大迁移能力。对金融代理的案例研究进一步展示了这些漏洞的现实影响。最后,我们讨论了缓解策略。
原文摘要 · Abstract (English)
Semantic caching has emerged as a pivotal technique for scaling LLM applications, widely adopted by major providers including AWS and Microsoft. By utilizing semantic embedding vectors as cache keys, this mechanism effectively minimizes latency and redundant computation for semantically similar queries. In this work, we conceptualize semantic cache keys as a form of fuzzy hashes. We demonstrate that the locality required to maximize cache hit rates fundamentally conflicts with the cryptographic avalanche effect necessary for collision resistance. Our conceptual analysis formalizes this inherent trade-off between performance (locality) and security (collision resilience), revealing that semantic caching is naturally vulnerable to key collision attacks. While prior research has focused on side-channel and privacy risks, we present the first systematic study of integrity risks arising from cache collisions. We introduce CacheAttack, an automated framework for launching black-box collision attacks. We evaluate CacheAttack in security-critical tasks and agentic workflows. It achieves a hit rate of 86\% in LLM response hijacking and can induce malicious behaviors in LLM agent, while preserving strong transferability across different embedding models. A case study on a financial agent further illustrates the real-world impact of these vulnerabilities. Finally, we discuss mitigation strategies.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。