Vulnerabilities in pkg:npm/@samanhappy/mcphub

PACKAGE
Advisory Summary

GHSA-wf8q-wvv8-p8jf is a CRITICAL (CVSS 9.1) sse endpoint accepts arbitrary username vulnerability (CWE-290: Authentication Bypass by Spoofing) affecting @samanhappy/mcphub libraries in the npm ecosystem. The issue involves sse endpoint accepts arbitrary username from url path without authentication, enabling user impersonation. Remediation is available by upgrading affected packages to version 0.12.15.

5 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@samanhappy/mcphub

5 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@samanhappy/mcphub. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-wf8q-wvv8-p8jf - CRITICAL @samanhappy/mcphub: SSE Endpoint Accepts Arbitrary Username from URL Path Without Authentication, Enabling User Impersonation
GHSA-p3h2-2j4p-p83g - HIGH MCPHub has Path Traversal via Malicious MCPB Manifest Name
GHSA-9vq7-9h42-j88h CVE-2025-13822 MODERATE MCPHub has an authentication bypass
GHSA-5q2p-3jg8-2m98 CVE-2025-11285 LOW MCPHub's ServerController is vulnerable to Command Injection
GHSA-v7c4-33vf-cqqq CVE-2025-11287 MODERATE MCPHub has an Improper Authorization vulnerability via its handleSseConnection function

GHSA-wf8q-wvv8-p8jf at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-wf8q-wvv8-p8jf
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-290: Authentication Bypass by Spoofing
Affected Product @samanhappy/mcphub
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.1

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:U/C:H/I:H/A:N).

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

How to Fix GHSA-wf8q-wvv8-p8jf

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

@samanhappy/mcphub fixed: 0.12.15
npm install @samanhappy/mcphub@0.12.15
Verify Direct and Transitive Dependencies

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

npm ls @samanhappy/mcphub

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-wf8q-wvv8-p8jf, inspect your project dependencies using npm:

npm ls @samanhappy/mcphub

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

Note: The npm ls @samanhappy/mcphub command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-290: Authentication Bypass by Spoofing, where this attack-focused weakness is caused by incorrectly implemented authentication schemes that are subject to spoofing attacks. In @samanhappy/mcphub, 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

### 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: ```typescript 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: ```typescript // 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:** ```bash curl -s -N --max-time 3 http://TARGET:3100/CEO-admin-impersonated/sse ``` Expected response — a valid SSE session is created: ``` event: endpoint data: /CEO-admin-impersonated/messages?sessionId=54efc6f5-15ed-4e69-9a0e-de87d3179758 ``` **Step 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-impersonated ``` The 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: ```bash 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.

GHSA-wf8q-wvv8-p8jf Affected @samanhappy/mcphub Versions

1 component(s)
Fixed Versions:
0.12.15
Product / Package Ecosystem Affected Versions Fixed Version
@samanhappy/mcphub
npm
< 0.12.15
0.12.15

References

Frequently Asked Questions

