Attacking Private Networks from the Internet with DNS Rebinding
medium.com
medium.com
Can badsite.com request a resource from subdomain.badsite.com, and the browser will allow it. The JavaScript on badsite.com can be clever then, and begin probing <ip>.badsite.com, so all badsite DNS need to do is resolve that to <ip>.
You could also use the dangling domain to get a Let's Encrypt certificate.
It is quite common for sites to allow cross-origin loading from their own subdomains, with CORS and CSP headers.
If the target doesn't implement CSRF protection, this might still be enough to trigger unwanted actions. So if I add <img src='http://192.168.1.1/cgi-bin/reboot.cgi'> to a website, this might reboot your router, if it's rubbish. No rebinding needed for that.
Rebinding enables you to do more than that. A vulnerable service can be interacted with just like your local backend. So you can send queries and read responses.
Maybe there's a new way to do it I haven't heard of, but that was the state of things last time I checked.
Thus I do not need to do any lookups while viewing a page. The addresses are already available to HTTP clients locally, e.g., via HOSTS, a cdb key-value store, or an authoritative nameserver serving a custom zone file on the local network. In other words, I am not using a caching resolver.
"DNS cache poisoning" publicity circa 2008 gave me the impetus to end reliance on shared caches and later caches altogether. But it was the speed when not using a cache that kept me interested. It still does, even today.
Maybe "DNS rebinding" publicity will cause others to question the need for using shared caches, or even caches in general. Maybe not. In any event, with the increasing availability of bulk DNS data from a variety of sources, it is much easier to devise methods for avoiding caches today than it was in 2008.
DNS caching in combination with an enforced minimum TTL (of something like 60 seconds) can be useful in mitigating certain categories of rebinding attacks (for example an attempt to bypass SSRF checks). Your solution might share this property if it behaves similarly.
1. Is it possible at all to release some source code related to this? I know it's a big ask but I didn't want to leave without asking :)
2. Would it be ok to describe what this solution looks like a little more? Is it /etc/hosts being edited using a service? Is it at a deeper level? Do you use your own DNS server?
I'd love to adopt something similar, hence the curiosity :)
CONNECT Sep 08 08:29:04 [18050]: Connect (file descriptor 6): DOMAIN [IP]
So basically you almost have your hosts file ready, you just need to switch places of the DOMAIN and IP, cutting out all before and the brackets. A minute or so.I used it for a short time and never bothered to take care of the updates though. I guess I'd have to temporarily disable the hosts file and run an async DNS resolver such as adnshost:
adnshost -Vq +Dt
- filtering out the INET string to create a diff. It seems to much hassle to me though, to manually inspect DNS changes - I have so many things to do, I see no much reason to bother with every IP change on the Internet.Quite a lot of routers use dnsmasq internally. Ideally this would be a default setting.
Edit: To clarify, it seems that unbound by default blocks all RFC1918 addresses in DNS queries unless you specifically allow it for a specific domain (eg. plex.direct). OPNSense doesn't seem to expose an option to allow RFC1918 addresses in all dns responses.
Your router well may do the same.
There's no TTL, it just blocks any responses with private IP. Might break some software, because that's a legitimate DNS use.
DNS replies can be modified by anyone in the network path, so it is far more than just compromised DNS server.
> The DNS server can tell you the bank's hostname is a malicious IP, and then you can both steal credentials, or MITM.
All banks use HTTPS for their websites. A malicious IP is no t enough, unless it also has a forged certificate for the domain.
{{Object.keys(roku.devices).length}} Roku found
{{Object.keys(googleHome.devices).length}} Google Home found
{{Object.keys(radioThermostat.devices).length}} Radio Thermostat found
{{Object.keys(phillips.devices).length}} Phillips Hue Bridge found
{{Object.keys(sonos.devices).length}} Sonos speaker foundWe should just give all things globally addressible addresses, and do ACLs explicitly. (Or have a really air gapped network).
Which isn't surprising, given that this VM's LAN router/firewall is a pfSense VPN-gateway VM. With another pfSense VPN-gateway VM as its uplink. With another pfSense VPN-gateway VM as its uplink. Oh, and a hardware router/firewall on the ISP uplink.
The first pfSense VPN-gateway VM would likely have been enough. There's no reason to expose your LAN to the Internet.
And actually, this VirtualBox host can run several different nested VPN chains. Dedicated to different personas. And those chains can be provided as "LANs" to other VirtualBox hosts, which can extend them through other VPN services. And of course, Tor.
Edit: Some diagrams:
https://keybase.pub/mirimir/VPN-Basics.png
Another point is that I have multiple LANs, to compartmentalize. There's no one router that can mix local devices and Internet hosts.