<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Mcphub — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/mcphub/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 03 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/mcphub/feed.xml" rel="self" type="application/rss+xml"/><item><title>MCPHub Path Traversal Vulnerability via Malicious MCPB Manifest Name</title><link>https://feed.craftedsignal.io/briefs/2024-01-mcphub-path-traversal/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-mcphub-path-traversal/</guid><description>MCPHub is vulnerable to path traversal, where a malicious MCPB file with a crafted manifest.name can cause files to be extracted to arbitrary locations due to missing sanitization in the upload handler.</description><content:encoded><![CDATA[<p>MCPHub is vulnerable to a path traversal vulnerability affecting versions prior to 0.12.13. The vulnerability exists in the MCPB file upload handler, which extracts a ZIP file and reads the <code>manifest.json</code> file. The <code>name</code> field from the manifest is directly concatenated into the file path without any sanitization or path traversal character validation. This allows an attacker to craft a malicious MCPB file with a <code>manifest.name</code> containing directory traversal sequences (e.g., <code>../../../etc/malicious</code>), leading to arbitrary file extraction and potential directory deletion via the <code>cleanupOldMcpbServer</code> function. This vulnerability poses a significant risk to systems running vulnerable versions of MCPHub, potentially allowing attackers to overwrite critical system files or execute arbitrary code.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious MCPB file.</li>
<li>The malicious MCPB file contains a <code>manifest.json</code> file with a <code>name</code> field set to a path traversal string (e.g., <code>../../../tmp/evil</code>).</li>
<li>The attacker uploads the malicious MCPB file to the <code>/mcpb/upload</code> endpoint.</li>
<li>The <code>uploadMcpbFile</code> function extracts the uploaded MCPB file to a temporary directory.</li>
<li>The function reads and parses the <code>manifest.json</code> file from the temporary directory.</li>
<li>The <code>manifest.name</code> value (containing the path traversal string) is used to construct the final extraction directory path using <code>path.join</code>.</li>
<li>The server attempts to create the directory specified by the crafted path and moves the extracted files to this location. Due to the path traversal, the files are written outside the intended directory.</li>
<li>The <code>cleanupOldMcpbServer</code> function may be triggered, attempting to delete directories based on the unsanitized name, though constrained to the upload directory.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this path traversal vulnerability allows an attacker to write files to arbitrary locations on the server&rsquo;s file system. This could lead to overwriting critical system files, injecting malicious code into existing applications, or gaining unauthorized access to sensitive data. The exact impact depends on the permissions of the user running the MCPHub application and the contents of the files being written. If the attacker can overwrite executable files or configuration files, they could achieve arbitrary code execution and full system compromise.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply the remediation recommendations from the original advisory: Use <code>path.basename()</code> to strip directory components from <code>manifest.name</code>, and enforce a strict character whitelist before use.</li>
<li>Deploy the Sigma rule &ldquo;Detect MCPHub Path Traversal Attempt via Manifest Name&rdquo; to identify attempts to exploit this vulnerability by monitoring for specific path traversal sequences in the manifest name (see Sigma rule).</li>
<li>Upgrade MCPHub to version 0.12.13 or later to patch this vulnerability.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>path-traversal</category><category>web-application</category><category>mcphub</category></item></channel></rss>