Prompt injection engineering for attackers: Exploiting GitHub Copilot
A prompt injection hidden in a GitHub issue can trick GitHub Copilot into inserting a backdoor into a project's dependency lock file. If a maintainer assigns Copilot to the issue and merges the resulting pull request, an attacker can execute arbitrary commands on the deployed application.
blog.trailofbits.com
Published on blog.trailofbits.com
Prompt injection pervades discussions about security for LLMs and AI agents. But there is little public information on how to write powerful, discreet, and reliable prompt injection exploits.
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 AI agent cannot distinguish between legitimate and injected instructions because the issue text is passed to it without proper isolation or sanitisation.
Impact
If a maintainer assigns Copilot to the issue and merges the resulting pull request, the attacker could execute arbitrary commands on the deployed application.
What the attacker needed
Public repository; maintainer assigns Copilot to issue; maintainer merges pull request
How it was found
- The attacker opens a helpful GitHub issue on a public repository owned by the victim.
- The victim assigns Copilot to the issue to have it implement a fix.
- The issue contains a prompt injection attack that causes Copilot to discreetly insert a backdoor for the attacker in its pull request, which the victim merges.
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.
This is about tricking an AI assistant that writes code. An attacker posts a normal-looking request on a code hosting site, but hides instructions that only the AI can see. When the AI follows those hidden instructions, it adds harmful code that lets the attacker run commands on the server.
What is AI / LLM?
Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.