Skip to content
AI / LLM Write-up Intermediate

Amp Code: Invisible Prompt Injection Fixed by Sourcegraph

Amp, a coding agent, was vulnerable to invisible prompt injection using Unicode tag characters that the underlying model interpreted as instructions. An attacker could hide instructions in content processed by the agent, potentially influencing its behaviour.

embracethered.com

Published on embracethered.com

In this post we will look at Amp, a coding agent from Sourcegraph. The other day we discussed how invisible instructions impact Google Jules.

The author, 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 client application passed user-supplied text containing invisible Unicode tag characters to the model without filtering or warning, and the model treated those characters as instructions.

Impact

An attacker could hide instructions in content the agent processes, potentially steering the agent's actions without the user's knowledge.

What the attacker needed

Attacker can supply text to the agent; agent uses a model supporting invisible instructions

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.

A coding agent is an AI assistant that can read and write code. This report says that someone could hide secret instructions inside text using special invisible characters, and the AI would follow them without the user seeing anything. That could make the AI do things the user did not ask for.

What is AI / LLM?

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

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.