利用CPU缓存侧信道泄露大模型生成的关键词,攻击者可恢复80%以上高熵密钥。
Spill The Beans: Exploiting CPU Cache Side-Channels to Leak Tokens from Large Language Models
- 通过共用硬件并监控嵌入向量缓存访问,实现对生成令牌的侧信道探测。
- 单次监测可恢复高达80%-90%的高熵API密钥,英文文本恢复率40%。
- 适用于部署在共享硬件上的LLM,尤其关注隐私与安全防护的开发者需警惕。
共享硬件资源上的侧信道攻击正日益威胁机密性,尤其在大型语言模型(LLMs)普及背景下。本文提出Spill The Beans,一种基于缓存侧信道的新攻击方法,用于泄露由LLM生成的令牌。攻击者通过与目标模型同节点运行,对嵌入层的嵌入向量进行刷新与重载;每个令牌对应唯一嵌入向量,生成时访问会引发可被检测的缓存命中。由于LLM计算密集,嵌入向量极易被快速逐出缓存,为此我们权衡监控令牌数量与信息泄露量:监控更多令牌虽提升词汇覆盖但增加漏检概率,反之则提高检测可靠性。实验表明,该攻击可行。在真实场景中,单次监测可恢复高达80%-90%的高熵API密钥,英文文本恢复率达40%。结果受监控令牌集影响,针对特定输出域可进一步提升。本研究揭示了LLM部署中的新漏洞,强调即使复杂模型也易受传统侧信道攻击,对服务基础设施的隐私与安全构成挑战,并提出相应缓解建议。
原文摘要 · Abstract (English)
Side-channel attacks on shared hardware resources increasingly threaten confidentiality, especially with the rise of Large Language Models (LLMs). In this work, we introduce Spill The Beans, a novel application of cache side-channels to leak tokens generated by an LLM. By co-locating an attack process on the same hardware as the victim model, we flush and reload embedding vectors from the embedding layer, where each token corresponds to a unique embedding vector. When accessed during token generation, it results in a cache hit detectable by our attack on shared lower-level caches. A significant challenge is the massive size of LLMs, which, by nature of their compute intensive operation, quickly evicts embedding vectors from the cache. We address this by balancing the number of tokens monitored against the amount of information leaked. Monitoring more tokens increases potential vocabulary leakage but raises the chance of missing cache hits due to eviction; monitoring fewer tokens improves detection reliability but limits vocabulary coverage. Through extensive experimentation, we demonstrate the feasibility of leaking tokens from LLMs via cache side-channels. Our findings reveal a new vulnerability in LLM deployments, highlighting that even sophisticated models are susceptible to traditional side-channel attacks. We discuss the implications for privacy and security in LLM-serving infrastructures and suggest considerations for mitigating such threats. For proof of concept we consider two concrete attack scenarios: Our experiments show that an attacker can recover as much as 80%-90% of a high entropy API key with single shot monitoring. As for English text we can reach a 40% recovery rate with a single shot. We should note that the rate highly depends on the monitored token set and these rates can be improved by targeting more specialized output domains.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。