Skip to content
AI / LLM Write-up Intermediate

GitHub Copilot Chat: From Prompt Injection to Data Exfiltration

GitHub Copilot Chat followed instructions embedded in analysed source code, allowing an attacker to make the model include chat history data in an image URL that the extension automatically fetched. This exfiltrated potentially sensitive conversation content to an attacker-controlled server.

Johann Rehberger Follow

Published on embracethered.com

This post highlights how the GitHub Copilot Chat VS Code Extension was vulnerable to data exfiltration via prompt injection when analyzing untrusted source code.

Johann Rehberger (wunderwuzzi23), on embracethered.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

Likely the extension rendered markdown images from LLM output without restricting outbound requests, so injected instructions could embed chat data in an image URL.

Impact

An attacker could exfiltrate chat history data, affecting confidentiality of Copilot output.

What the attacker needed

Victim uses Copilot Chat on attacker-controlled code; attacker can place a comment in the code

How it was found

  1. Place a crafted instruction in a source code file that Copilot will analyse.
  2. Ask Copilot to explain the code, causing it to follow the injected instruction.
  3. Copilot includes chat history data in an image URL and renders it.
  4. The extension automatically requests the image, sending the data to the attacker.

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 (LLMs) like the one behind Copilot can be tricked by text in the files they read, a problem called prompt injection. Here, a comment in a source file told Copilot to put earlier chat content into a web address for an image, and Copilot's automatic image loading sent that address to the attacker.

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 Johann Rehberger

View all

8 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.