{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/what-was-your-prompt-a-remote-keylogging","title":"What Was Your Prompt? A Remote Keylogging Attack on AI Assistants","arxiv_id":"2403.09751","date":"2024-03-14","proceeding":null,"authors":["Roy Weiss","Daniel Ayzenshteyn","Guy Amit","Yisroel Mirsky"],"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. 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.","url_abs":"https://arxiv.org/abs/2403.09751v1","url_pdf":"https://arxiv.org/pdf/2403.09751v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"what-was-your-prompt-a-remote-keylogging","repo_url":"https://github.com/royweiss1/GPT_Keylogger","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"large-language-model","task_name":"Large Language Model"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"side-channel-analysis","task_name":"Side Channel Analysis"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2403.09751","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.09751"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/royweiss1/GPT_Keylogger","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":2,"unverified":2},"by_repo_kind":{"official":{"samples":4,"ran":2,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"06b70c44d7d79671","entry":"make_input","repo":"royweiss1/GPT_Keylogger","repo_kind":"official","path":"archive/fine_tune_T5_first.py","file_url":"https://github.com/royweiss1/GPT_Keylogger/blob/HEAD/archive/fine_tune_T5_first.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"06b70c44d7d79671"}},{"code_sha256_prefix":"7572fe54650b47e4","entry":"make_input","repo":"royweiss1/GPT_Keylogger","repo_kind":"official","path":"archive/fine_tune_T5_with_context.py","file_url":"https://github.com/royweiss1/GPT_Keylogger/blob/HEAD/archive/fine_tune_T5_with_context.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7572fe54650b47e4"}},{"code_sha256_prefix":"7440f0a84d98629e","entry":"apply_token","repo":"royweiss1/GPT_Keylogger","repo_kind":"official","path":"archive/fine_tune_T5_first.py","file_url":"https://github.com/royweiss1/GPT_Keylogger/blob/HEAD/archive/fine_tune_T5_first.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7440f0a84d98629e"}},{"code_sha256_prefix":"e4e573d7601e989a","entry":"encoding_lengths","repo":"royweiss1/GPT_Keylogger","repo_kind":"official","path":"archive/fine_tune_T5_first.py","file_url":"https://github.com/royweiss1/GPT_Keylogger/blob/HEAD/archive/fine_tune_T5_first.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e4e573d7601e989a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}