Skip to content
Threat Feed
high advisory

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

  1. An attacker crafts a malicious prompt that instructs the LLM-based MCP client to call either the auth_fetch or download_media tool.
  2. 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).
  3. If the auth_fetch tool is called, the url is passed directly to page.goto function in src/browser.ts, causing the Playwright browser to navigate to the specified URL without validation.
  4. The auth_fetch tool extracts the DOM content of the fetched page using the extractContent function and returns it to the attacker.
  5. If the download_media tool is called, the provided URLs are iterated, and ctx.request.get(url) is called for each URL in src/tools.ts, fetching the content without validation.
  6. The response body from the fetched URL is written to a file in the user-specified output_dir using fs.writeFileSync in src/tools.ts.
  7. The attacker retrieves the fetched data from either the auth_fetch tool’s response or from the files written to disk by the download_media tool.
  8. 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_fetch and download_media tools to prevent SSRF attacks, using the assertSafeUrl function described in the advisory. Apply the validation at tools.ts:236 and browser.ts:53.
  • Restrict the output_dir parameter in the download_media tool 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

medium

Detects writing files to unusual directories via download_media, which may indicate a SSRF and data exfiltration attempt.

sigma tactics: discovery, exfiltration techniques: T1041, T1592 sources: process_creation, windows

Detect auth-fetch-mcp auth_fetch Tool Execution with Internal IP Address

high

Detects the execution of the auth_fetch tool with a URL containing an internal IP address, potentially indicating SSRF exploitation.

sigma tactics: discovery, initial_access techniques: T1016, T1190 sources: process_creation, windows

Detection queries are available on the platform. Get full rules →

Indicators of compromise

1

hash_sha256

1

ip

1

url

TypeValue
ip169.254.169.254
urlhttp://169.254.169.254/latest/meta-data/iam/security-credentials/<role>
hash_sha2564cea53f1a618581fc67f9a8bd07a7a2b22274f42cdbf7f3c658519673aaf7568