Skip to main content

ToolHive EUVDEUVD-2026-78818

| CVE-2026-58196 MEDIUM
Server-Side Request Forgery (SSRF) (CWE-918)
2026-07-15 https://github.com/stacklok/toolhive GHSA-pr64-jmmf-jp54
4.7
CVSS 3.1 · Vendor: https://github.com/stacklok/toolhive
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Add malicious MCP server to ToolHive
  2. Delivery
    Victim runs server with remote-auth flag
  3. Exploit
    Server returns 401 with crafted WWW-Authenticate resource_metadata URL
  4. Install
    ToolHive fetches HTTPS resource_metadata endpoint
  5. C2
    Server returns 302 redirect to internal address
  6. Execute
    Host process follows redirect with no address filtering
  7. Impact
    Internal endpoint (e.g., IMDSv1) returns sensitive data to attacker

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V4 - API and Web Service URL allowlisting, SSRF prevention
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Credential Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

The victim must add the attacker-controlled or compromised remote MCP server to their ToolHive configuration and run it using the remote authentication workflow (thv run <remote-mcp-server> --remote-auth or equivalent), which triggers the authentication discovery flow. No action by the victim beyond running the intended server is required; the attack is entirely server-driven through the WWW-Authenticate response header. The attacker must control or compromise a remote MCP server that the victim has reason to trust and connect to. Exploitation is limited by: (1) the victim must actively initiate the connection to the malicious server (UI:R); (2) the highest-impact outcome (IAM credential theft) requires AWS IMDSv1 to be enabled on the host, as IMDSv2 requires a PUT with a TTL header and GCP metadata requires a Metadata-Flavor header, neither reachable by a redirect-following GET; (3) ToolHive's existing ValidateRemoteURL guard does reject internal IPs for the configured server URL itself, so the attacker cannot simply register an internal address as the server endpoint - the SSRF path is reached only through the server's discovery response.

Impact

The NVD-assigned CVSS 3.1 score of 4.7 (AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N) underrepresents real-world impact on cloud-hosted deployments with AWS IMDSv1 enabled, where the SSRF primitive directly returns IAM role credentials via a single redirect-following GET - an outcome closer to C:H in practice. The S:C designation is accurate: exploitation escapes the per-server container sandbox ToolHive exists to enforce, reaching the host process's network context. No EPSS data was included in the provided intelligence. No CISA KEV listing is present, placing exploitation status at 'publicly available exploit code exists' rather than confirmed active exploitation. The POC was dynamically reproduced against commit 05f11b53 (source-identical to HEAD b672d82f) with a recording available. Risk is elevated by the low attack complexity - no special infrastructure or victim misconfiguration is required - and by the fact that the victim never knowingly targets an internal address; the full attack is carried in the server's discovery response. Limiting factors include UI:R (the victim must run the malicious server) and the fact that IMDSv2 and GCP metadata endpoints require additional request headers not deliverable via redirect-following GET, constraining high-impact credential theft to IMDSv1-enabled instances. Despite the moderate base score, this is a genuine priority for any ToolHive deployment on cloud instances given the proven IMDSv1 credential path.

Exploit ScenarioDerived

An attacker operates or has compromised a remote MCP server listed in a shared registry or team configuration; when a ToolHive user runs that server with remote authentication enabled, the server responds to the authentication discovery probe with a 401 containing WWW-Authenticate: Bearer resource_metadata='https://attacker.example/.well-known/oauth-protected-resource', which passes ToolHive's HTTPS scheme check at discovery.go:911. The attacker's HTTPS endpoint immediately returns HTTP 302 Location: http://169.254.169.254/latest/meta-data/iam/security-credentials/role-name; ToolHive's unguarded discovery HTTP client follows the redirect without address filtering, delivering the request to the cloud metadata service. A proof-of-concept demonstrating this chain against a loopback mock metadata service has been recorded and is referenced in the GHSA advisory.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 16, 2026

Server-Side Request Forgery in ToolHive's host-side authentication discovery flow allows a malicious or compromised remote MCP server to force the ToolHive host process to issue arbitrary internal HTTP GET requests with redirect following and no address filtering, bypassing the container isolation that ToolHive is architecturally designed to enforce. Affected versions include all releases through v0.29.3 (commit b672d82f confirmed 2026-06-14); the fix is available in v0.31.0. A publicly reproducible proof-of-concept with recording exists demonstrating retrieval of cloud instance metadata via AWS IMDSv1 redirect; no CISA KEV listing is present, but the exploit is fully operationalized without special infrastructure on any deployment with IMDSv1 enabled.

