Petr Menšík ac5057
From 7983015dfa58be21526a01300b9e13a84278266a Mon Sep 17 00:00:00 2001
Petr Menšík ac5057
From: Evan Hunt <each@isc.org>
Petr Menšík ac5057
Date: Mon, 4 Jun 2018 21:55:41 -0700
Petr Menšík ac5057
Subject: [PATCH] allow-recursion could incorrectly inherit from the default
Petr Menšík ac5057
 allow-query
Petr Menšík ac5057
Petr Menšík ac5057
---
Petr Menšík ac5057
 bin/named/server.c | 50 ++++++++++++++++++++++++++++++++++++--------------
Petr Menšík ac5057
 doc/arm/notes.xml  | 41 +++++------------------------------------
Petr Menšík ac5057
 2 files changed, 41 insertions(+), 50 deletions(-)
Petr Menšík ac5057
Petr Menšík ac5057
diff --git a/bin/named/server.c b/bin/named/server.c
Petr Menšík ac5057
index 64a5180..41a1826 100644
Petr Menšík ac5057
--- a/bin/named/server.c
Petr Menšík ac5057
+++ b/bin/named/server.c
Petr Menšík ac5057
@@ -3376,10 +3376,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
Petr Menšík ac5057
 		dns_acache_setcachesize(view->acache, max_acache_size);
Petr Menšík ac5057
 	}
Petr Menšík ac5057
 
Petr Menšík ac5057
-	CHECK(configure_view_acl(vconfig, config, ns_g_config,
Petr Menšík ac5057
-				 "allow-query", NULL, actx,
Petr Menšík ac5057
-				 ns_g_mctx, &view->queryacl));
Petr Menšík ac5057
-
Petr Menšík ac5057
 	/*
Petr Menšík ac5057
 	 * Make the list of response policy zone names for a view that
Petr Menšík ac5057
 	 * is used for real lookups and so cares about hints.
Petr Menšík ac5057
@@ -4258,9 +4254,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
Petr Menšík ac5057
 	INSIST(result == ISC_R_SUCCESS);
Petr Menšík ac5057
 	view->trust_anchor_telemetry = cfg_obj_asboolean(obj);
Petr Menšík ac5057
 
Petr Menšík ac5057
-	CHECK(configure_view_acl(vconfig, config, ns_g_config,
Petr Menšík ac5057
-				 "allow-query-cache-on", NULL, actx,
Petr Menšík ac5057
-				 ns_g_mctx, &view->cacheonacl));
Petr Menšík ac5057
 	/*
Petr Menšík ac5057
 	 * Set sources where additional data and CNAME/DNAME
Petr Menšík ac5057
 	 * targets for authoritative answers may be found.
Petr Menšík ac5057
@@ -4287,22 +4280,40 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
Petr Menšík ac5057
 		view->additionalfromcache = ISC_TRUE;
Petr Menšík ac5057
 	}
Petr Menšík ac5057
 
Petr Menšík ac5057
+	CHECK(configure_view_acl(vconfig, config, ns_g_config,
Petr Menšík ac5057
+				 "allow-query-cache-on", NULL, actx,
Petr Menšík ac5057
+				 ns_g_mctx, &view->cacheonacl));
Petr Menšík ac5057
+
Petr Menšík ac5057
 	/*
Petr Menšík ac5057
-	 * Set "allow-query-cache", "allow-recursion", and
Petr Menšík ac5057
-	 * "allow-recursion-on" acls if configured in named.conf.
Petr Menšík ac5057
-	 * (Ignore the global defaults for now, because these ACLs
Petr Menšík ac5057
-	 * can inherit from each other when only some of them set at
Petr Menšík ac5057
-	 * the options/view level.)
Petr Menšík ac5057
+	 * Set the "allow-query", "allow-query-cache", "allow-recursion",
Petr Menšík ac5057
+	 * and "allow-recursion-on" ACLs if configured in named.conf, but
Petr Menšík ac5057
+	 * NOT from the global defaults. This is done by leaving the third
Petr Menšík ac5057
+	 * argument to configure_view_acl() NULL.
Petr Menšík ac5057
+	 *
Petr Menšík ac5057
+	 * We ignore the global defaults here because these ACLs
Petr Menšík ac5057
+	 * can inherit from each other.  If any are still unset after
Petr Menšík ac5057
+	 * applying the inheritance rules, we'll look up the defaults at
Petr Menšík ac5057
+	 * that time.
Petr Menšík ac5057
 	 */
