A story about a not-so-direct SSRF
A demo-testing site accepted a user-supplied URL and made a server-side request to it, appending a fixed path. By hosting a redirector that sent the request to the cloud metadata endpoint, the attacker could read metadata and enumerate internal hosts and ports.
Published on infosecwriteups.com
I was testing a target that had a decent scope. After doing some basic google dorking to find domains/subdomains about the target, I ended up finding a subdomain which was a “demo-testing” site that is related to some smart authentication.
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 application fetched a user-controlled URL without validating or restricting the destination, and it appended a fixed path to every request.
Impact
The attacker could read cloud metadata and enumerate local files and internal hosts and ports, though direct requests to metadata endpoints returned 403 or 404 because of the appended path.
What the attacker needed
Access to the demo-testing page; a server that can redirect requests; a public tunnel such as ngrok
How it was found
- Find a demo-testing subdomain with a URL input field.
- Submit a URL pointing to a controlled server and observe the request.
- Host a server that redirects requests for the appended path to the cloud metadata endpoint.
- Supply the redirector URL and receive the metadata response.
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.
The website had a feature where you give it a web address and it fetches that address for you. Because the server did the fetching, an attacker could make it fetch private addresses that only the server can reach, like the cloud provider's internal metadata service. This is called server-side request forgery (SSRF).
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.