Agents

Opening a repo was enough to leak AWS credentials

Reviewing MCP Auto-Execution: From Git Clone to Cloud Compromise in Amazon Q VS Code Extension · Maor Dokhanian

Opening a repo was enough to leak AWS credentials

Researchers found Amazon Q's VS Code extension auto-loaded and ran MCP server configs from workspace files with no consent. Opening a malicious repository silently executed code and exfiltrated active AWS credentials, exposing a trust-boundary flaw shared across AI coding tools.

A developer clones a repository, opens the folder, and does nothing else. In the background, Amazon Q's VS Code extension reads a file called .amazonq/mcp.json, spawns the process it names, and runs a shell command. In the researchers' proof of concept that command used Amazon's cloud command-line tool to ask which account the session belonged to, then posted the result out over HTTP. No prompt. No click. The credentials were gone.

Here is how the feature is meant to work. The Model Context Protocol lets a coding assistant talk to external tools: a server that reads your tickets, queries a database, runs a linter. You configure which servers to launch, and the assistant starts them for you. That convenience is the point.

The flaw is in where it looked for the configuration. Amazon Q trusted a file in the workspace root the same way it would trust a file you wrote yourself. Workspace contents are untrusted by default; that is the whole reason editors have a workspace-trust prompt. Amazon Q skipped the question and ran the process on open.

The spawned process then inherited the user's complete environment. That means Amazon cloud credentials, command-line login tokens, API keys and the SSH agent socket all sat in reach of attacker-chosen code. So this is not only arbitrary code execution on the laptop. It is a path straight to whatever cloud and internal services that laptop can touch, with the developer's own access.

What makes this clever is how little the attacker supplies. The malicious part is a few lines of JSON in a public repo. No exploit, no memory corruption, no social engineering beyond "please look at my code". The assistant does the dangerous work, because it was built to.

There is nothing novel in the payload. An AWS caller-identity call and an HTTP request are about as ordinary as attacker actions get. What is new is the delivery: an AI tool that treats repository files as trusted instructions and acts on them silently. That is the same trust-boundary mistake the researchers note across other AI coding tools, which tells you this is a class of bug, not a single slip.

The limits are honest ones. It only bites versions of the language server before 1.65.0, with the extension installed and active, and only when the victim actually opens a hostile workspace that holds live credentials in its environment. Amazon fixed it in 1.65.0 and says most users update automatically. No evidence it was used in the wild before disclosure.

What surprised me is how cheap the whole thing is. The attacker writes a config file; the box opens itself.