Petr Menšík ac5057
-	CHECK(configure_view_acl(vconfig, config, NULL, "allow-query-cache",
Petr Menšík ac5057
-				 NULL, actx, ns_g_mctx, &view->cacheacl));
Petr Menšík ac5057
+
Petr Menšík ac5057
+	/* named.conf only */
Petr Menšík ac5057
+	CHECK(configure_view_acl(vconfig, config, NULL,
Petr Menšík ac5057
+				 "allow-query", NULL, actx,
Petr Menšík ac5057
+				 ns_g_mctx, &view->queryacl));
Petr Menšík ac5057
+
Petr Menšík ac5057
+	/* named.conf only */
Petr Menšík ac5057
+	CHECK(configure_view_acl(vconfig, config, NULL,
Petr Menšík ac5057
+				 "allow-query-cache", NULL, actx,
Petr Menšík ac5057
+				 ns_g_mctx, &view->cacheacl));
Petr Menšík ac5057
 
Petr Menšík ac5057
 	if (strcmp(view->name, "_bind") != 0 &&
Petr Menšík ac5057
 	    view->rdclass != dns_rdataclass_chaos)
Petr Menšík ac5057
 	{
Petr Menšík ac5057
+		/* named.conf only */
Petr Menšík ac5057
 		CHECK(configure_view_acl(vconfig, config, NULL,
Petr Menšík ac5057
 					 "allow-recursion", NULL, actx,
Petr Menšík ac5057
 					 ns_g_mctx, &view->recursionacl));
Petr Menšík ac5057
+		/* named.conf only */
Petr Menšík ac5057
 		CHECK(configure_view_acl(vconfig, config, NULL,
Petr Menšík ac5057
 					 "allow-recursion-on", NULL, actx,
Petr Menšík ac5057
 					 ns_g_mctx, &view->recursiononacl));
Petr Menšík ac5057
@@ -4340,18 +4351,21 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
Petr Menšík ac5057
 		 * the global config.
Petr Menšík ac5057
 		 */
Petr Menšík ac5057
 		if (view->recursionacl == NULL) {
Petr Menšík ac5057
+			/* global default only */
Petr Menšík ac5057
 			CHECK(configure_view_acl(NULL, NULL, ns_g_config,
Petr Menšík ac5057
 						 "allow-recursion", NULL,
Petr Menšík ac5057
 						 actx, ns_g_mctx,
Petr Menšík ac5057
 						 &view->recursionacl));
Petr Menšík ac5057
 		}
Petr Menšík ac5057
 		if (view->recursiononacl == NULL) {
Petr Menšík ac5057
+			/* global default only */
Petr Menšík ac5057
 			CHECK(configure_view_acl(NULL, NULL, ns_g_config,
Petr Menšík ac5057
 						 "allow-recursion-on", NULL,
Petr Menšík ac5057
 						 actx, ns_g_mctx,
Petr Menšík ac5057
 						 &view->recursiononacl));
Petr Menšík ac5057
 		}
Petr Menšík ac5057
 		if (view->cacheacl == NULL) {
Petr Menšík ac5057
+			/* global default only */
Petr Menšík ac5057
 			CHECK(configure_view_acl(NULL, NULL, ns_g_config,
Petr Menšík ac5057
 						 "allow-query-cache", NULL,
Petr Menšík ac5057
 						 actx, ns_g_mctx,
Petr Menšík ac5057
@@ -4365,6 +4379,14 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
Petr Menšík ac5057
 		CHECK(dns_acl_none(mctx, &view->cacheacl));
Petr Menšík ac5057
 	}
Petr Menšík ac5057
 
Petr Menšík ac5057
+	if (view->queryacl == NULL) {
Petr Menšík ac5057
+		/* global default only */
Petr Menšík ac5057
+		CHECK(configure_view_acl(NULL, NULL, ns_g_config,
Petr Menšík ac5057
+					 "allow-query", NULL,
Petr Menšík ac5057
+					 actx, ns_g_mctx,
Petr Menšík ac5057
+					 &view->queryacl));
Petr Menšík ac5057
+	}
Petr Menšík ac5057
+
Petr Menšík ac5057
 	/*
Petr Menšík ac5057
 	 * Ignore case when compressing responses to the specified
Petr Menšík ac5057
 	 * clients. This causes case not always to be preserved,
Petr Menšík ac5057
diff --git a/doc/arm/notes.xml b/doc/arm/notes.xml
Petr Menšík ac5057
index ea9b61f..9a1832d 100644
Petr Menšík ac5057
--- a/doc/arm/notes.xml
Petr Menšík ac5057
+++ b/doc/arm/notes.xml
Petr Menšík ac5057
@@ -103,42 +103,11 @@
Petr Menšík ac5057
     <itemizedlist>
Petr Menšík ac5057
       <listitem>
Petr Menšík ac5057
 	<para>
Petr Menšík ac5057
-	  An error in TSIG handling could permit unauthorized zone
Petr Menšík ac5057
-	  transfers or zone updates. These flaws are disclosed in
Petr Menšík ac5057
-	  CVE-2017-3142 and CVE-2017-3143. [RT #45383]
Petr Menšík ac5057
-	</para>
Petr Menšík ac5057
-      </listitem>
Petr Menšík ac5057
-      <listitem>
Petr Menšík ac5057
-	<para>
Petr Menšík ac5057
-	  The BIND installer on Windows used an unquoted service path,
Petr Menšík ac5057
-	  which can enable privilege escalation. This flaw is disclosed
Petr Menšík ac5057
-	  in CVE-2017-3141. [RT #45229]
Petr Menšík ac5057
-	</para>
Petr Menšík ac5057
-      </listitem>
Petr Menšík ac5057
-      <listitem>
Petr Menšík ac5057
-	<para>
Petr Menšík ac5057
-	  With certain RPZ configurations, a response with TTL 0
Petr Menšík ac5057
-	  could cause <command>named</command> to go into an infinite
Petr Menšík ac5057
-	  query loop. This flaw is disclosed in CVE-2017-3140.
Petr Menšík ac5057
-	  [RT #45181]
Petr Menšík ac5057
-	</para>
Petr Menšík ac5057
-      </listitem>
Petr Menšík ac5057
-      <listitem>
Petr Menšík ac5057
-	<para>
Petr Menšík ac5057
-	  Addresses could be referenced after being freed during resolver
Petr Menšík ac5057
-	  processing, causing an assertion failure. The chances of this
Petr Menšík ac5057
-	  happening were remote, but the introduction of a delay in
Petr Menšík ac5057
-	  resolution increased them. This bug is disclosed in
Petr Menšík ac5057
-	  CVE-2017-3145. [RT #46839]
Petr Menšík ac5057
-	</para>
Petr Menšík ac5057
-      </listitem>
Petr Menšík ac5057
-      <listitem>
Petr Menšík ac5057
-	<para>
Petr Menšík ac5057
-	  update-policy rules that otherwise ignore the name field now
Petr Menšík ac5057
-	  require that it be set to "." to ensure that any type list
Petr Menšík ac5057
-	  present is properly interpreted.  If the name field was omitted
Petr Menšík ac5057
-	  from the rule declaration and a type list was present it wouldn't
Petr Menšík ac5057
-	  be interpreted as expected.
Petr Menšík ac5057
+	  When recursion is enabled but the <command>allow-recursion</command>
Petr Menšík ac5057
+	  and <command>allow-query-cache</command> ACLs are not specified, they
Petr Menšík ac5057
+	  should be limited to local networks, but they were inadvertently set
Petr Menšík ac5057
+	  to match the default <command>allow-query</command>, thus allowing
Petr Menšík ac5057
+	  remote queries. This flaw is disclosed in CVE-2018-5738. [GL #309]
Petr Menšík ac5057
 	</para>
Petr Menšík ac5057
       </listitem>
Petr Menšík ac5057
     </itemizedlist>
Petr Menšík ac5057
-- 
Petr Menšík ac5057
2.14.4
Petr Menšík ac5057