auth-fetch-mcp SSRF and Disk Exfiltration Vulnerability
The auth-fetch-mcp package is vulnerable to server-side request forgery (SSRF) and disk exfiltration due to unvalidated URLs in the `download_media` and `auth_fetch` tools, allowing an attacker to fetch internal resources, cloud metadata, or loopback addresses, potentially leading to credential theft, internal service enumeration, and sensitive information disclosure.
The auth-fetch-mcp package is vulnerable to server-side request forgery (SSRF) and disk exfiltration. The download_media and auth_fetch tools within the package accept arbitrary URLs without proper validation, allowing a malicious MCP client to force the server to fetch internal resources, cloud metadata endpoints, or loopback addresses. This vulnerability can be exploited to steal cloud credentials, enumerate internal services, and access sensitive information. The download_media tool further exacerbates the risk by writing the fetched content to a user-controlled output directory, enabling data exfiltration. This vulnerability affects versions 3.0.0 and earlier of the auth-fetch-mcp package.
Attack Chain
- An attacker crafts a malicious prompt that instructs the LLM-based MCP client to call either the
auth_fetchordownload_mediatool. - The malicious prompt includes a URL targeting an internal resource, such as a cloud metadata endpoint (e.g.,
http://169.254.169.254/latest/meta-data/iam/security-credentials/<role>), a loopback service (e.g.,http://127.0.0.1:6379), or an internal admin page (e.g.,http://192.168.0.1). - If the
auth_fetchtool is called, theurlis passed directly topage.gotofunction insrc/browser.ts, causing the Playwright browser to navigate to the specified URL without validation. - The
auth_fetchtool extracts the DOM content of the fetched page using theextractContentfunction and returns it to the attacker. - If the
download_mediatool is called, the provided URLs are iterated, andctx.request.get(url)is called for each URL insrc/tools.ts, fetching the content without validation. - The response body from the fetched URL is written to a file in the user-specified
output_dirusingfs.writeFileSyncinsrc/tools.ts. - The attacker retrieves the fetched data from either the
auth_fetchtool’s response or from the files written to disk by thedownload_mediatool. - The attacker obtains sensitive information, such as cloud credentials, internal service configurations, or other confidential data.
Impact
Successful exploitation can lead to the theft of cloud credentials, allowing attackers to gain unauthorized access to cloud resources. Internal service enumeration can reveal valuable information about the network infrastructure and potential attack vectors. Access to loopback services can expose sensitive data or allow for further exploitation of vulnerable applications. The disk-write side channel in download_media can enable data exfiltration to shared directories, potentially impacting co-tenant processes. The scope of impact depends on the privileges and access controls of the MCP server environment, the sensitivity of accessible internal resources, and the extent to which the LLM can be prompted to expose these vulnerabilities.
Recommendation
- Implement URL validation in both the
auth_fetchanddownload_mediatools to prevent SSRF attacks, using theassertSafeUrlfunction described in the advisory. Apply the validation attools.ts:236andbrowser.ts:53. - Restrict the
output_dirparameter in thedownload_mediatool to a fixed root directory to prevent writing files to arbitrary locations. - Monitor network connections originating from the MCP server for connections to internal IP addresses (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16) using a network monitoring solution.
- Deploy the Sigma rule “Detect auth-fetch-mcp download_media Disk Write to Unusual Directory” to detect potential exfiltration attempts via unusual output directories.
- Block the IOCs listed in the IOC table at your network perimeter to prevent the exploitation of the SSRF vulnerability.
Detection coverage 2
Detect auth-fetch-mcp download_media Disk Write to Unusual Directory
mediumDetects writing files to unusual directories via download_media, which may indicate a SSRF and data exfiltration attempt.
Detect auth-fetch-mcp auth_fetch Tool Execution with Internal IP Address
highDetects the execution of the auth_fetch tool with a URL containing an internal IP address, potentially indicating SSRF exploitation.
Detection queries are available on the platform. Get full rules →
Indicators of compromise
1
hash_sha256
1
ip
1
url
| Type | Value |
|---|---|
| ip | 169.254.169.254 |
| url | http://169.254.169.254/latest/meta-data/iam/security-credentials/<role> |
| hash_sha256 | 4cea53f1a618581fc67f9a8bd07a7a2b22274f42cdbf7f3c658519673aaf7568 |