GHSA-7xgj-8392-5q4r: Medium severity pip/fastmcp-slim vulnerability
Maintainer assessment and remediation
This report is accepted as a FastMCP authorization vulnerability. In supported configurations, a server transform can change the metadata used by a component's authorization policy. Direct lookups previously checked the original component but returned the transformed component without rechecking its policy. A client that knows the component identifier can invoke a tool or retrieve a resource or prompt that the configured policy denies.
The fixes authorize the final transformed tools, resources, templates, and prompts. A denied concrete resource also shadows a matching resource template at its URI, preventing proxy templates from retrieving the same protected resource upstream. Authorized callers, authorized component versions, and templates for genuinely absent concrete resources remain supported.
Affected stable release lines: FastMCP 3.0.0–3.4.9 and 4.0.0–4.1.1. The missing final authorization check is present in v3.0.0 history and was reproduced on v3.4.9 and v4.1.0. Both fastmcp and fastmcp-slim installations are affected when using component authorization with transforms or protected concrete resources overlapping proxy templates.
Fixes are available in FastMCP 3.4.10 and 4.1.2. Until upgrading, avoid overlapping proxy templates for protected resources and enforce the required authorization at the handler or server boundary rather than relying on a policy whose inputs are changed by a transform.
Original report
Post-transform component authorization is skipped on direct calls
Summary
FastMCP's direct component paths can return a transformed component before its applicable AuthCheck, allowing low-privilege callers to execute hidden protected behavior. I reproduced this against FastMCP 4.1.0 and commit e2fcc412001ff7414095c5dc282f94c70299a612 using only an in-process FastMCP server. The attacker does not have server-side access and does not control FastMCP configuration.
Details
Attacker prerequisites
A server uses a supported provider, server, or session transform and a metadata-aware component AuthCheck. The attacker has a valid low-privilege identity, lacks the required scope, and knows or guesses the final transformed component name. They do not control the transform or the policy.
Root cause
Listing applies transforms and then authorizes the transformed component. In the direct lookup path, FastMCP 4.1.0 applies the transform and returns the component without authorizing that final component. See server.py:933-940. The MCP tools/call handler reaches this path; equivalent direct paths exist for resources, templates, and prompts.
Proof of concept
Save this as poctransformauth.py:
python import anyio
from fastmcp import FastMCP from fastmcp.server.auth import restricttag from fastmcp.server.transforms.tooltransform import ToolTransform from fastmcp.tools.base import Tool from fastmcp.tools.tooltransform import ToolTransformConfig
async def main() -> None: server = FastMCP("auth-boundary") server.addtool( Tool.fromfunction( lambda: "PROTECTED SECRET", name="taggedtool", tags={"public"}, auth=restricttag("admin", scopes=["admin"]), ) ) server.addtransform( ToolTransform({"taggedtool": ToolTransformConfig(tags={"admin"})}) )
print("listed:", [tool.name for tool in await server.listtools()]) try: result = await server.calltool("taggedtool") except Exception as exc: print("BLOCKED:", type(exc).name) else: print("VULNERABLE: direct call returned", result.content[0].text)
anyio.run(main)
Run it in an isolated environment:
bash uv run --with fastmcp==4.1.0 -- python poctransformauth.py
Observed on 4.1.0 for a caller without the admin scope:
text listed: [] VULNERABLE: direct call returned PROTECTED SECRET
Impact
A low-privilege caller can directly execute administrative tools hidden from listing, including their side effects and returned secrets. The same ordering flaw can expose protected resources, templates, or prompts.
Recommended remediation
Apply component authorization to the final transformed component in every direct resolution/execution path, after all provider, server, and session transforms. Reuse one ordered resolver for list and direct operations so lookup never returns a transformed component before its applicable AuthCheck runs.
AI assistance
Yes — OpenAI Codex assisted static analysis/PoC/writeup; reproduction was validated against stated version.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/fastmcp-slimto a version that resolves this vulnerability.Fixed in 4.1.2 - Upgrade
Upgrade
pip/fastmcp-slimto a version that resolves this vulnerability.Fixed in 3.4.10 - Upgrade
Upgrade
pip/fastmcpto a version that resolves this vulnerability.Fixed in 4.1.2 - Upgrade
Upgrade
pip/fastmcpto a version that resolves this vulnerability.Fixed in 3.4.10 - Upgrade
Upgrade
FastMCPto a version that resolves this vulnerability.Fixed in 3.4.10 - Upgrade
Upgrade
FastMCPto a version that resolves this vulnerability.Fixed in 4.1.2 - Compensating control
Until upgrading, avoid overlapping proxy templates for protected resources and enforce the required authorization at the handler or server boundary rather than relying on a policy whose inputs are changed by a transform.
Event History
Frequently Asked Questions
Which deployments are affected?
Affected stable release lines are FastMCP 3.0.0 through 3.4.9 and 4.0.0 through 4.1.1. Both fastmcp and fastmcp-slim are affected when component authorization is used with transforms, or when protected concrete resources overlap proxy templates.
What does an attacker need to exploit this?
The client needs to know the component identifier. They can then invoke a tool or retrieve a resource or prompt even when the configured policy denies that component, because authorization was checked before the transformed component was returned.
How can I determine whether my deployment needs urgent attention?
Prioritize systems in the affected release lines that use component authorization and server transforms. Also review configurations where a protected concrete resource shares a URI with a proxy resource template, since the issue could allow the template to retrieve the protected resource upstream.
What behavior changes with the fix?
The fixes authorize the final transformed tool, resource, template, or prompt rather than only the original component. They also ensure that a denied concrete resource shadows a matching resource template at the same URI, while retaining support for authorized callers, authorized component versions, and templates for genuinely absent concrete resources.