Using special IPv4-mapped IPv6 addresses to bypass local IP ban
Cloudflare's protection against requests to banned IP addresses could be bypassed using proxied AAAA records containing IPv4-mapped IPv6 addresses. This allowed an attacker to reach HTTP services on the loopback interface of the edge server and internal hosts on the local network.
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 10 days
- Paid in 10 days
- Disclosed after 58 days
Summary by the program
By using IPv4-mapped IPv6 addresses there was a way to bypass Cloudflare server's network protections and start connections to ports on the loopback (127.0.0.1) or internal IP addresses (such as 10.0.0.1). The bug was caused by the way a Go library interprets mapped IP addresses and how our code was checking for banned IPs. The code was fixed and now checks both IPv4 and IPv6 properly.
Summary by the researcher
Cloudflare has checks in place to block requests destined for banned IP addresses like local and reserved IP ranges. It was possible to bypass these restrictions using proxied AAAA records containing IPv4-mapped IPv6 addresses (e.g. ::ffff:127.0.0.1 and ::ffff:10.0.0.1). This made it possible to access HTTP services listening on the loopback interface of the edge server handling the request, as well as the internal IP addresses of other hosts on the local network.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Go library interpreted IPv4-mapped IPv6 addresses differently from the code that checked for banned IPs, so the ban check did not recognise the mapped address as local or reserved.
Impact
An attacker could access HTTP services listening on the loopback interface of the edge server and internal IP addresses of other hosts on the local network.
What the attacker needed
Ability to create proxied AAAA records
The fix
The code was fixed to check both IPv4 and IPv6 addresses properly.
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 report has not been written yet. The Original tab links to the source.
Websites often use a proxy service to hide their real servers. That proxy is supposed to block requests to private addresses, like the server's own localhost, so outsiders cannot reach internal services. Here, a quirk in how a programming library handled a special address format let those blocked requests slip through.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.