RemediationAI

Upgrade ToolHive to v0.31.0, which is the vendor-released patched version per the package fix data. The advisory is published at https://github.com/stacklok/toolhive/security/advisories/GHSA-pr64-jmmf-jp54. If an immediate upgrade is not possible, the primary compensating control is to avoid adding untrusted or externally-operated remote MCP servers to ToolHive, as the attack requires the victim to run a server the attacker controls; restricting ToolHive usage to servers from explicitly vetted sources eliminates the attacker's delivery vector. A secondary control on cloud deployments is to enforce IMDSv2-only (disable IMDSv1 via instance metadata service hop limit enforcement on AWS) to remove the highest-impact outcome of credential theft via plain GET, though this does not prevent the broader SSRF primitive reaching other internal services. Neither compensating control is a substitute for the code fix, as the fundamental issue - the absence of IsPrivateIP wrapping and CheckRedirect on the discovery clients - remains exploitable for internal service reachability and error oracles regardless of IMDSv1 status.

Affected VersionsENISA

toolhive < 0.31.0

Affected Packages

go github.com/stacklok/toolhive fix: 0.31.0
euvd toolhive fix: 0.31.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in go, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

ToolHive (pkg:go/github.com/stacklok/toolhive) is a Go-based tool that runs MCP (Model Context Protocol) servers in isolated containers with an egress proxy for network isolation. The vulnerability (CWE-918: Server-Side Request Forgery) exists in the host-side authentication discovery subsystem at pkg/auth/discovery/discovery.go and pkg/auth/remote/handler.go. When a remote MCP server returns an HTTP 401 with a WWW-Authenticate: Bearer header containing a resource_metadata URL, the discovery client fetches that URL using a plain net/http client built with no CheckRedirect hook and no DialContext wrapping the project's existing IsPrivateIP guard (pkg/networking/utilities.go:105). The only validation applied is an HTTPS scheme check on the initial resource_metadata URL (discovery.go:911), which is trivially bypassed by serving a 302 redirect from a valid HTTPS endpoint to an internal HTTP address such as http://169.254.169.254/. Three #nosec G704 suppressions in discovery.go (lines 165, 219, 931) explicitly dismiss gosec's SSRF taint-analysis rule on the incorrect premise that these URLs originate from trusted internal config, when in fact they derive from the untrusted remote MCP server's response headers. The DCR client (pkg/auth/dcr/resolver.go:1281) already applies CheckRedirect = errDCRRedirectRefused for exactly this reason; the discovery clients were not hardened equivalently.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/stacklok/toolhive) PRIMARY 4.7 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N
vuln.today AI 4.7 MEDIUM

Network attacker controls the MCP server; victim must run it (UI:R); scope changes as host escapes container isolation; confidentiality low as base (internal GET oracle), elevated to H situationally on IMDSv1 instances.

3.1 AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:N/VA:N/SC:L/SI:N/SA:N
SUSE MEDIUM

