Authenticated SSRF and Graph API Authorization Bypass via URL Normalization in a Vendor-Authored MCP Server
An MCP server attached the user's OAuth Bearer token to every outbound HTTP request without validating the destination URL, allowing an attacker to redirect requests to their own server and steal the token. Separately, a Base64 path decoder concatenated user input onto a Graph API base URL without sanitising traversal sequences, so URL normalisation let requests escape the intended API namespace.
Published on g0w6y.medium.com
Hey folks, I am back with a new writeup. This one is about two chained vulnerabilities I found in a vendor-authored MCP server.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the fetch wrapper built the destination URL from user-controlled input with no validation and attached the OAuth token unconditionally, while the path decoder concatenated Base64-decoded input onto the API base URL without sanitising traversal sequences.
Impact
An authenticated attacker could exfiltrate a live OAuth Bearer token, access API endpoints outside the server's intended namespace, and probe loopback and link-local addresses including cloud metadata endpoints.
What the attacker needed
An authenticated MCP client session; attacker-controlled server to receive requests
The fix
The fetch wrapper should validate destination URLs against an allowlist and block private addresses, and the path decoder should sanitise traversal sequences before building API URLs.
How it was found
- Search the source for any URL validation, hostname checking or private IP blocking and find none.
- Start the server locally with placeholder OAuth environment variables.
- Open a netcat listener to act as an attacker-controlled server.
- Call the fetch wrapper with a URL pointing at the listener and a dummy token.
- Observe the listener receiving the request with the Bearer token attached.
- Encode a traversal path in Base64 and confirm the URL parser resolves it outside the intended API namespace.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This server acts as a middleman between an AI assistant and a cloud service, and it holds a special pass (a token) that proves who the user is. The server would send that pass to any web address an attacker chose, so the attacker could set up their own address and receive the pass. A second flaw let crafted input move the request to a different part of the cloud service than the server was meant to use.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.