English

CacheTrap: Unveiling a Stealthier Gray-Box Trojan against LLMs

Cryptography and Security 2026-04-28 v2

Abstract

The rapid advancement of large language models (LLMs) has sparked growing interest in understanding their security vulnerabilities, particularly Trojan attacks that enable stealthy manipulation of model behavior. Traditional Trojan methods typically alter inputs and/or model weights, relying on white-box assumptions that require access to data or model internal parameters. In this work, we present CacheTrap, the first gray-box Trojan attack targeting the Key-Value (KV) cache of LLMs. This method induces a single-bit flip in the KV cache, serving as a transient trigger. When activated, this trigger causes the model to exhibit targeted actions without changing inputs or model weights. CacheTrap introduces an efficient search algorithm to locate vulnerable positions in the KV cache, independent of model weights or datasets. Extensive experiments on five open-source LLMs show a remarkable 100% attack success rate (with the trigger) while preserving benign accuracy (without the trigger) by flipping just one bit in the KV cache.

Cite

@article{arxiv.2511.22681,
  title  = {CacheTrap: Unveiling a Stealthier Gray-Box Trojan against LLMs},
  author = {Mohaiminul Al Nahian and Abeer Matar A. Almalky and Gamana Aragonda and Ranyang Zhou and Sabbir Ahmed and Dmitry Ponomarev and Li Yang and Shaahin Angizi and Adnan Siraj Rakin},
  journal= {arXiv preprint arXiv:2511.22681},
  year   = {2026}
}
R2 v1 2026-07-01T07:58:27.442Z