Merge branch '1574-confidential-issue-rebinding-protection-fail-in-forwarding-mode-v9_11' into 'v9_11'

Resolve "DNS rebinding protection is ineffective when BIND is configured as a forwarding DNS server"

See merge request isc-projects/bind9!3345
This commit is contained in:
Ondřej Surý
2020-04-08 09:04:56 +00:00
9 changed files with 86 additions and 2 deletions
+4
View File
@@ -1,3 +1,7 @@
5376. [bug] Fix DNS ineffective rebinding protection when BIND 9
is configured as a forwarding DNS server. [GL #1574]
(Thanks to Tobias Klein)
5368. [bug] Named failed to restart if 'rndc addzone' names
contained special characters (e.g. '/'). [GL #1655]
+22
View File
@@ -0,0 +1,22 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 86400
@ IN SOA malicious. admin.malicious. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
@ IN NS ns
ns IN A 10.53.0.4
target IN CNAME subdomain.rebind.
@@ -55,3 +55,8 @@ zone "grafted" {
forward only;
forwarders { 10.53.0.2; };
};
zone "malicious." {
type master;
file "malicious.db";
};
@@ -19,9 +19,16 @@ options {
listen-on-v6 { none; };
forward only;
forwarders { 10.53.0.4; };
deny-answer-aliases { "rebind"; };
dnssec-validation yes;
};
zone "." {
type hint;
file "root.db";
};
zone "rebind" {
type master;
file "rebind.db";
};
+22
View File
@@ -0,0 +1,22 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
$TTL 86400
@ IN SOA rebind. admin.rebind. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
@ IN NS ns
ns IN A 10.53.0.5
subdomain IN A 10.53.0.1
+13
View File
@@ -210,5 +210,18 @@ sent=`grep -c "10.53.0.7#.* (.): query '\./NS/IN' approved" ns1/named.run`
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=$((n+1))
echo_i "checking that rebinding protection works in forward only mode ($n)"
ret=0
# 10.53.0.5 will forward target.malicious. query to 10.53.0.4
# which in turn will return a CNAME for subdomain.rebind.
# to honor the option deny-answer-aliases { "rebind"; };
# ns5 should return a SERVFAIL to avoid potential rebinding attacks
dig_with_opts +noadd +noauth @10.53.0.5 target.malicious. > dig.out.$n || ret=1
grep "status: SERVFAIL" dig.out.$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1
+3 -1
View File
@@ -15,7 +15,9 @@
<itemizedlist>
<listitem>
<para>
None.
DNS rebinding protection was ineffective when BIND 9 is configured as
a forwarding DNS server. Found and responsibly reported by Tobias
Klein. [GL #1574]
</para>
</listitem>
</itemizedlist>
+8 -1
View File
@@ -6447,9 +6447,16 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname,
/*
* If the target name is a subdomain of the search domain, allow it.
*
* Note that if BIND is configured as a forwarding DNS server, the
* search domain will always match the root domain ("."), so we
* must also check whether forwarding is enabled so that filters
* can be applied; see GL #1574.
*/
if (dns_name_issubdomain(tname, &fctx->domain))
if ((fctx->fwdpolicy == dns_fwdpolicy_none) &&
dns_name_issubdomain(tname, &fctx->domain)) {
return (true);
}
/*
* Otherwise, apply filters.
+2
View File
@@ -1433,9 +1433,11 @@
./bin/tests/system/forward/ns2/root.db ZONE 2000,2001,2004,2007,2016,2018,2019,2020
./bin/tests/system/forward/ns3/named.conf.in CONF-C 2018,2019,2020
./bin/tests/system/forward/ns3/root.db ZONE 2000,2001,2004,2007,2016,2018,2019,2020
./bin/tests/system/forward/ns4/malicious.db ZONE 2020
./bin/tests/system/forward/ns4/named.conf.in CONF-C 2018,2019,2020
./bin/tests/system/forward/ns4/root.db ZONE 2000,2001,2004,2007,2016,2018,2019,2020
./bin/tests/system/forward/ns5/named.conf.in CONF-C 2018,2019,2020
./bin/tests/system/forward/ns5/rebind.db ZONE 2020
./bin/tests/system/forward/ns5/root.db ZONE 2011,2016,2018,2019,2020
./bin/tests/system/forward/ns7/named.conf.in CONF-C 2019,2020
./bin/tests/system/forward/ns7/root.db ZONE 2019,2020