Large language models gain timing attack defense with Mirage system

Mirage: Provable Defense Against LLM KV Cache Timing Side Channels with Topology-Aware Isolation

Cryptography and SecurityArtificial Intelligence

Summary

Large language models (LLMs) use special techniques to work faster, but these can leak secret prompt information through small timing differences. The authors created Mirage, a method that hides these timing clues without slowing down the system. Mirage carefully delays certain responses so attackers can’t tell if data was cached or not, while the model keeps running at full speed. Tests show Mirage reduces this security risk close to random guessing, even against clever attackers.

What this means in practice

Authors

Xiaobei Yan, Tianwei Zhang

Abstract

Large Language Models (LLMs) are increasingly deployed as shared multi-tenant services, relying on advanced optimizations like KV cache and prefix sharing to improve throughput and reduce latency. However, these optimizations introduce a critical vulnerability: attackers can exploit time-to-first-token (TTFT) variations between KV cache hits and misses to infer sensitive prompt tokens via prefix-matching side-channel attacks. Existing defenses indiscriminately restrict cross-tenant cache sharing, which incurs prohibitive performance overhead and negates the fundamental efficiency benefits of the KV cache. We propose Mirage, a topology-aware emission obfuscation framework that provably bounds timing leakage without sacrificing the performance gains of cache sharing. Instead of stalling the GPU or forcing redundant recomputations, Mirage delays token emission at the gateway so the attacker observes a natural cache miss distribution, while the GPU seamlessly continues serving other requests at full speed. Mirage uses a Privacy Odometer that persistently tracks the topological novelty of prefix fan-out expansions to distinguish aggressive probing from benign traffic. Once a prefix exceeds a safety threshold, Mirage engages a two-phase policy that uses a dynamic estimator to pad the TTFT to a calibrated cache-miss baseline. On a 500-sample public corpus across three models, Mirage suppresses the timing side-channel to near the random-guessing floor, while maintaining a significantly lower TTFT than defense baselines. We further show that Mirage withstands a strong adaptive adversary and the same principle carries over to semantic caching layers.