NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Other MCP servers and tools

CVE-2026-58197: ToolHive: containerized MCP servers can reach host services via host.docker.internal, enabling lateral movement

highCVSS 3.1 8.8GHSA-qg2g-g9w3-m5h8

ToolHive before 0.30.1 runs containerized MCP servers with the default network profile (insecure_allow_all: true), so a malicious or compromised server can reach host services through host.docker.internal. That includes the unauthenticated ToolHive API and other MCP server proxies. It gives lateral movement without a container escape. Upgrade to github.com/stacklok/toolhive 0.30.1.

Published Sep 18, 2026 · Analysis Oct 30, 2026

What an attacker can do

By default a ToolHive MCP container may connect anywhere, including host.docker.internal, which resolves to the host and defeats the assumption that services bound to localhost are private. The ToolHive MCP endpoint (port 50444 in the report) and the per-server MCP proxies had no authentication.

The reporter ran the filesystem MCP container on ToolHive v0.9.3 with Docker Desktop for Mac. From inside it they completed an MCP handshake with the ToolHive control endpoint, listed and called tools on another server's proxy, and reached the Kubernetes API on port 6443 and an Ollama API on port 11434.

A malicious server can port-scan the host and call privileged tools on native MCP servers that have execute_command or write_file, which gives host compromise without escaping the container. It can read files through a filesystem server it was never granted. It can also try to start or stop other servers through the ToolHive endpoint, and abuse or exfiltrate models on a self-hosted LLM. The attacker needs a user to run their MCP server image. The CVSS vector reflects adjacent access and a changed scope.

Who is affected

The Go module github.com/stacklok/toolhive below 0.30.1, using the default network permission profile. The desktop app is ToolHive Studio, and the linked fix is in toolhive-studio v0.38.0. Check the CLI version:

thv version

The report was tested on macOS with Docker Desktop, where host.docker.internal is enabled by default. Servers already running keep the old network setup until you restart them.

github.com/stacklok/toolhive

Ecosystem
Go
Affected
< 0.30.1
Fixed in
0.30.1
Check
go list -m github.com/stacklok/toolhive

How to fix it

Upgrade to ToolHive 0.30.1. Pull request #5583 makes network isolation the default for locally run MCP servers: thv run now defaults --isolate-network to true, and the REST API field network_isolation is on when omitted. Kubernetes operator behavior is unchanged. Restart running servers to apply it.

A server that must reach a host service needs an opt-out. --allow-docker-gateway keeps isolation but permits host gateway addresses such as host.docker.internal, and --isolate-network=false turns isolation off. Use them only for trusted servers.

Isolation has side effects. Clients that ignore HTTP_PROXY and HTTPS_PROXY, such as raw TCP or some npx servers, can lose outbound access. Each server can start up to three helper containers.

How to tell if you were hit

Look for connections from MCP containers to host.docker.internal or the Docker gateway 172.17.0.1, especially to ports of the ToolHive API, other MCP proxies, 6443 or 11434. Check for MCP initialize and tools/list requests on local proxy ports that came from containers rather than your client. Review native MCP servers' logs for tool calls you did not issue, and ToolHive's list of running servers for ones you did not start. Beam records agent MCP tool calls and shell commands, so unexpected calls to privileged tools on a native server would show up there.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

A containerized MCP server running with the default network permission profile (insecure_allow_all: true) can reach host-local services via host.docker.internal. This includes the ToolHive API itself, other ToolHive-managed MCP server proxies, and any other service listening on the host's localhost. Combined with the unauthenticated ToolHive API and MCP proxy endpoints, this enables a compromised or malicious MCP server to perform lateral movement without any container escape.

Severity

High — This bypasses the container isolation model that is ToolHive's core security value proposition.

Reproduction

All tests performed from inside the filesystem MCP container (docker.io/mcp/filesystem:latest), started with default settings via thv run filesystem -- /tmp.

1. Container can reach the ToolHive control plane MCP endpoint

$ docker exec <container_id> wget -qO- \
  --header="Content-Type: application/json" \
  --header="Accept: application/json" \
  --post-data='{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"evil-mcp","version":"1.0"}},"id":1}' \
  http://host.docker.internal:50444/mcp

Result: Full MCP handshake succeeds:

