Comprehensive DNS Rebinding Protection
Categories
(Core :: Networking: DNS, enhancement, P3)
Tracking
()
People
(Reporter: tjr, Unassigned)
References
(Depends on 2 open bugs)
Details
(Keywords: sec-want, Whiteboard: [necko-triaged])
Attachments
(1 file)
Updated•7 years ago
|
Comment 1•7 years ago
|
||
Updated•2 years ago
|
Comment 3•2 years ago
|
||
Please at the very least block 0.0.0.0/32
because some DNS resolvers(well, one of them for sure, at least) return 0.0.0.0 for any blocked hostname, instead of NXDOMAIN.
Similarly, lines like the following might exist in /etc/hosts :
0.0.0.0 someblockedhost
which is the same as:
127.0.0.1 someblockedhost
That is, anything that resolves to 0.0.0.0 points to 127.0.0.1, thus DNS Rebinding attacks on localhost are a reality.
Say for example you run this as root:
nc -l -p 443 -s 127.0.0.1
then you start Firefox, using unnamed DNS provider that returns 0.0.0.0 for incoming.telemetry.mozilla.org instead of NXDOMAIN (this provider currently exists, I just don't want to name them here)
so what happens is that you see a connection attempt on the terminal where netcat is running.
Comment 4•2 years ago
|
||
Some attempted discussion about blocking 0.0.0.0/24 (not /32) was mentioned here: https://bugzilla.mozilla.org/show_bug.cgi?id=1672528#c17
If running dnsmasq, I've two workarounds(any will work):
- run
dnsmasq
with arg--stop-dns-rebind
--stop-dns-rebind
Reject (and log) addresses from upstream nameservers which are in the private ranges. This blocks an
attack where a browser behind a firewall is used to probe machines on the local network. For IPv6, the
private range covers the IPv4-mapped addresses in private space plus all link-local (LL) and site-local
(ULA) addresses.
- use this line in
/etc/dnsmasq.conf
:
bogus-nxdomain=0.0.0.0
This makes dnsmasq
return NXDOMAIN itself for any hostname that resolves to 0.0.0.0
but prevents any warning from --stop-dns-rebind
to reach the log, for obvious reasons.
Updated•7 months ago
|
Comment 5•7 months ago
|
||
Access to address 0.0.0.0 is happening in bug 1889130
Comment 6•7 months ago
|
||
(In reply to Daniel Veditz [:dveditz] from comment #5)
Access to address 0.0.0.0 is happening in bug 1889130
You are not authorized to access bug 1889130.
, well I guess I don't need to have access to it, what could I possibly add to it anyway?! ok maybe this:
I've been using a tiny kernel patch for the past 2 years that treats destination IP 0.0.0.0 as -ENETUNREACH as the workaround for this, instead of what it normally does(the 2 cases can be seen in patch, they're commented out with block comment)
Comment 7•7 months ago
|
||
Updated•6 months ago
|
Updated•6 months ago
|
Description
•