From . in regex to SSRF — part 2
A service that fetched remote images only checked the hostname of the supplied URL, so the author used a domain they controlled that redirected to internal addresses. This let them scan internal ports, find internal services and reach the cloud metadata endpoint, confirming a blind SSRF.
Published on xvnpw.github.io
In this story I will continue my journey to exploit Server Side Request Forgery (SSRF). Part 1 is available here.
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 service validated only the initial hostname and then followed HTTP redirects without re-checking the destination, allowing requests to internal addresses.
Impact
The author could reach internal hosts and the cloud metadata service, but only blind: they could confirm connections and find services, not read responses.
What the attacker needed
A domain you control; a server to host redirects; the service follows redirects
How it was found
- Register a domain and point it at your own server with a CNAME record.
- Run a small HTTP server that returns a 302 redirect to the address given in a query parameter.
- Send the image-converter URL pointing at your domain with the redirect parameter set to an internal address.
- Use ffuf to vary the port and the internal hostname to scan ports and find internal services.
- Point the redirect at the cloud metadata address to confirm the service runs on AWS.
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 service was meant to download an image from a web address you give it. It checked the address's name but not where that address later sent it, so the author's own server could reply 'go here instead' and point at machines inside the company network. That trick, making a server fetch an address it should not reach, 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.