]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2831. [security] Do not attempt to validate or cache v9.4.3-P5
authorEvan Hunt <each@isc.org>
Thu, 7 Jan 2010 17:18:49 +0000 (17:18 +0000)
committerEvan Hunt <each@isc.org>
Thu, 7 Jan 2010 17:18:49 +0000 (17:18 +0000)
out-of-bailiwick data returned with a secure
answer; it must be re-fetched from its original
source and validated in that context. [RT #20819]

CHANGES
bin/tests/system/pending/ns1/root.db.in
bin/tests/system/pending/ns1/sign.sh
bin/tests/system/pending/ns2/example.db.in
bin/tests/system/pending/ns2/named.conf
bin/tests/system/pending/ns2/sign.sh
bin/tests/system/pending/tests.sh
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index 8cb4698d974ce54cd2f5f5bb6ca07236e805671e..900f900b7ea016848a7369042bd16bbe99f82ab2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
        --- 9.4.3-P5 released ---
 
+2831.  [security]      Do not attempt to validate or cache
+                       out-of-bailiwick data returned with a secure
+                       answer; it must be re-fetched from its original
+                       source and validated in that context. [RT #20819]
+
 2828.  [security]      Cached CNAME or DNAME RR could be returned to clients
                        without DNSSEC validation. [RT #20737]
 
index 2abbd7f2dd8b2a6f3715ff9020e554ba88a1c8aa..114e2a3c1ff4c923e72ee59a685f32e441efe4fb 100644 (file)
@@ -12,7 +12,7 @@
 ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 ; PERFORMANCE OF THIS SOFTWARE.
 
-; $Id: root.db.in,v 1.4.4.1 2009/12/31 21:02:05 each Exp $
+; $Id: root.db.in,v 1.4.4.2 2010/01/07 17:18:49 each Exp $
 
 $TTL 30
 .                      IN SOA  marka.isc.org. a.root.servers.nil. (
@@ -31,3 +31,4 @@ example.com.          NS      ns2.example.com.
 ns2.example.com.       A       10.53.0.2
 hostile.               NS      ns3.hostile.
 ns3.hostile.           A       10.53.0.3
+nice.good.             A       10.10.10.10
index ec7d6ede9e99884f01b17735a25f75478c2b2f6a..625bdfa9f0d9b515cd690b203aab5927ef6ca995 100644 (file)
@@ -14,7 +14,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: sign.sh,v 1.3.4.1 2009/12/31 21:02:05 each Exp $
+# $Id: sign.sh,v 1.3.4.2 2010/01/07 17:18:49 each Exp $
 
 SYSTEMTESTTOP=../..
 . $SYSTEMTESTTOP/conf.sh
@@ -34,7 +34,7 @@ keyname1=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 1024 -n zone $zone`
 keyname2=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 2048 -f KSK -n zone $zone`
 cat $infile $keyname1.key $keyname2.key > $zonefile
 
-$SIGNER -g -r $RANDFILE -o $zone $zonefile > /dev/null
+$SIGNER -g -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1
 
 # Configure the resolving server with a trusted key.
 
index ca0d596b21133fd50a8dbefa80fa0698c94a213f..ace20c16ce20689f1c60ba26e8fb69d30ef12590 100644 (file)
 ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 ; PERFORMANCE OF THIS SOFTWARE.
 
-; $Id: example.db.in,v 1.2 2009/11/17 23:55:18 marka Exp $
+; $Id: example.db.in,v 1.2.44.2 2010/01/07 17:18:49 each Exp $
 
 $TTL 30
+$ORIGIN example.
 @                      IN SOA  mname1. . (
                                2009110300 ; serial
                                20         ; refresh (20 seconds)
@@ -26,3 +27,5 @@ $TTL 30
                        MX      10 mail
 ns2                    A       10.53.0.2
 mail                   A       10.0.0.2
+bad                    CNAME   nice.good.
+worse                   A       6.6.6.6
index 51c6d792c5f69c50d4d1af0b594e5b5c12f7100d..d309eb60d9891807ac367fe81f762566295df860 100644 (file)
@@ -14,7 +14,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named.conf,v 1.4.4.1 2009/12/31 21:02:05 each Exp $ */
+/* $Id: named.conf,v 1.4.4.2 2010/01/07 17:18:49 each Exp $ */
 
 // NS2
 
@@ -51,3 +51,9 @@ zone "example.com" {
        file "example.com.db.signed";
        allow-update { 10.53.0.0/8; };
 };
+
+zone "good" {
+        type master;
+        file "forgery.db";
+        allow-query { any; };
+};
index 82db0644a81b8a782e6a27274248abe0f34f91ec..f5021560eb40c96894551743c07e4222abe21a39 100644 (file)
@@ -14,7 +14,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: sign.sh,v 1.4.4.1 2009/12/31 21:02:05 each Exp $
+# $Id: sign.sh,v 1.4.4.2 2010/01/07 17:18:49 each Exp $
 
 SYSTEMTESTTOP=../..
 . $SYSTEMTESTTOP/conf.sh
@@ -31,5 +31,5 @@ for domain in example example.com; do
 
        cat $infile $keyname1.key $keyname2.key >$zonefile
 
-       $SIGNER -r $RANDFILE -o $zone $zonefile > /dev/null
+       $SIGNER -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1
 done
index 817248ec3df1e273ce6e67afa7dcba5a0e1ebbf6..c4ba3923c2582d61ac96a6341b8ac3df96c80f09 100644 (file)
@@ -14,7 +14,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: tests.sh,v 1.4.4.1 2009/12/31 21:02:05 each Exp $
+# $Id: tests.sh,v 1.4.4.2 2010/01/07 17:18:49 each Exp $
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
@@ -158,5 +158,26 @@ test "$ans" = "$expect" || ret=1
 test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
 status=`expr $status + $ret`
 
+#
+# Try to fool the resolver with an out-of-bailiwick CNAME
+#
+echo I:Trying to Prime out-of-bailiwick pending answer with CD
+ret=0
+expect="10.10.10.10"
+ans=`$DIG $DIGOPTS_CD @10.53.0.4 bad.example. A` || ret=1
+ans=`echo $ans | awk '{print $NF}'`
+test "$ans" = "$expect" || ret=1
+test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
+status=`expr $status + $ret`
+
+echo I:Confirming the out-of-bailiwick answer is not cached or reused with CD
+ret=0
+expect="10.10.10.10"
+ans=`$DIG $DIGOPTS_CD @10.53.0.4 nice.good. A` || ret=1
+ans=`echo $ans | awk '{print $NF}'`
+test "$ans" = "$expect" || ret=1
+test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
+status=`expr $status + $ret`
+
 echo "I:exit status: $status"
 exit $status
index 66e79c53e0d14ffcf00ab040fb79c54309e1656f..6e5a1ee522e6a2474ee35f6575532312e197db28 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.284.18.79.2.1 2009/11/19 00:25:17 marka Exp $ */
+/* $Id: resolver.c,v 1.284.18.79.2.2 2010/01/07 17:18:49 each Exp $ */
 
 /*! \file */
 
@@ -3883,11 +3883,19 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
                        rdataset->ttl = res->view->maxcachettl;
 
                /*
-                * If this rrset is in a secure domain, do DNSSEC validation
-                * for it, unless it is glue.
+                * If this RRset is in a secure domain, is in bailiwick,
+                * and is not glue, attempt DNSSEC validation.  (We do not
+                * attempt to validate glue or out-of-bailiwick data--even
+                * though there might be some performance benefit to doing
+                * so--because it makes it simpler and safer to ensure that
+                * records from a secure domain are only cached if validated
+                * within the context of a query to the domain that owns
+                * them.)
                 */
-               if (secure_domain && rdataset->trust != dns_trust_glue) {
+               if (secure_domain && rdataset->trust != dns_trust_glue &&
+                   !EXTERNAL(rdataset)) {
                        dns_trust_t trust;
+
                        /*
                         * RRSIGs are validated as part of validating the
                         * type they cover.
@@ -3924,22 +3932,6 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo,
                        }
 
                        /*
-                        * Reject out of bailiwick additional records
-                        * without RRSIGs as they can't possibly validate
-                        * as "secure" and as we will never never want to
-                        * store these as "answers" after validation.
-                        */
-                       if (rdataset->trust == dns_trust_additional &&
-                           sigrdataset == NULL && EXTERNAL(rdataset))
-                               continue;
-                       /*
-                        * XXXMPA: If we store as "answer" after validating
-                        * then we need to do bailiwick processing and
-                        * also need to track whether RRsets are in or
-                        * out of bailiwick.  This will require a another
-                        * pending trust level.
-                        *
                         * Cache this rdataset/sigrdataset pair as
                         * pending data.  Track whether it was additional
                         * or not.
@@ -5047,9 +5039,7 @@ answer_response(fetchctx_t *fctx) {
                                                /*
                                                 * This data is outside of
                                                 * our query domain, and
-                                                * may only be cached if it
-                                                * comes from a secure zone
-                                                * and validates.
+                                                * may not be cached.
                                                 */
                                                rdataset->attributes |=
                                                    DNS_RDATASETATTR_EXTERNAL;