What is DNS Rebinding?
A service that fetched user-supplied URLs checked the resolved IP against a banlist before making the request, but the DNS record could be changed between the check and the fetch. By using DNS rebinding, the attacker made the service connect to localhost and reach the AWS metadata endpoint, obtaining temporary AWS keys.
Published on geleta.eu
Of course you won’t load url that points to your internal network… That would be stupid right?
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 a time-of-check to time-of-use flaw: the application resolved the hostname to check it against a banlist, but then performed a second DNS lookup when making the request, allowing the record to change in between.
Impact
The attacker could reach internal services, obtain AWS keys with limited S3 permissions, enumerate internal ports, and access a Monit interface that allowed reading memory and shutting down the instance.
What the attacker needed
A service that fetches user-supplied URLs; control over a domain and DNS server; ability to send many requests
The fix
The service should resolve the hostname once and use that same IP for the actual request, or block requests to private IP ranges at the network level.
How it was found
- Set up a custom DNS server that resolves a domain to a public IP a few times and then to [redacted], with TTL 0.
- Submit the domain to the vulnerable service that fetches URLs.
- Send many requests (e.g. with Burp Intruder) until one resolves to localhost and returns internal content.
- Use the same technique to reach the AWS metadata IP [redacted] and retrieve temporary AWS keys.
- Use the keys to access S3 buckets (read/write some, but no useful data).
- Chain with another SSRF in an FTP connection to enumerate internal ports and find a Monit admin interface.
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.
DNS rebinding is a trick where a domain name first points to a harmless IP address, then quickly changes to point to an internal address like 127.0.0.1. If a program checks the IP once and then makes the request later, the second lookup can return the internal address, letting the attacker reach services that should not be accessible from the internet.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.