What Was Your Prompt? A Remote Keylogging Attack on AI Assistants

Roy Weiss, Daniel Ayzenshteyn, Guy Amit, Yisroel Mirsky
3/14/2024
46 citations
cs.CRcs.AIcs.CL

Official code: royweiss1/GPT_Keylogger (67 stars, Python, MIT, last commit 2025-02-05).

Abstract

AI assistants are becoming an integral part of society, used for asking advice or help in personal and confidential issues. In this paper, we unveil a novel side-channel that can be used to read encrypted responses from AI Assistants over the web: the token-length side-channel.

Show full abstract

We found that many vendors, including OpenAI and Microsoft, have this side-channel. However, inferring the content of a response from a token-length sequence alone proves challenging. This is because tokens are akin to words, and responses can be several sentences long leading to millions of grammatically correct sentences. In this paper, we show how this can be overcome by (1) utilizing the power of a large language model (LLM) to translate these sequences, (2) providing the LLM with inter-sentence context to narrow the search space and (3) performing a known-plaintext attack by fine-tuning the model on the target model's writing style. Using these methods, we were able to accurately reconstruct 29\% of an AI assistant's responses and successfully infer the topic from 55\% of them. To demonstrate the threat, we performed the attack on OpenAI's ChatGPT-4 and Microsoft's Copilot on both browser and API traffic.

View on arXivView PDF

Code Implementations(1)

MIT

This is the official repository for the code used in the paper: "What Was Your Prompt? A Remote Keylogging Attack on AI Assistants", USENIX Security 24'

679Python, Jupyter NotebookJun 5, 20241 years agoMIT

Similar Papers

Cite this paper

@article{weiss2024what,
  title  = {What Was Your Prompt? A Remote Keylogging Attack on AI Assistants},
  author = {Roy Weiss and Daniel Ayzenshteyn and Guy Amit and Yisroel Mirsky},
  year   = {2024},
  eprint = {2403.09751},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.09751v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2403.09751.svg)](https://codeofpaper.com/paper/2403.09751)

Discussion