What is GHSA-wf8q-wvv8-p8jf?
GHSA-wf8q-wvv8-p8jf is a security vulnerability in @samanhappy/mcphub involving SSE Endpoint Accepts Arbitrary Username from URL Path Without Authentication, Enabling User Impersonation under CWE-290: Authentication Bypass by Spoofing.
Which @samanhappy/mcphub versions are affected?
Affected versions include releases prior to 0.12.15 across affected packages: @samanhappy/mcphub.
What version fixes GHSA-wf8q-wvv8-p8jf?
Upgrading to 0.12.15 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @samanhappy/mcphub affected?
Yes, @samanhappy/mcphub is affected in releases prior to 0.12.15. Upgrade your dependency to 0.12.15 or later.
What is the CVSS score of GHSA-wf8q-wvv8-p8jf?
GHSA-wf8q-wvv8-p8jf has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with GHSA-wf8q-wvv8-p8jf?
GHSA-wf8q-wvv8-p8jf is classified under CWE-290: Authentication Bypass by Spoofing (This attack-focused weakness is caused by incorrectly implemented authentication schemes that are subject to spoofing attacks.).
How can I check npm dependencies for GHSA-wf8q-wvv8-p8jf?
Run the dependency tree command: 'npm ls @samanhappy/mcphub'. 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-wf8q-wvv8-p8jf",
  "modified" : "2026-05-14T20:44:22Z",
  "published" : "2026-05-14T20:44:22Z",
  "aliases" : [ ],
  "summary" : "@samanhappy/mcphub: SSE Endpoint Accepts Arbitrary Username from URL Path Without Authentication, Enabling User Impersonation",
  "details" : "### Summary\n\nA 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.\n\n### Details\n\nMCPHub 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:\n\n```typescript\nexport const sseUserContextMiddleware = async (\n  req: Request, res: Response, next: NextFunction,\n): Promise<void> => {\n  const userContextService = UserContextService.getInstance();\n  const username = req.params.user;  // ← Taken directly from URL, no validation whatsoever\n\n  if (username) {\n    // Note: In a real implementation, you should validate the user exists\n    // and has proper permissions\n    const user: IUser = {\n      username,          // ← Completely attacker-controlled\n      password: '',\n      isAdmin: false,    // TODO: Should be retrieved from user database\n    };\n\n    userContextService.setCurrentUser(user);  // ← Fabricated identity is accepted as real\n    attachCleanupHandlers();\n    console.log(`User context set for SSE/MCP endpoint: ${username}`);\n    next();\n  }\n  // ...\n};\n```\n\nThe 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:\n\n```typescript\n// User-scoped routes with user context middleware\nthis.app.get(\n  `${this.basePath}/:user/sse/:group(.*)?`,\n  mcpConnectionRateLimiter,        // Only rate limiting\n  sseUserContextMiddleware,         // Identity from URL — no auth\n  (req, res) => handleSseConnection(req, res),\n);\n```\n\nAdditionally, `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).\n\n### PoC\n\n**Prerequisites:** A running MCPHub instance with `enableBearerAuth: false` (or bearer keys not configured).\n\n**Step 1 — Connect to the SSE endpoint as any arbitrary user:**\n```bash\ncurl -s -N --max-time 3 http://TARGET:3100/CEO-admin-impersonated/sse\n```\n\nExpected response — a valid SSE session is created:\n```\nevent: endpoint\ndata: /CEO-admin-impersonated/messages?sessionId=54efc6f5-15ed-4e69-9a0e-de87d3179758\n```\n\n**Step 2 — Verify on the server side (server logs):**\n```\n[INFO] User context set for SSE/MCP endpoint: CEO-admin-impersonated\n[INFO] Creating SSE transport with messages path: /CEO-admin-impersonated/messages\n[INFO] New SSE connection established: 54efc6f5-15ed-4e69-9a0e-de87d3179758 with group: global for user: CEO-admin-impersonated\n```\n\nThe 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.\n\n**Step 3 — Execute MCP tool calls under the spoofed identity:**\n\nOnce the SSE session is established, the attacker can send MCP messages to the returned endpoint path, executing tools under the spoofed user's context:\n```bash\ncurl -X POST http://TARGET:3100/CEO-admin-impersonated/messages?sessionId=54efc6f5-15ed-4e69-9a0e-de87d3179758 \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"any-tool\",\"arguments\":{}}}'\n```\n\n### Impact\n\nThis is a **user identity spoofing** vulnerability on the MCP transport layer. Any unauthenticated network user can:\n\n- **Impersonate any user**, including administrators, on SSE/MCP endpoints\n- **Execute MCP tool calls** under a spoofed user's identity, potentially accessing user-scoped resources and data\n- **Poison audit logs** — all actions are recorded under the fabricated username, destroying accountability and forensic value\n- **Access user-scoped servers and groups** that should only be available to authenticated users\n\nAll MCPHub instances exposing SSE endpoints without bearer authentication are affected. This includes the default configuration when bearer keys are not explicitly set up.\n\nReported by the Eresus Security Research Team.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@samanhappy/mcphub"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.12.15"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/samanhappy/mcphub/security/advisories/GHSA-wf8q-wvv8-p8jf"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/samanhappy/mcphub"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/samanhappy/mcphub/releases/tag/v0.12.15"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-290" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-14T20:44:22Z",
    "nvd_published_at" : null
  }
}