Blacklist bypass on Callback URLs
The callback URL feature allowed access to private IP addresses via a DNS rebinding bypass of the IP blacklist. An attacker could reach the outbound proxy's loopback interface and access non-sensitive internal web pages.
- Triaged in 5 months
- Fixed in 5 months
- Paid in 5 months
- Disclosed after 18 months
In bug #47368, I was able to reach private IP addresses via the "Test Now" button of the "Callback URL" feature. Exploiting this flaw allowed me to reach the metadata server of your outbound proxy (which is, afaik, maintained by Proximo). A comment by aianus states that callbacks are now restricted "from hitting any RFC 6890 IP addresses and networks". This security measure can be bypassed used DNS rebinding.
Let's consider what happens where an URL like http://test42.sqli.nicob.net/_hostmanager/healthcheck is submitted via the "Merchants settings":
- The hostname "test42.sqli.nicob.net" is resolved (twice) by your servers. Then the resulting IP address is checked against a blacklist. If the IP is blacklisted, the message "Invalid callback URL" is printed and processing stops
- If the IP isn't blacklisted, the request is sent to the outbound proxy managed by Proximo. The proxy will resolve "test42.sqli.nicob.net" too, without applying a strict blacklist. Then the target URL is accessed.
In order to exploit the flaw, we need a custom DNS server. A patched copy of dnschef can be used to send different answers at different times and bypass the filter. The following command will instruct the DNS server to answer with IP #2 twice (an authorized one), then IP #1 (a blacklisted one), then back to the beginning (scheme "221").
# ./rebind.py --ip1=127.0.0.1 --ip2=92.243.29.213 --scheme=221
[17:05:08] 54.144.123.243: cooking the response of type 'A' for test42.sqli.nicob.net to 92.243.29.213 [1]
[17:05:08] 54.82.64.0: cooking the response of type 'A' for test42.sqli.nicob.net to 92.243.29.213 [2]
[17:05:09] 54.162.118.12: cooking the response of type 'A' for test42.sqli.nicob.net to 127.0.0.1 [3]
The filters will see "92.243.29.213" and the proxy will see "127.0.0.1". And the Web interface will display the index page of the Web service listening on port TCP/80 of the loopback interface of the proxy server. Several ports were identified on loopback (80, 1080, 8000, 9177, ...) and I found some unprotected URL like http://127.0.0.1:80/_hostmanager/healthcheck (which simply displays "OK").
Regarding exploitation:
- the metadata server on 169.254.169.254 is unreachable (that's good for you!)
- the pages found (:9177/status, :80/_hostmanager/healthcheck, :80/check, ...) are unproctected but not sensitive
- I may have missed some URL or web servers listening on loopback (brute-force is hard because of rate limitations)
Advice: the outbound proxy should implement a blacklist restricting access to internal and private IP addresses
NB: this kind of DNS blacklist may be 1) used elsewhere by Coinbase2) exploited more easily in a different scenario
Context
Coinbase exposes a "Callback URL" feature, configured through "Merchants settings", that lets a merchant supply a URL the platform will call out to. The feature includes a "Test Now" button which triggers an immediate request to the configured URL from Coinbase's infrastructure.
Outbound requests are not made directly: they go through an outbound proxy, which the researcher understands to be maintained by Proximo. That proxy is the component that actually resolves the target hostname and connects to it.
A previous report, #47368, showed that the "Test Now" button could be used to reach private IP addresses, including the metadata server of the outbound proxy. In a comment on that report, aianus stated that callbacks are now restricted "from hitting any RFC 6890 IP addresses and networks". This report is about bypassing that restriction.
Setup
The only tooling the researcher needed beyond a browser was a custom DNS server: a patched copy of dnschef that can return different answers at different times. The callback target was the hostname test42.sqli.nicob.net.
No account details, roles or versions are given in the report beyond the merchant settings context.
Finding it
The starting point was the earlier finding: private IP addresses were reachable through the callback feature, and the fix was an IP blacklist applied to callbacks.
Looking at how a callback is processed, the researcher describes two resolutions of the same hostname by two different parties:
- The hostname is resolved (twice) by Coinbase's servers, and the resulting IP address is checked against the blacklist. If the IP is blacklisted, the message "Invalid callback URL" is printed and processing stops.
- If the IP is not blacklisted, the request is sent to the outbound proxy managed by Proximo. The proxy resolves the hostname again, without applying a strict blacklist, and then accesses the target URL.
That gap, between the address the filter sees and the address the proxy connects to, is what the researcher set out to exploit with DNS rebinding.
Exploitation
Step 1: Make the filter and the proxy see different answers
The researcher's DNS server is configured to answer with IP #2 twice, then IP #1, then to start over. The scheme 221 encodes that sequence. The command used is:
# ./rebind.py --ip1=[redacted] --ip2=[redacted] --scheme=221
[17:05:08] [redacted]: cooking the response of type 'A' for test42.sqli.nicob.net to [redacted] [1]
[17:05:08] [redacted]: cooking the response of type 'A' for test42.sqli.nicob.net to [redacted] [2]
[17:05:09] [redacted]: cooking the response of type 'A' for test42.sqli.nicob.net to [redacted] [3]
--ip1 is [redacted] (loopback) and --ip2 is [redacted]. The log lines show the answers being served in order: the first two queries, from [redacted] and [redacted], receive [redacted]; the third query, from [redacted], receives [redacted].
The filters see [redacted] and the proxy sees [redacted], so the request reaches the loopback interface of the proxy server.
Step 2: Submit the callback URL
The URL submitted through "Merchants settings" is:
http://test42.sqli.nicob.net/_hostmanager/healthcheck
The proxy resolves the same hostname again, gets [redacted], and accesses the target URL.
Step 3: Read the result
The Web interface displays the index page of the Web service listening on port TCP/80 of the loopback interface of the proxy server. The researcher identified several ports listening on loopback (80, 1080, 8000, 9177, ...) and found unprotected URLs such as:
http://[redacted]:80/_hostmanager/healthcheck
which simply displays "OK".
Root cause
The design resolves the callback hostname more than once, in different components, and applies the blacklist to only one of those resolutions. The filter's decision is made on an address that is not necessarily the address the proxy later connects to. DNS rebinding breaks the assumption that a name maps to a stable address between the check and the use.
The existing defence, the RFC 6890 blacklist described in the earlier report, therefore did not stop the attack. The report does not describe the proxy's configuration beyond stating that it resolves the hostname without applying a strict blacklist.
Impact
An attacker who can configure a callback URL can make the outbound proxy issue requests to services bound to its loopback interface. In this report the researcher reached the proxy's own Web interface and several unprotected endpoints, and confirmed that the metadata server on [redacted] was unreachable.
The concrete findings were limited: the pages found (:9177/status, :80/_hostmanager/healthcheck, :80/check, ...) are unprotected but not sensitive. The researcher notes that other URLs or Web servers on loopback may have been missed, since brute-force is hard because of rate limitations. So the demonstrated impact is access to internal, non-sensitive endpoints on the proxy host, with the possibility of more being reachable.
Fix
The researcher's advice is that the outbound proxy should implement a blacklist restricting access to internal and private IP addresses. The report does not state what Coinbase changed in response.
Variants to test
- Callback and webhook features that validate a URL then hand it to a separate fetcher. Configure a hostname under your control and return an authorised address for the validation queries and a private address for the fetch.
- Any feature that resolves a user-supplied hostname more than once. Count the DNS queries you receive and their sources; if the validation and the fetch come from different resolvers or at different times, the rebinding window exists.
- Blacklists applied to resolved IPs rather than to the connection. Try alternating answers to see whether the address used for the connection can differ from the address that was checked.
- Loopback services on egress proxies and workers.
Hunting notes
This kind of bug hides in features where a server-side component fetches a URL supplied by the user: webhooks, callback URLs, test buttons, URL previews, importers and integrations. The signal during recon is a feature that both validates a URL and later fetches it, especially when the fetch is performed by a separate proxy or worker.
A controlled DNS server that logs queries is the key instrument: it shows how many times the hostname is resolved, from which addresses, and in what order, which is exactly the information needed to tell whether a rebinding window exists. The researcher showed impact by reaching the proxy's loopback Web interface through the callback feature and by listing the unprotected endpoints found there, while being explicit that those endpoints were not sensitive and that the metadata server was unreachable.
What happened, in plain words
Coinbase is a service for buying, selling and holding cryptocurrency. Like many online services, it lets merchants (businesses that use Coinbase to take payments) tell Coinbase where to send notifications. This is called a "Callback URL": the merchant types in a web address, and Coinbase's computers later visit that address to deliver a message. There is also a "Test Now" button, which makes Coinbase visit the address immediately so the merchant can check it works.
A web address normally contains a name, such as example.com, not a number. Computers cannot use names directly; they ask a special service called a DNS server to translate the name into a number, called an IP address. That number is what the computer actually connects to. Think of DNS as a phone book: you look up a name and get a number.
Some IP addresses are special. They point at the machine itself ("loopback", usually [redacted]) or at machines on a private internal network. Those addresses are not meant to be reachable from the outside internet, because they often lead to internal tools and services that were never designed to be public.
An earlier report showed that the "Test Now" button could be tricked into visiting those private addresses, including a metadata server belonging to the outbound proxy (a middleman computer that Coinbase uses to make the outgoing requests). Coinbase fixed this by checking the IP address that a callback name resolves to, and refusing any address on a published list of private and reserved ranges (the list is called RFC 6890). If the address is on the list, the merchant sees "Invalid callback URL" and nothing more happens.
The researcher, agarri_fr, noticed a gap. Coinbase checks the address once, but the actual request is made by the proxy, which looks the name up again. If the name gives one answer during the check and a different answer during the actual request, the check is meaningless. Making a name change its answer between lookups is called DNS rebinding. The researcher used it to make the check see a harmless public address while the proxy connected to its own loopback interface, and reached internal web pages that were not meant to be reachable from outside.
The feature and the earlier fix
Coinbase exposes a "Callback URL" feature, configured through "Merchants settings", that lets a merchant supply a URL the platform will call out to. The feature includes a "Test Now" button which triggers an immediate request to the configured URL from Coinbase's infrastructure.
Outbound requests are not made directly: they go through an outbound proxy, which the researcher understands to be maintained by Proximo. That proxy is the component that actually resolves the target hostname and connects to it.
A previous report, #47368, showed that the "Test Now" button could be used to reach private IP addresses, including the metadata server of the outbound proxy. In a comment on that report, aianus stated that callbacks are now restricted "from hitting any RFC 6890 IP addresses and networks". This report is about bypassing that restriction.
Setting up
The only tooling the researcher needed beyond a browser was a custom DNS server: a patched copy of dnschef that can return different answers at different times. The callback target was the hostname test42.sqli.nicob.net.
No account details, roles or versions are given in the report beyond the merchant settings context.
Finding it
The starting point was the earlier finding: private IP addresses were reachable through the callback feature, and the fix was an IP blacklist applied to callbacks.
Looking at how a callback is processed, the researcher describes two resolutions of the same hostname by two different parties:
- The hostname is resolved (twice) by Coinbase's servers, and the resulting IP address is checked against the blacklist. If the IP is blacklisted, the message "Invalid callback URL" is printed and processing stops.
- If the IP is not blacklisted, the request is sent to the outbound proxy managed by Proximo. The proxy resolves the hostname again, without applying a strict blacklist, and then accesses the target URL.
That gap, between the address the filter sees and the address the proxy connects to, is what the researcher set out to exploit with DNS rebinding.
Exploitation
Step 1: Make the filter and the proxy see different answers
The researcher's DNS server is configured to answer with IP #2 twice, then IP #1, then to start over. The scheme 221 encodes that sequence. The command used is:
# ./rebind.py --ip1=[redacted] --ip2=[redacted] --scheme=221
[17:05:08] [redacted]: cooking the response of type 'A' for test42.sqli.nicob.net to [redacted] [1]
[17:05:08] [redacted]: cooking the response of type 'A' for test42.sqli.nicob.net to [redacted] [2]
[17:05:09] [redacted]: cooking the response of type 'A' for test42.sqli.nicob.net to [redacted] [3]
--ip1 is [redacted] (loopback) and --ip2 is [redacted]. The log lines show the answers being served in order: the first two queries, from [redacted] and [redacted], receive [redacted]; the third query, from [redacted], receives [redacted].
The filters see [redacted] and the proxy sees [redacted], so the request reaches the loopback interface of the proxy server.
Step 2: Submit the callback URL
The URL submitted through "Merchants settings" is:
http://test42.sqli.nicob.net/_hostmanager/healthcheck
The proxy resolves the same hostname again, gets [redacted], and accesses the target URL.
Step 3: Read the result
The Web interface displays the index page of the Web service listening on port TCP/80 of the loopback interface of the proxy server. The researcher identified several ports listening on loopback (80, 1080, 8000, 9177, ...) and found unprotected URLs such as:
http://[redacted]:80/_hostmanager/healthcheck
which simply displays "OK".
Root cause
The design resolves the callback hostname more than once, in different components, and applies the blacklist to only one of those resolutions. The filter's decision is made on an address that is not necessarily the address the proxy later connects to. DNS rebinding breaks the assumption that a name maps to a stable address between the check and the use.
The existing defence, the RFC 6890 blacklist described in the earlier report, therefore did not stop the attack. The report does not describe the proxy's configuration beyond stating that it resolves the hostname without applying a strict blacklist.
Impact
An attacker who can configure a callback URL can make the outbound proxy issue requests to services bound to its loopback interface. In this report the researcher reached the proxy's own Web interface and several unprotected endpoints, and confirmed that the metadata server on [redacted] was unreachable.
The concrete findings were limited: the pages found (:9177/status, :80/_hostmanager/healthcheck, :80/check, ...) are unprotected but not sensitive. The researcher notes that other URLs or Web servers on loopback may have been missed, since brute-force is hard because of rate limitations. So the demonstrated impact is access to internal, non-sensitive endpoints on the proxy host, with the possibility of more being reachable.
Fix
The researcher's advice is that the outbound proxy should implement a blacklist restricting access to internal and private IP addresses. The report does not state what Coinbase changed in response.
Variants to test
- Callback and webhook features that validate a URL then hand it to a separate fetcher. Configure a hostname under your control and return an authorised address for the validation queries and a private address for the fetch.
- Any feature that resolves a user-supplied hostname more than once. Count the DNS queries you receive and their sources; if the validation and the fetch come from different resolvers or at different times, the rebinding window exists.
- Blacklists applied to resolved IPs rather than to the connection. Try alternating answers to see whether the address used for the connection can differ from the address that was checked.
- Loopback services on egress proxies and workers.
Hunting notes
This kind of bug hides in features where a server-side component fetches a URL supplied by the user: webhooks, callback URLs, test buttons, URL previews, importers and integrations. The signal during recon is a feature that both validates a URL and later fetches it, especially when the fetch is performed by a separate proxy or worker.
A controlled DNS server that logs queries is the key instrument: it shows how many times the hostname is resolved, from which addresses, and in what order, which is exactly the information needed to tell whether a rebinding window exists. The researcher showed impact by reaching the proxy's loopback Web interface through the callback feature and by listing the unprotected endpoints found there, while being explicit that those endpoints were not sensitive and that the metadata server was unreachable.
Glossary
- API: a way for one piece of software to talk to another, like a waiter taking your order to the kitchen and bringing back the result.
- Blacklist: a list of things that are not allowed, here a list of IP addresses the callback feature must not contact.
- Callback URL: a web address a service is asked to visit later, usually to deliver a notification.
- DNS: the internet's phone book; it translates a name such as
example.cominto the numeric IP address a computer needs. - DNS rebinding: making a name give one answer when it is checked and a different answer when it is used, so a safety check and the real connection see different addresses.
- Domain: a name you can register and control, such as
sqli.nicob.net. - Egress proxy: a middleman computer that outgoing requests pass through before reaching the internet.
- Hostname: the name part of a web address, such as
test42.sqli.nicob.net. - IP address: the numeric address of a computer on a network, such as
[redacted]. - Loopback: the special address range that points back at the same machine;
[redacted]means "this computer". - Metadata server: an internal service, often at
[redacted], that cloud machines query for information about themselves. - Port: a numbered door on a computer; a web server usually listens on port 80.
- Private IP address: an address used only inside an internal network, not reachable from the public internet.
- Proxy: a computer that makes requests on behalf of another computer.
- Rate limiting: a restriction on how many requests you can make in a period of time.
- Resolver: the DNS server that actually performs the name-to-address lookup.
- RFC 6890: a published document listing IP address ranges reserved for special purposes, including private and loopback addresses.
- TTL: "time to live", how long a DNS answer may be cached before it must be looked up again.
- Webhook: an automatic message one service sends to another by visiting a URL you supplied.
- Brute-force: trying many possible values, such as ports or paths, until one works.