Severity:

HIGH RISK

(7.3)

SSRF in mcp-chat-studio LLM Models API

CVE-2026-7147

Deferred

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Unauthorized network access via server-side requests, potentially leading to data exposure or pivoting into internal services.

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A server-side request forgery (SSRF) vulnerability in the LLM Models API of mcp-chat-studio up to version 1.5.0 allows an attacker to control outbound HTTP requests via the req.query.base_url parameter.

When an attacker can supply arbitrary URLs to this parameter, they may coerce the server into connecting to internal or protected endpoints that are not directly accessible from the internet.

Affected context

The vulnerability exists in the server/routes/llm.js route handler that implements the LLM Models API.

It affects deployments where:

  • Client-supplied query parameters, specifically req.query.base_url, are used to construct outbound requests to LLM endpoints or other HTTP services.
  • There is no strict allowlist or validation of the destination host, scheme, or port.
  • The application server has network visibility into internal services, metadata endpoints, or other resources not exposed externally.

Exploit preconditions

  • Attack surface: Public or exposed HTTP endpoint for the LLM Models API, reachable by remote clients.
  • Required access: Ability to send requests to the affected route with a controllable base_url query parameter (typically unauthenticated or low-privileged web access).
  • Trigger point: The handler in server/routes/llm.js uses req.query.base_url to construct an outbound HTTP request without robust validation or restriction.
  • Why exploitation is possible: The server trusts the base_url value and uses it directly (or with insufficient checks) when making server-side requests, enabling the attacker to redirect those requests to arbitrary URLs under their control or to internal network locations.

Why this happens

This issue is an instance of CWE-918: Server-Side Request Forgery (SSRF).

The route handling logic for the LLM Models API appears to treat a user-controlled parameter (req.query.base_url) as a trusted endpoint definition, embedding it into outbound HTTP calls.

By failing to constrain which hosts, protocols, or paths can be targeted, the application exposes its own network connectivity as an attack primitive.

In abstract terms, untrusted input is used to define remote resource locations for server-initiated requests, effectively delegating network routing decisions to the attacker.

Potential impact

  • Access to internal HTTP services that are not exposed to the public internet (e.g., internal APIs, admin panels, or microservices).
  • Interaction with cloud provider metadata endpoints, which may reveal sensitive instance credentials or configuration.
  • Enumeration of internal network structure (open ports, available services, behavior of internal endpoints).
  • Use of the application server as a proxy to bypass IP-based access controls or firewall rules.
  • Potential chaining with other vulnerabilities on reachable internal systems (e.g., exploiting admin interfaces or weakly protected endpoints).

General mitigation guidance

Effective mitigation for SSRF in this context focuses on constraining outbound connections and reducing trust in user-controlled URLs:

  • Prefer fixed, configuration-driven endpoints for LLM providers instead of accepting arbitrary base URLs from client input.
  • If dynamic endpoints are required, enforce a strict allowlist of permitted hosts and, where possible, specific paths and ports.
  • Validate base_url inputs rigorously:
  • Restrict protocols to https (or a small, expected set).
  • Block private, loopback, link-local, and link-local metadata address ranges by default.
  • Normalize and re-parse URLs after resolution to ensure no DNS rebinding or scheme confusion.
  • Where feasible, route outbound traffic through a network egress proxy with filtering rules that forbid access to internal or metadata networks.
  • Apply least-privilege network policies (e.g., firewall rules, Kubernetes NetworkPolicies, security groups) so the application can only reach the specific external LLM endpoints it needs.

How teams detect issues like this

Detection of SSRF patterns and potential exploitation can be approached at several layers:

  • Static analysis/code scanning:
  • Identify places where user input (e.g., req.query.base_url, headers, or body fields) flows into HTTP client calls, URL constructors, or request libraries.
  • Flag dynamic URL composition that is not guarded by allowlists or robust validation.
  • Code review practices:
  • During review of route handlers like server/routes/llm.js, verify that any user-influenced URL parameters are tightly controlled.
  • Look for helper functions that build outbound requests and ensure they centralize validation and host restrictions.
  • Runtime and observability:
  • Monitor outbound traffic from the application for unusual destinations, such as private IP ranges, 169.254.169.254, or internal domains that should not be contacted.
  • Use application logs to track the effective URLs being requested by the LLM Models API and alert on anomalies or patterns indicative of scanning.
  • Security testing:
  • Include SSRF-focused test cases in API security testing, fuzzing base_url (and similar parameters) with internal and metadata targets to validate defenses.

Sources

SourceLink
github.comgithub.com/JoeCastrom/mcp-chat-studio/
github.comgithub.com/JoeCastrom/mcp-chat-studio/issues/4
vuldb.comvuldb.com/submit/801896
vuldb.comvuldb.com/vuln/359746
vuldb.comvuldb.com/vuln/359746/cti

Frequently asked

questions

Yes. As described, a remote attacker who can reach the LLM Models API endpoint and control the base_url query parameter can attempt to exploit the SSRF behavior without local access to the server.

That depends on how the affected route is exposed in a given deployment. If the LLM Models API is publicly accessible without authentication, then exploitation requires only network access. If it is behind authentication or an internal gateway, an attacker would need at least the level of access required to invoke that endpoint.

The most robust fix is to remove or minimize user control over outbound destinations. Replace dynamic base_url usage with configuration-defined endpoints and, where dynamic behavior is unavoidable, enforce strict host allowlists and URL validation before any request is issued.

Treat any client-supplied URL or host information as untrusted by default. Incorporate SSRF-specific checks into design reviews, centralize outbound HTTP request logic with consistent validation and allowlisting, and apply network-level egress controls so that even if an SSRF bug appears in code, the server cannot freely reach sensitive internal or metadata endpoints.

Find out what's already
exploitable in your codebase.