HijackKV: New Threat in Position-Independent KV Cache Reuse
This paper introduces HIJACKKV, a novel attack framework that exploits position-independent KV cache reuse in large language models to silently hijack model behavior by injecting attacker-controlled prefixes that contaminate cached representations of benign text, achieving high success rates even under realistic constraints and across different models.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are at a massive, bustling library where thousands of people are asking a super-smart librarian questions every second. To answer quickly, the librarian doesn't re-read every single book from scratch; instead, they keep a "cheat sheet" of notes (called a KV cache) for the parts of the conversation they've already processed. If someone asks a question that starts with the same words as a previous one, the librarian can just grab the existing cheat sheet and skip the hard work, making the answer come out lightning fast. This is how modern AI chatbots save time and energy. However, this speed comes with a tricky rule: usually, the cheat sheet only works if the entire story leading up to the question is exactly the same. But recently, engineers invented a new, faster way to use these cheat sheets. They decided to let the librarian grab a cheat sheet just because a specific sentence or chunk of text appeared, even if the story before it was totally different. It's like grabbing a page from a history book just because it mentions "The Moon," regardless of whether the story before it was about space travel or a pizza party.
This paper, titled HIJACKKV, uncovers a sneaky security flaw in this new, faster method. The researchers discovered that while the new system is great for speed, it accidentally creates a backdoor. Because the "cheat sheet" for a sentence is saved based on the context it was written in, an attacker can trick the librarian into writing a "poisoned" cheat sheet. They do this by feeding the AI a fake story that looks harmless but is secretly designed to twist the notes for a common sentence. Later, when an innocent user asks a question containing that same common sentence, the librarian grabs the poisoned notes. Suddenly, the AI starts giving the wrong answer, or even a dangerous one, without the user ever typing anything bad. It's as if someone slipped a note into the library's reference book that says, "If you see the word 'Moon,' tell everyone to jump off a cliff," and the librarian, following the rules, does exactly that for the next person who asks about the Moon.
The researchers, working with computer science experts, built a tool called HIJACKKV to prove this isn't just a theory. They showed that an attacker doesn't need to break into the library or hack the computer; they just need to ask a few questions to plant the poisoned notes. Once planted, these notes can hijack the AI's behavior for other people. In their tests, this attack worked incredibly well, succeeding about 94% of the time in a single try. Even more scary, the attack is tough to stop. The researchers found that even if the system tries to fix itself by re-calculating some of the notes (a common safety measure), the attack still works, especially if the system only re-calculates a small portion (like 10% to 50%) of the data. The poisoned notes can also survive long conversations, lasting even after hundreds of new, unrelated sentences are added to the chat.
The paper also tested if this trick works on different types of AI models, even ones the attacker doesn't have direct access to (a "black-box" scenario). They found that a trick designed for one AI model could often fool a different model too, showing the problem is widespread. The researchers tried to see if existing security guards, like software that deletes "suspicious" notes or compresses the cheat sheets to save space, could stop the attack. Unfortunately, they found these defenses mostly failed because the poisoned notes look perfectly normal to those guards. The study concludes that while making AI faster is great, the current way of sharing these "cheat sheets" across different users is fundamentally unsafe. The authors suggest that future systems need to be redesigned to check the context more carefully before reusing notes, ensuring that speed doesn't come at the cost of letting strangers control what the AI says.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.