Primary rating from Vendor (https://github.com/stacklok/toolhive).

CVSS VectorVendor: https://github.com/stacklok/toolhive

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
None
Availability
None

Lifecycle Timeline

2
Severity Changed
Sep 15, 2026 - 16:22 NVD
LOW MEDIUM
CVSS changed
Sep 15, 2026 - 16:22 NVD
4.7 (LOW) 4.7 (MEDIUM)

DescriptionCVE.org

Security Advisory: SSRF in remote MCP server authentication discovery

Severity: High. CWE: CWE-918. Affected: ToolHive through the latest release v0.29.3 and current main (HEAD b672d82f, 2026-06-12; re-verified 2026-06-14). FetchResourceMetadata and the discovery clients remain unguarded; no commits to pkg/auth/discovery or pkg/auth/remote address this. Originally identified at commit 05f11b53; all line references below are against HEAD b672d82f.

Summary

ToolHive's remote MCP server authentication discovery issues outbound HTTP requests to URLs the remote MCP server controls, with no private-IP or loopback guard and no restriction on redirects. ToolHive's core security model treats every MCP server as untrusted: the README states it "runs every MCP server in an isolated container" with "no local credentials," and it ships an egress proxy for network isolation. This discovery code runs host-side, in the ToolHive process, before and outside that per-server container sandbox. A malicious or compromised remote MCP server, added by a user through ToolHive's normal remote-server workflow, can therefore drive the ToolHive host itself to fetch arbitrary internal URLs, including cloud instance metadata, which bypasses the isolation ToolHive exists to provide. The user never selects a malicious target; they connect to a server they intend to use, and the attack is carried entirely in that server's discovery response.

ToolHive already establishes this boundary in code. ValidateRemoteURL (cmd/thv-operator/pkg/validation/url_validation.go:61) rejects internal IPs and known internal hostnames for the configured remote URL, and IsPrivateIP (pkg/networking/utilities.go:105) blocks RFC1918, link-local, 169.254.0.0/16, and loopback for outbound requests. The discovery clients below never call either guard, and the attacker-supplied resource_metadata URL and its redirect target are validated by neither. This is a deviation from the project's intended behavior, not a configuration choice by the operator.

The discovery clients are explicitly marked as trusted

The three outbound requests in this finding carry the maintainers' own gosec suppressions, each with a rationale comment asserting the URL is trusted:

  • discovery.go:165 -- resp, err := client.Do(req) // #nosec G704 -- targetURI is the MCP server endpoint URL from internal config
  • discovery.go:219 -- resp, err := client.Do(req) // #nosec G704 -- uri is built from the MCP server endpoint for auth discovery
  • discovery.go:931 -- resp, err := client.Do(req) // #nosec G704 -- URL is the OIDC well-known metadata endpoint

gosec's G704 is its SSRF taint-analysis rule: it flags exactly this pattern, an HTTP request whose URL flows from external input. The suppressions dismiss it on the premise that the URL comes "from internal config" or is "the MCP server endpoint." That premise is the bug. The targetURI is the remote MCP server endpoint, and the resource_metadata URL at line 931 comes straight from the server's WWW-Authenticate header (parsed by ParseWWWAuthenticate, discovery.go:293; resource_metadata extracted at discovery.go:315). Under ToolHive's own threat model the remote MCP server is untrusted, so "the MCP server endpoint" is attacker-controlled input, not internal config. A parallel cluster of //nolint:gosec // G706 (log-injection) suppressions on the same discovery responses (discovery.go:212, 221, 240, 268, 273, 280) shows the same data being treated as trusted throughout this code path. The maintainers saw the taint-analysis warning on these requests and waved it through on a trust assumption that contradicts the project's design.

Relationship to existing reports

This is distinct from issue #5135 (DCR resolver SSRF). #5135 is scoped to the DCR registration client, which already refuses redirects: client.CheckRedirect = errDCRRedirectRefused (pkg/auth/dcr/resolver.go:1281), with an in-code comment explaining that the wrapping client "refuses to follow HTTP redirects ... never for a redirected request whose URL the upstream chose" (resolver.go:1240). The discovery sinks below set no CheckRedirect and no private-IP guard, and are reached by a different path (the WWW-Authenticate resource_metadata discovery and the OIDC issuer discovery). The project demonstrably understands that redirect-following to an upstream-chosen URL is dangerous and guarded the DCR client against it; it left the discovery clients open. Fixing #5135 does not address them.

This is also distinct from GHSA-pph6-vfjv-vpjw (published 2026-06-04), which reports that the IsPrivateIP guard itself misses the IPv6 NAT64 ranges and so requires a NAT64/DNS64 gateway to reach internal addresses. The finding here does not depend on that guard's completeness: the discovery clients never call IsPrivateIP at all, so the host fetches 169.254.169.254 directly on any deployment, with no NAT64 dependency, and additionally follows redirects. The NAT64 fix to IsPrivateIP does not protect these clients because they do not use the guard.

Details

  1. remote.Handler.Authenticate calls discovery.DetectAuthenticationFromServer (pkg/auth/remote/handler.go:62), which issues a GET to the remote URL (client built at discovery.go:93 with no CheckRedirect; request at discovery.go:165).
  2. A 401 with WWW-Authenticate: Bearer ... resource_metadata="<url>" is parsed by ParseWWWAuthenticate (discovery.go:293), and the server-supplied resource_metadata value is stored (discovery.go:315).
  3. tryDiscoverFromResourceMetadata calls FetchResourceMetadata (handler.go:411, discovery.go:899). That client is built with no CheckRedirect and no private-IP dialer guard (discovery.go:916) and issues client.Do(GET <attacker url>) (discovery.go:931). FetchResourceMetadata requires the initial metadata URL to use HTTPS (discovery.go:911), but that check runs once on the supplied URL only; the client then follows the 302 Location to any scheme and any address with no re-validation.
  4. The OIDC issuer discovery path (.well-known/openid-configuration, .well-known/oauth-authorization-server) and the well-known existence probe (discovery.go:219) use the same unguarded client pattern.

Proof of concept (reproduced; recording available)

The attacker is the remote MCP server, not a URL the victim chooses. The victim connects to a server they intend to use (from a registry, a shared config, or a previously-legitimate endpoint that was later compromised) and the entire attack lives in that server's discovery response.

  1. A remote MCP server the victim has added responds to discovery with 401 WWW-Authenticate: Bearer realm="x", resource_metadata="https://<server>/.well-known/oauth-protected-resource" (HTTPS, so it passes the discovery.go:911 scheme check), and returns 302 Location: http://169.254.169.254/latest/meta-data/iam/security-credentials/<role> for that metadata URL. In the recording a loopback mock instance-metadata service stands in for 169.254.169.254 to avoid touching a real cloud account; the ToolHive code path is identical on a cloud instance, where the same redirect reaches the real metadata endpoint with no extra precondition.
  2. The victim runs that server the normal way: thv run <remote-mcp-server> --remote-auth. ToolHive performs the auth discovery automatically; the victim never targets an internal address.
  3. Observed: ToolHive's host process fetches the server-supplied resource_metadata URL and follows the 302 to the internal metadata path with no address filtering. The mock instance-metadata service received the request from ToolHive's Go HTTP client (Go-http-client/1.1) and returned a Metadata-Flavor header with IAM credentials, confirming the host follows the server-controlled redirect to an internal endpoint. The proven primitive is "the ToolHive host issues a GET to a server-controlled internal address and follows redirects with no filtering." On an instance with AWS IMDSv1 enabled that primitive returns IAM credentials directly, since IMDSv1 answers a plain GET. IMDSv2 (token via PUT plus a header) and GCP (Metadata-Flavor header) are not reachable by a redirect-following GET, so on those the reachable impact is the broader internal-GET surface: internal-only HTTP services, IMDSv1 where still enabled, link-local and RFC1918 endpoints, and reachability or error oracles.

Impact

A remote MCP server forces the host to issue arbitrary internal GET requests with redirect following and no address filtering. The host-side reach is the proven impact: internal-only services not exposed to the network, link-local and RFC1918 endpoints, and reachability or error oracles. On instances with AWS IMDSv1 enabled the request to 169.254.169.254 returns IAM credentials directly. Because the discovery runs in the host process and not in the per-server container, this is exactly the reach that the MCP server's own container sandbox is designed to deny.

Suggested fix

Apply the DCR client's hardening to the discovery clients: set CheckRedirect to reject cross-host or scheme-downgrade redirects, and wrap DialContext with the project's existing IsPrivateIP guard (pkg/networking/utilities.go:105) for FetchResourceMetadata, DetectAuthenticationFromServer, and the issuer-discovery client. Re-validating the redirect target, not only the initial URL, is the load-bearing part: the discovery.go:911 HTTPS check is bypassed by a 302 from an HTTPS metadata URL to an internal http address.

Verification status

The resource_metadata path was dynamically reproduced with a recording (against commit 05f11b53; the sink code at HEAD b672d82f is source-identical, with the unguarded clients and the three #nosec G704 suppressions confirmed present). The OIDC issuer discovery path is confirmed by source review against the same unguarded client and is in scope of the same fix.

Threat Intelligence Overview

EPSS Score
0.4%
Top 69% exploitable
Prevalence
Low
niche MCP server orchestration tool, early-stage adoption
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Social Media
1
Sightings
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC Yes
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Low

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +24
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Server-Side Request Forgery exploits applications that fetch remote resources based on user-supplied URLs.

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Server 16.1 Affected
SUSE Linux Enterprise Server for SAP applications 16.1 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP5 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP6 Affected
openSUSE Leap 15.5 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy