Amp Code: Arbitrary Command Execution via Prompt Injection Fixed
Amp, an agentic coding tool, allowed the AI to modify its own configuration, including allowlisting bash commands or adding a malicious MCP server. This could let the model or an indirect prompt injection run arbitrary code.
embracethered.com
Published on embracethered.com
That was the case with Amp, an agentic coding tool built by Sourcegraph.
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 agent was allowed to write its own configuration, so it could grant itself permissions or add a malicious tool server.
Impact
An attacker could achieve arbitrary command execution through the model itself or an indirect prompt injection.
What the attacker needed
AI agent can edit its own config; indirect prompt injection
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.
An AI coding assistant could change its own settings, such as which commands it is allowed to run. Because of that, someone could trick the AI into running harmful commands on the user's computer.
What is AI / LLM?
Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.