How to find SSRF, Bypass Cloudflare, and extract AWS metadata
A PDF-download endpoint fetched a user-supplied URL, allowing server-side request forgery. The author bypassed a localhost filter by redirecting through their own server and reached the cloud metadata service, retrieving IAM security credentials.
Published on anontriager.medium.com
I was working on a program and since I have no permission to disclose the name of the target, let’s call it redacted.com.
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 endpoint fetched arbitrary user-supplied URLs without validating the resolved destination, and the filter only checked the original URL rather than following redirects.
Impact
An attacker could obtain temporary AWS IAM credentials for the instance's role, potentially granting access to cloud resources depending on that role's permissions.
What the attacker needed
Access to the PDF download endpoint; attacker-controlled web server; cloud instance with metadata service reachable
How it was found
- Find the PDF download endpoint that takes a url parameter.
- Replace the URL with a Burp Collaborator address and confirm the server makes the request.
- Try localhost and internal addresses; observe they are blocked.
- Host a small server that responds with a redirect to the cloud metadata address.
- Pass the attacker server URL to the endpoint so the redirect is followed.
- Read the IAM role name from the metadata response and request its credentials.
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 site had a feature that downloaded a PDF from any web address you gave it. Because the server itself made that request, the author could point it at internal addresses the outside world cannot reach, including a special cloud address that hands out temporary login keys. A redirect on the author's own server was used to slip past a filter that blocked direct internal addresses.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.