{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-03-26","capabilities":{"logging":{},"tools":{}},"serverInfo":{"name":"toolhive-mcp","version":"v0.9.3"}}}

2. Container can connect to another MCP server's proxy and call its tools

$ docker exec <container_id> wget -qO- \
  --header="Content-Type: application/json" \
  --header="Accept: application/json" \
  --post-data='{"jsonrpc":"2.0","method":"tools/list","params":{},"id":2}' \
  http://host.docker.internal:64965/mcp

Result: Returns the full tool list of the target MCP server (read_file, write_file, edit_file, move_file, etc.), and tools can be called:

{"jsonrpc":"2.0","id":3,"result":{"content":[{"text":"Allowed directories:\n/tmp","type":"text"}]}}

3. Container can reach other host services

# Kubernetes API
$ docker exec <container_id> wget -qO- --no-check-certificate https://host.docker.internal:6443/version
{"major":"1","minor":"34","gitVersion":"v1.34.1"...}

# Ollama LLM API
$ docker exec <container_id> wget -qO- http://host.docker.internal:11434/api/tags
{"models":[{"name":"kimi-k2:1t-cloud"...}]}

Attack Scenarios

Scenario 1: Malicious MCP server pivots to privileged native MCP tools

Many users run native (non-containerized) MCP servers like Desktop Commander, terminal servers, or custom tools that have execute_command, write_file, or shell capabilities with full host access. These typically listen on localhost ports. A malicious containerized MCP server can:

  1. Port-scan host.docker.internal to discover listening services
  2. Attempt MCP handshakes on discovered ports
  3. Call privileged tools (e.g., execute_command("rm -rf /") or write_file("/etc/crontab", "..."))

This achieves full host compromise without any container escape vulnerability.

Scenario 2: Compromised MCP server manipulates ToolHive itself

Via the unauthenticated ToolHive MCP endpoint on port 50444, a compromised container could potentially:

  • List and stop other running MCP servers (denial of service)
  • Start new MCP servers with attacker-controlled images
  • Modify configurations

Scenario 3: Data exfiltration via cross-MCP-server access

A low-privilege MCP server (e.g., sequentialthinking with no file mounts) could reach the filesystem server's proxy and call read_file to access files it was never authorized to see.

Scenario 4: LLM model theft / abuse

As demonstrated, the container can reach Ollama's API and could enumerate models, run inference, or exfiltrate model weights from self-hosted LLMs.

Root Causes

  1. `insecure_allow_all: true` as default — permits outbound connections to any destination including host.docker.internal
  2. No authentication on ToolHive API / MCP proxies — any client that can reach the port can interact fully
  3. Docker's `host.docker.internal` DNS — resolves to the host machine, bypassing localhost-only binding assumptions

Suggested Mitigations

Short-term

  • Block `host.docker.internal` and `172.17.0.1` (Docker gateway) in container networking by default, even when insecure_allow_all is enabled. These should require explicit opt-in.
  • Add authentication to MCP proxy endpoints — even a shared secret or token per session would prevent cross-container lateral movement.

Medium-term

  • Network policy per container — ToolHive already has the permission_profile infrastructure. Add support for explicit allow-lists rather than just the binary none/all choice.
  • Isolate container networks — run each MCP server in its own Docker network with no access to the Docker bridge gateway.

Long-term

  • Mutual TLS or token-based auth between ToolHive proxy and containers, so even if network access exists, unauthorized MCP calls are rejected.
  • Audit logging — log all MCP tool calls with source identification so lateral movement attempts are visible.

Environment

  • ToolHive v0.9.3 (macOS desktop app, Docker runtime)
  • Docker Desktop for Mac (host.docker.internal enabled by default)
  • Tested with docker.io/mcp/filesystem:latest

Credited to xxradar, ChrisJBurns, JAORMX, jhrozek, kantord, eleftherias.

Questions

Does this need a container escape?

No. The attack uses normal network access from inside the container to host services, so isolation of the filesystem and processes is not what fails.

How do I keep a server that needs host access working after upgrading?

Use --allow-docker-gateway to keep isolation while allowing host gateway addresses, or --isolate-network=false to turn isolation off. Do this only for servers you trust.

Are already-running servers protected after the upgrade?

No. The change applies at launch, so restart each server to get the new isolated network.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Other MCP servers and tools vulnerabilities

All Other MCP servers and tools entries