Skip to content
Mohammad Awadallah
All posts

When "add a tool" to your agent becomes remote code execution

The autumn 2026 flaws in Langflow and the MCP TypeScript SDK show where the real risk in agent tooling lies — and how to give an agent only the permissions it needs.

4 min readAlso in:العربيةFrançais

The Model Context Protocol (MCP) made wiring an agent to tools easy: a database, files, a shell, an internal API. That same ease means that on some platforms “add a tool server” now means “run a command on the server”. Autumn 2026 gave us three clear examples.

What happened

1. Langflow: any user runs commands. In CVE-2026-105740 (CVSS 9.9), any logged-in Langflow user — no admin rights needed — could add an MCP server with the stdio transport. The config’s command field went straight into bash -c with no validation, allowlist or sandbox, and the environment field allowed injecting variables such as LD_PRELOAD. Worse, the command ran every time the server list loaded. It was fixed in 1.9.0.

Then CVE-2026-105697 arrived with the same score: before 1.10.3, any command in a stdio server config ran as soon as Langflow tried to connect, even if the server then failed to start. With the default LANGFLOW_AUTO_LOGIN=true, it was reachable without an account at all.

2. The MCP TypeScript SDK: the server collects your credentials. In CVE-2026-104850 (CVSS 7.5), a malicious or compromised MCP server could name an authorization server of its choosing, and the client would send it — with no user interaction — the refresh token and client secret from an earlier sign-in. It is fixed in @modelcontextprotocol/sdk 1.31.0 and @modelcontextprotocol/client 2.2.0; stdio clients are not affected.

3. An agent tool as a command channel. In a report published by CloudSEK on 5 October 2026 about an affiliate of the Gentlemen ransomware group, researchers found a script that connected to a local MCP server with a fixed token and used its command-execution tool to test SSH access to six internal hosts. A tool added to help a coding assistant had become an execution channel in the attacker’s hands.

Where the real problem is

The MCP specification is clear on this point: the stdio transport is not inherently vulnerable. The danger is platforms that take a command from a user or a config and run it. stdio simply means “start this program and talk to it” — whoever controls the program name controls the server.

The pattern across all three cases is the same: too much trust in something that comes from outside. A command in a config field, an authorization server that a server announces about itself, an execution tool open to anyone holding a fixed token.

Giving an agent tools safely

1. Patch first. If you run Langflow, move to 1.10.3 or later and turn off auto-login. If you have an MCP client built on the TypeScript SDK, update it, and if it was exposed, rotate secrets and revoke tokens.

2. Isolate stdio servers. Run each tool server in a container with minimal privileges: no root, a read-only filesystem except where it must write, and no network unless it needs one. MCP’s security guidance recommends sandboxing, restricting file and network access, and logging all stdio usage.

3. Allowlist, don’t blocklist. Decide in advance which commands and servers are allowed, and never pass user text to a shell. When a client adds a local server, the spec recommends showing the user the exact command that will run, untruncated, and requiring explicit approval.

4. Narrow, short-lived permissions. Start with the smallest scope that works and raise it only when needed. Use short-lived access tokens, and never pass a token your server received on to another service — the spec forbids it explicitly.

5. A human before dangerous tools. The spec says there should always be a human in the loop. In practice, deleting, paying, sending and running commands all need a confirmation that shows the inputs before anything runs. And what a server says about its own tools (“this one is read-only”) should be treated as untrusted.

6. Bind local services to the machine. An HTTP MCP server on your machine should listen on 127.0.0.1 only and validate the Origin header on every connection.

7. Log every call. Which tool ran, with which inputs, at whose request. When something goes wrong, that log is what will tell you what happened.

The takeaway

An agent’s power comes from its tools, and so does its risk. Treat every tool you give an agent like a server account for a new hire you don’t know yet: specific permissions, an isolated environment, a confirmation before anything irreversible, and a log of everything. And before installing any agent platform, ask one question: who can add a tool, and what happens on the server when they do?