highVulnerability

GHSA-p3h2-2j4p-p83g

The MCPB file upload handler extracts a ZIP file and reads `manifest.json` from it. The `name` field from the manifest is concatenated directly into the file path (line 107) without any sanitization or path traversal character validation. An attacker can craft a malicious MCPB file with `manifest.name` set to `'../../../etc/malicious'` or similar, causing files to be extracted to arbitrary locations on the file system. The `cleanupOldMcpbServer` function (line 110) also uses the unsanitized name, potentially allowing arbitrary directory deletion. ## 1. Summary - **Vulnerability Type**: Path Traversal - **Flagged Location**: `src/controllers/mcpbController.ts:107` - **Vulnerability Description**: The `name` field in the uploaded MCPB manifest is used directly to construct file system paths for directory creation and move operations without sanitization or normalization, potentially leading to a path traversal attack. ## 2. Analysis Logic ### Step 1: Inspect the flagged sink (`src/controllers/mcpbController.ts:106-116`) I reviewed the upload handler and located the file system sink where `manifest.name` is used to construct the final extraction path and where files are written to that path. ```ts // src/controllers/mcpbController.ts:106-116 // Use server name as the final extract directory for automatic version management const finalExtractDir = path.join(path.dirname(mcpbFilePath), `server-${manifest.name}`); // Clean up any existing version of this server cleanupOldMcpbServer(manifest.name); if (!fs.existsSync(finalExtractDir)) { fs.mkdirSync(finalExtractDir, { recursive: true }); } // Move the temporary directory to the final location fs.renameSync(tempExtractDir, finalExtractDir); ``` Analysis: `manifest.name` is used to build `finalExtractDir`, which is then operated on by `fs.mkdirSync` and `fs.renameSync`. These are file system write/move operations, so if `name` is user-controllable and unsanitized, this is a path traversal sink. Next, I traced the so

Properties

ghsa_id
GHSA-p3h2-2j4p-p83g
severity
high
summary
MCPHub has Path Traversal via Malicious MCPB Manifest Name
cve_id
GHSA-p3h2-2j4p-p83g
is_ghsa_only
true
ghsa_published
2026-04-22T20:50:19Z
source_url
https://github.com/advisories/GHSA-p3h2-2j4p-p83g
ghsa_updated
2026-04-22T20:50:20Z

Related Entities (4)

VULNERABLE_TO (1)

[Software]npm/@samanhappy/mcphub

AFFECTS (1)

[Software]npm/@samanhappy/mcphub

HAS_WEAKNESS (1)

[Weakness]Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

REPORTED_BY (1)

[Source]GitHub Advisory Database

Explore deeper with Ninja Signal's threat intelligence graph