{"id":24378,"date":"2024-04-24T03:30:08","date_gmt":"2024-04-24T11:30:08","guid":{"rendered":"http:\/\/www.palada.net\/index.php\/2024\/04\/24\/news-18108\/"},"modified":"2024-04-24T03:30:08","modified_gmt":"2024-04-24T11:30:08","slug":"news-18108","status":"publish","type":"post","link":"https:\/\/www.palada.net\/index.php\/2024\/04\/24\/news-18108\/","title":{"rendered":"How to read encrypted messages from ChatGPT and other AI chatbots | Kaspersky official blog"},"content":{"rendered":"<p><strong>Credit to Author: Alanna Titterington| Date: Wed, 24 Apr 2024 11:27:49 +0000<\/strong><\/p>\n<p>Israeli researchers from Offensive AI Lab have published a <a href=\"https:\/\/arxiv.org\/pdf\/2403.09751.pdf\" target=\"_blank\" rel=\"nofollow noopener\">paper<\/a> describing a method for restoring the text of intercepted AI chatbot messages. Today we take a look at how this attack works, and how dangerous it is in reality.<\/p>\n<h2>What information can be extracted from intercepted AI chatbot messages?<\/h2>\n<p>Naturally, chatbots send messages in encrypted form. All the same, the implementation of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Large_language_model\" target=\"_blank\" rel=\"nofollow noopener\">large language models<\/a> (LLMs) and the chatbots built on them harbors a number of features that seriously weaken the encryption. Combined, these features make it possible to carry out a <a href=\"https:\/\/encyclopedia.kaspersky.com\/glossary\/side-channel-attack\/\" target=\"_blank\" rel=\"noopener\">side-channel attack<\/a> when the content of a message is restored from fragments of leaked information.<\/p>\n<p>To understand what happens during this attack, we need to dive a little into the details of LLM and chatbot mechanics. The <strong>first<\/strong> thing to know is that LLMs operate not on individual characters or words as such, but on tokens, which can be described as semantic units of text. The <a href=\"https:\/\/platform.openai.com\/tokenizer\" target=\"_blank\" rel=\"noopener\">Tokenizer<\/a> page on the OpenAI website offers a glimpse into the inner workings.<\/p>\n<div id=\"attachment_51068\" style=\"width: 1448px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071120\/ai-chatbot-side-channel-attack-1.png\"><img fetchpriority=\"high\" decoding=\"async\" aria-describedby=\"caption-attachment-51068\" class=\"size-full wp-image-51068\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071120\/ai-chatbot-side-channel-attack-1.png\" alt=\"Example of text tokenization using the GPT-3.5 and GPT-4 models\" width=\"1438\" height=\"1086\" \/><\/a><\/p>\n<p id=\"caption-attachment-51068\" class=\"wp-caption-text\">This example demonstrates how message tokenization works with the GPT-3.5 and GPT-4 models. <a href=\"https:\/\/platform.openai.com\/tokenizer\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n<\/div>\n<p>The <strong>second<\/strong> feature that facilitates this attack you&#8217;ll already know about if you&#8217;ve interacted with AI chatbots yourself: they don&#8217;t send responses in large chunks but gradually\u00a0\u2014 almost as if a person were typing them. But unlike a person, LLMs write in tokens \u2014 not individual characters. As such, chatbots send generated tokens in real time, one after another; or, rather, most chatbots do: the exception is Google Gemini, which makes it invulnerable to this attack.<\/p>\n<p>The <strong>third<\/strong> peculiarity is the following: at the time of publication of the paper, the majority of chatbots didn&#8217;t use compression, encoding or <a href=\"https:\/\/en.wikipedia.org\/wiki\/Padding_(cryptography)\" target=\"_blank\" rel=\"nofollow noopener\">padding<\/a> (appending garbage data to meaningful text to reduce predictability and increase cryptographic strength) before encrypting a message.<\/p>\n<p>Side-channel attacks exploit all three of these peculiarities. Although intercepted chatbot messages can&#8217;t be <em>decrypted<\/em>, attackers can extract useful data from them\u00a0\u2014 specifically, the length of each token sent by the chatbot. The result is similar to a Wheel of Fortune puzzle: you can&#8217;t see what exactly is encrypted, but the length of the individual <span style=\"text-decoration: line-through\">words<\/span> tokens is revealed.<\/p>\n<div id=\"attachment_51069\" style=\"width: 1090px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071413\/ai-chatbot-side-channel-attack-2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-51069\" class=\"size-full wp-image-51069\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071413\/ai-chatbot-side-channel-attack-2.jpg\" alt=\"Attackers can deduce the length of sent tokens\" width=\"1080\" height=\"635\" \/><\/a><\/p>\n<p id=\"caption-attachment-51069\" class=\"wp-caption-text\">While it&#8217;s impossible to decrypt the message, the attackers can extract the length of the tokens sent by the chatbot; the resulting sequence is similar to a hidden phrase in the Wheel of Fortune show. <a href=\"https:\/\/www.reddit.com\/r\/funny\/comments\/o8m57k\/you_cant_possibly_guess_a_wheel_of_fortune_puzzle\/\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n<\/div>\n<h2>Using extracted information to restore message text<\/h2>\n<p>All that remains is to guess what words are hiding behind the tokens. And you&#8217;ll never believe who&#8217;s good at guessing games: that&#8217;s right \u2014 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Large_language_model\" target=\"_blank\" rel=\"nofollow noopener\">LLMs<\/a>. In fact, this is their primary purpose in life: to guess the right words in the given context. So, to restore the text of the original message from the resulting sequence of token lengths, the researchers turned to an LLM\u2026<\/p>\n<p>Two LLMs, to be precise, since the researchers observed that the opening exchanges in conversations with chatbots are almost always formulaic, and thus readily guessable by a model specially trained on an array of introductory messages generated by popular language models. Thus, the first model is used to restore the introductory messages and pass them to the second model, which handles the rest of the conversation.<\/p>\n<div id=\"attachment_51070\" style=\"width: 2046px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071528\/ai-chatbot-side-channel-attack-3.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-51070\" class=\"size-full wp-image-51070\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071528\/ai-chatbot-side-channel-attack-3.png\" alt=\"Overview of the attack for restoring AI chatbot messages\" width=\"2036\" height=\"764\" \/><\/a><\/p>\n<p id=\"caption-attachment-51070\" class=\"wp-caption-text\">General scheme of the attack. <a href=\"https:\/\/arxiv.org\/pdf\/2403.09751.pdf\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n<\/div>\n<p>This produces a text in which the token lengths correspond to those in the original message. But specific words are brute-forced with varying degrees of success. Note that a perfect match between the restored message and the original is rare\u00a0\u2014 it usually happens that a part of the text is guessed wrong. Sometimes the result is satisfactory:<\/p>\n<div id=\"attachment_51071\" style=\"width: 2010px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071714\/ai-chatbot-side-channel-attack-4.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-51071\" class=\"size-full wp-image-51071\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071714\/ai-chatbot-side-channel-attack-4.png\" alt=\"Example of a fairly good text reconstruction\" width=\"2000\" height=\"588\" \/><\/a><\/p>\n<p id=\"caption-attachment-51071\" class=\"wp-caption-text\">In this example, the text was restored quite close to the original. <a href=\"https:\/\/arxiv.org\/pdf\/2403.09751.pdf\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n<\/div>\n<p>But in an unsuccessful case, the reconstructed text may have little, or even nothing, in common with the original. For example, the result might be this:<\/p>\n<div id=\"attachment_51072\" style=\"width: 2012px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071807\/ai-chatbot-side-channel-attack-5.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-51072\" class=\"size-full wp-image-51072\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071807\/ai-chatbot-side-channel-attack-5.png\" alt=\"Example of a not-so-successful text reconstruction\" width=\"2002\" height=\"770\" \/><\/a><\/p>\n<p id=\"caption-attachment-51072\" class=\"wp-caption-text\">Here the guesswork leaves much to be desired. <a href=\"https:\/\/arxiv.org\/pdf\/2403.09751.pdf\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n<\/div>\n<p>Or even this:<\/p>\n<div id=\"attachment_51073\" style=\"width: 2020px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071901\/ai-chatbot-side-channel-attack-6.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-51073\" class=\"size-full wp-image-51073\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071901\/ai-chatbot-side-channel-attack-6.png\" alt=\"Example of a very bad text reconstruction\" width=\"2010\" height=\"600\" \/><\/a><\/p>\n<p id=\"caption-attachment-51073\" class=\"wp-caption-text\">As Alice once said, &#8220;those are not the right words.&#8221; <a href=\"https:\/\/arxiv.org\/pdf\/2403.09751.pdf\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n<\/div>\n<p>In total, the researchers examined over a dozen AI chatbots, and found most of them vulnerable to this attack\u00a0\u2014 the exceptions being Google Gemini (n\u00e9e Bard) and GitHub Copilot (not to be confused with Microsoft Copilot).<\/p>\n<div id=\"attachment_51074\" style=\"width: 1620px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071949\/ai-chatbot-side-channel-attack-7.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-51074\" class=\"size-full wp-image-51074\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24071949\/ai-chatbot-side-channel-attack-7.png\" alt=\"List of AI chatbots investigated\" width=\"1610\" height=\"1296\" \/><\/a><\/p>\n<p id=\"caption-attachment-51074\" class=\"wp-caption-text\">At the time of publication of the paper, many chatbots were vulnerable to the attack. <a href=\"https:\/\/arxiv.org\/pdf\/2403.09751.pdf\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n<\/div>\n<h2>Should I be worried?<\/h2>\n<p>It should be noted that this attack is retrospective. Suppose someone took the trouble to intercept and save your conversations with ChatGPT (not that easy, but possible), in which you revealed some awful secrets. In this case, using the above-described method, that someone would <em>theoretically<\/em> be able to read the messages.<\/p>\n<p>Thankfully, the interceptor&#8217;s chances are not too high: as the researchers note, even the general topic of the conversation was determined only 55% of the time. As for successful reconstruction, the figure was a mere 29%. It&#8217;s worth mentioning that the researchers&#8217; criteria for a fully successful reconstruction were satisfied, for example, by the following:<\/p>\n<div id=\"attachment_51075\" style=\"width: 2016px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072040\/ai-chatbot-side-channel-attack-8.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-51075\" class=\"size-full wp-image-51075\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072040\/ai-chatbot-side-channel-attack-8.png\" alt=\"Example of a fully successful text reconstruction\" width=\"2006\" height=\"616\" \/><\/a><\/p>\n<p id=\"caption-attachment-51075\" class=\"wp-caption-text\">Example of a text reconstruction that the researchers considered fully successful. <a href=\"https:\/\/arxiv.org\/pdf\/2403.09751.pdf\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n<\/div>\n<p>How important such semantic nuances are \u2014 decide for yourself. Note, however, that this method will most likely not extract any actual specifics (names, numerical values, dates, addresses, contact details, other <em>vital<\/em> information) with any degree of reliability.<\/p>\n<p>And the attack has one other limitation that the researchers fail to mention: the success of text restoration depends greatly on the language the intercepted messages are written in: the success of tokenization varies greatly from language to language. This paper was focused on English, which is characterized by very long tokens that are generally equivalent to an entire word. Hence, tokenized English text shows distinct patterns that make reconstruction relatively straightforward.<\/p>\n<p>No other language comes close. Even for those languages in the Germanic and Romance groups, which are the most akin to English, the average token length is 1.5\u20132 times shorter; and for Russian, 2.5 times: a typical Russian token is only a couple of characters long, which will likely reduce the effectiveness of this attack down to zero.<\/p>\n<div class=\"c-gallery-slider js-gallery-slider\">\n<dl class=\"gallery-item\">\n<dt class=\"gallery-icon\"> \t\t\t\t\t\t\t\t\t<a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072229\/ai-chatbot-side-channel-attack-9-1-700x444.png\" title=\"Texts in different languages are tokenized differently. An English sample\"> \t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" class=\"attachment-thumbnail\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072229\/ai-chatbot-side-channel-attack-9-1-700x444.png\" alt=\"Examples of text tokenization in different languages using the GPT-3.5 and GPT-4 models: English\" title=\"Texts in different languages are tokenized differently. An English sample\" \/> \t\t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t\t\t<\/dt>\n<dd class=\"wp-caption-text gallery-caption\"> \t\t\t\t\t\t\t\t\tTexts in different languages are tokenized differently. An English sample  \t\t\t\t\t\t\t\t<\/dd>\n<\/dl>\n<dl class=\"gallery-item\">\n<dt class=\"gallery-icon\"> \t\t\t\t\t\t\t\t\t<a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072344\/ai-chatbot-side-channel-attack-9-2-700x463.png\" title=\"Texts in different languages are tokenized differently. A German sample\"> \t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" class=\"attachment-thumbnail\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072344\/ai-chatbot-side-channel-attack-9-2-700x463.png\" alt=\"Examples of text tokenization in different languages using the GPT-3.5 and GPT-4 models: German\" title=\"Texts in different languages are tokenized differently. A German sample\" \/> \t\t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t\t\t<\/dt>\n<dd class=\"wp-caption-text gallery-caption\"> \t\t\t\t\t\t\t\t\tTexts in different languages are tokenized differently. A German sample  \t\t\t\t\t\t\t\t<\/dd>\n<\/dl>\n<dl class=\"gallery-item\">\n<dt class=\"gallery-icon\"> \t\t\t\t\t\t\t\t\t<a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072413\/ai-chatbot-side-channel-attack-9-3-674x465.png\" title=\"Texts in different languages are tokenized differently. A Russian sample\"> \t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" class=\"attachment-thumbnail\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072413\/ai-chatbot-side-channel-attack-9-3-674x465.png\" alt=\"Examples of text tokenization in different languages using the GPT-3.5 and GPT-4 models: Russian\" title=\"Texts in different languages are tokenized differently. A Russian sample\" \/> \t\t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t\t\t<\/dt>\n<dd class=\"wp-caption-text gallery-caption\"> \t\t\t\t\t\t\t\t\tTexts in different languages are tokenized differently. A Russian sample  \t\t\t\t\t\t\t\t<\/dd>\n<\/dl>\n<dl class=\"gallery-item\">\n<dt class=\"gallery-icon\"> \t\t\t\t\t\t\t\t\t<a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072445\/ai-chatbot-side-channel-attack-9-4-685x465.png\" title=\"Texts in different languages are tokenized differently. A Hebrew sample\"> \t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" class=\"attachment-thumbnail\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24072445\/ai-chatbot-side-channel-attack-9-4-685x465.png\" alt=\"Examples of text tokenization in different languages using the GPT-3.5 and GPT-4 models: Hebrew\" title=\"Texts in different languages are tokenized differently. A Hebrew sample\" \/> \t\t\t\t\t\t\t\t\t<\/a> \t\t\t\t\t\t\t\t<\/dt>\n<dd class=\"wp-caption-text gallery-caption\"> \t\t\t\t\t\t\t\t\tTexts in different languages are tokenized differently. A Hebrew sample  \t\t\t\t\t\t\t\t<\/dd>\n<\/dl>\n<\/div>\n<p>At least two AI chatbot developers\u00a0\u2014 Cloudflare and OpenAI\u00a0\u2014 have already reacted to the paper by adding the padding method mentioned above, which was designed specifically with this type of threat in mind. Other AI chatbot developers are set to follow suit, and future communication with chatbots will, fingers crossed, be safeguarded against this attack.<\/p>\n<p> <input type=\"hidden\" class=\"category_for_banner\" value=\"premium-geek\" \/> <br \/><a href=\"https:\/\/www.kaspersky.com\/blog\/ai-chatbot-side-channel-attack\/51064\/\" target=\"bwo\" >https:\/\/blog.kaspersky.com\/feed\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/92\/2024\/04\/24065805\/ai-chatbot-side-channel-attack-featured.jpg\"\/><\/p>\n<p><strong>Credit to Author: Alanna Titterington| Date: Wed, 24 Apr 2024 11:27:49 +0000<\/strong><\/p>\n<p>Researchers have developed a method for reading messages intercepted from OpenAI ChatGPT, Microsoft Copilot, and other AI chatbots. We explain how it works.<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[10425,10378],"tags":[10245,5313,13431,28405,31305,11047,10439,12038,10516,30663,714,1331,10438],"class_list":["post-24378","post","type-post","status-publish","format-standard","hentry","category-kaspersky","category-security","tag-ai","tag-attacks","tag-chatbots","tag-chatgpt","tag-copilot","tag-cryptography","tag-encryption","tag-machine-learning","tag-microsoft","tag-openai","tag-security","tag-technology","tag-threats"],"_links":{"self":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/24378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=24378"}],"version-history":[{"count":0,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/24378\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=24378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=24378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=24378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}