]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fixed rebinding protection bug when using forwarder setups
authorDiego Fronza <diego@isc.org>
Thu, 13 Feb 2020 23:17:13 +0000 (20:17 -0300)
committerOndřej Surý <ondrej@isc.org>
Wed, 8 Apr 2020 07:37:33 +0000 (09:37 +0200)
BIND wasn't honoring option "deny-answer-aliases" when configured to
forward queries.

Before the fix it was possible for nameservers listed in "forwarders"
option to return CNAME answers pointing to unrelated domains of the
original query, which could be used as a vector for rebinding attacks.

The fix ensures that BIND apply filters even if configured as a forwarder
instance.

(cherry picked from commit af6a4de3d5ad6c1967173facf366e6c86b3ffc28)

lib/dns/resolver.c

index 51bc368bf6631d561a6325d38cd24ca6add657bd..645a3e12cb04a4b73598ce12f79eb3bf77201808 100644 (file)
@@ -7115,8 +7115,13 @@ 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->forwarding && dns_name_issubdomain(tname, &fctx->domain)) {
                return (true);
        }