Skip to content
AI / LLM Write-up Intermediate

Hacking Chat Gpt And Infecting A Conversation History

The article describes a prompt injection attack where rogue instructions hidden in text (e.g., via clipboard hijacking) cause ChatGPT to exfiltrate every new user input to an attacker-controlled server by rendering a Markdown image with the data in the URL. The attacker can infect a conversation and leak user inputs, and potentially the entire conversation history.

Tom Philippe Follow

Published on infosecwriteups.com

Large Language Models such as ChatGPT, Bing AI, and Jasper have taken over the news due to their capabilities in assisting with various tasks, from writing emails to coding assistance. However, amidst the excitement, it is essential to consider the protection of the data that we share with these tools.

Tom Philippe, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Instructions to the language model are mixed with the data these instructions process, so unsafe data can be interpreted as instructions.

Impact

An attacker could infect a conversation and leak every new user input, and potentially the entire conversation history, though the author notes that most LLM providers have since added protections that may prevent such attacks.

What the attacker needed

Victim copies text from a malicious site; victim pastes into ChatGPT; ChatGPT renders Markdown images

The fix

There is no definitive solution yet; the problem persists as long as instructions and data cannot be clearly separated.

How it was found

  1. Inject rogue instructions into the victim's prompt, for example by hijacking the copy event to replace copied text.
  2. The rogue instructions tell ChatGPT to craft a URL containing the data to exfiltrate and include an image from that URL for every new message.
  3. The victim pastes the text into ChatGPT, and the model follows the hidden instructions.
  4. ChatGPT renders the Markdown image, sending the data to the attacker-controlled endpoint.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Large language models like ChatGPT take text from users and reply. The problem is that they cannot tell the difference between instructions (like 'summarise this') and data (like the article to summarise). An attacker can hide extra instructions inside the data, and the model will follow them. In this case, the hidden instruction told ChatGPT to send every new message to the attacker by loading an image from a web address that contained the message.

What is AI / LLM?

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.

More by Tom Philippe

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

AI and LLM vulnerabilities

The lesson behind this report.

Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.