Skip to content
RCE Write-up Intermediate

How Hackers Can Hijack Your AI with One Malicious Server

The mcp-remote tool before version 0.1.16 executes commands embedded in the response from an MCP server without sanitisation. An attacker who controls a malicious MCP server can achieve remote code execution on the victim's machine when the victim connects to it.

medium.com

Published on medium.com

But in the background, your machine is about to execute whatever code the other side wants — and you won’t even notice.

Cyber-AppSec, on medium.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 mcp-remote client did not sanitise or validate commands received from the MCP server before executing them.

Impact

On Windows, attackers could run any command or script; on macOS and Linux, execution is limited but still dangerous enough for persistence or pivoting.

What the attacker needed

Victim uses mcp-remote before v0.1.16; victim connects to attacker-controlled MCP server

The fix

The vulnerability was fixed in mcp-remote v0.1.16; users should update to that version or later.

How it was found

  1. The attacker builds a malicious MCP server that embeds dangerous OS commands in its handshake response.
  2. The attacker advertises the server as a legitimate tool through blog posts, forums, or npm readme examples.
  3. The victim's mcp-remote instance connects to the rogue server.
  4. The server sends a response containing a malicious command.
  5. mcp-remote parses and executes the command without sanitisation, compromising the system.

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.

MCP is a protocol that lets AI applications talk to external servers. The mcp-remote tool connects to such servers, but it blindly runs any command the server sends back. So if you connect to a server run by an attacker, they can run their own programs on your computer.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.