MCPHub User Impersonation Vulnerability via Unauthenticated SSE Endpoint
MCPHub is vulnerable to user identity spoofing on the MCP transport layer; an unauthenticated network user can impersonate any user, including administrators, on SSE/MCP endpoints by providing the target username in the URL path, which allows execution of MCP tool calls under a spoofed user's identity, access to user-scoped resources and data, and poisoning of audit logs.
MCPHub is vulnerable to a critical identity spoofing vulnerability that allows any unauthenticated user to impersonate any other user, including administrators, on SSE and MCP transport endpoints. This vulnerability exists because the server accepts a username directly from the URL path parameter without any database validation, token verification, or authentication check. The sseUserContextMiddleware in src/middlewares/userContext.ts extracts the username from req.params.user and constructs a fabricated IUser object, bypassing all authentication. This allows attackers to execute MCP tool calls under the spoofed user’s context, access user-scoped resources and data, and poison audit logs. All MCPHub instances exposing SSE endpoints without bearer authentication are affected. This includes the default configuration when bearer keys are not explicitly set up. The vulnerability affects MCPHub versions prior to 0.12.15.
Attack Chain
- The attacker crafts a malicious URL containing the username of the target user within the path, for example
/CEO-admin-impersonated/sse. - The attacker sends an HTTP GET request to the crafted URL targeting the
/sseendpoint. - The
sseUserContextMiddlewareextracts the username directly fromreq.params.userwithout any authentication or validation. - The middleware constructs a fabricated
IUserobject with the spoofed username and sets it in theUserContextService. - The
handleSseConnectionfunction is called, establishing an SSE connection under the context of the spoofed user. - The attacker crafts an HTTP POST request to the
/messagesendpoint associated with the SSE session, including the session ID obtained during the SSE connection establishment. - The attacker includes a JSON payload in the POST request specifying the
tools/callmethod and the desired tool and arguments. - The MCP tool is executed on the server under the context of the spoofed user, potentially granting unauthorized access to resources and data.
Impact
This vulnerability enables a complete user identity spoofing on the MCP transport layer. Any unauthenticated network user can impersonate any other user, including administrators, on SSE/MCP endpoints. The attacker can then execute MCP tool calls under a spoofed user’s identity, potentially accessing user-scoped resources and data. Furthermore, all actions are recorded under the fabricated username, destroying accountability and forensic value. All MCPHub instances exposing SSE endpoints without bearer authentication are affected.
Recommendation
- Deploy the
Detect MCPHub User Impersonation via SSE EndpointSigma rule to your SIEM to detect exploitation attempts by monitoring HTTP requests to the SSE endpoint with suspicious usernames. - Deploy the
Detect MCPHub MCP Tool Call via Spoofed UserSigma rule to your SIEM to detect exploitation attempts by monitoring HTTP requests with a spoofed user. - Upgrade to @samanhappy/mcphub version 0.12.15 or later to patch the vulnerability.
Detection coverage 2
Detect MCPHub User Impersonation via SSE Endpoint
highDetects MCPHub user impersonation vulnerability exploitation by monitoring HTTP requests to the SSE endpoint with suspicious usernames.
Detect MCPHub MCP Tool Call via Spoofed User
highDetects MCPHub MCP tool call execution under a spoofed user, potentially indicating exploitation of the user impersonation vulnerability.
Detection queries are available on the platform. Get full rules →