|
|
900526 |
From f05af77f32742b8e601d766e1f2fe6a480c7e735 Mon Sep 17 00:00:00 2001
|
|
|
900526 |
From: rpm-build <rpm-build>
|
|
|
900526 |
Date: Wed, 8 Feb 2017 12:23:20 +0100
|
|
|
900526 |
Subject: [PATCH] 4557. [security] Combining dns64 and rpz can result in
|
|
|
900526 |
dereferencing a NULL pointer (read). (CVE-2017-3135)
|
|
|
900526 |
[RT#44434]
|
|
|
900526 |
|
|
|
900526 |
---
|
|
|
900526 |
bin/named/query.c | 59 +++++++++++++++++++++++++-----------------------------
|
|
|
900526 |
lib/dns/message.c | 6 +++---
|
|
|
900526 |
lib/dns/rdataset.c | 1 +
|
|
|
900526 |
3 files changed, 31 insertions(+), 35 deletions(-)
|
|
|
900526 |
|
|
|
900526 |
diff --git a/bin/named/query.c b/bin/named/query.c
|
|
|
900526 |
index 1975dfc..f60078b 100644
|
|
|
900526 |
--- a/bin/named/query.c
|
|
|
900526 |
+++ b/bin/named/query.c
|
|
|
900526 |
@@ -5591,9 +5591,10 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
dns_rpz_st_t *rpz_st;
|
|
|
900526 |
isc_boolean_t resuming;
|
|
|
900526 |
int line = -1;
|
|
|
900526 |
- isc_boolean_t dns64_exclude, dns64;
|
|
|
900526 |
+ isc_boolean_t dns64_exclude, dns64, rpz;
|
|
|
900526 |
dns_clientinfomethods_t cm;
|
|
|
900526 |
dns_clientinfo_t ci;
|
|
|
900526 |
+ dns_name_t *rpzqname;
|
|
|
900526 |
|
|
|
900526 |
CTRACE("query_find");
|
|
|
900526 |
|
|
|
900526 |
@@ -5619,7 +5620,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
zone = NULL;
|
|
|
900526 |
need_wildcardproof = ISC_FALSE;
|
|
|
900526 |
empty_wild = ISC_FALSE;
|
|
|
900526 |
- dns64_exclude = dns64 = ISC_FALSE;
|
|
|
900526 |
+ dns64_exclude = dns64 = rpz = ISC_FALSE;
|
|
|
900526 |
options = 0;
|
|
|
900526 |
resuming = ISC_FALSE;
|
|
|
900526 |
is_zone = ISC_FALSE;
|
|
|
900526 |
@@ -5736,6 +5737,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
authoritative = ISC_FALSE;
|
|
|
900526 |
version = NULL;
|
|
|
900526 |
need_wildcardproof = ISC_FALSE;
|
|
|
900526 |
+ rpz = ISC_FALSE;
|
|
|
900526 |
|
|
|
900526 |
if (client->view->checknames &&
|
|
|
900526 |
!dns_rdata_checkowner(client->query.qname,
|
|
|
900526 |
@@ -5860,11 +5862,29 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
}
|
|
|
900526 |
|
|
|
900526 |
/*
|
|
|
900526 |
- * Now look for an answer in the database.
|
|
|
900526 |
+ * Now look for an answer in the database. If this is a dns64
|
|
|
900526 |
+ * AAAA lookup on a rpz database adjust the qname.
|
|
|
900526 |
*/
|
|
|
900526 |
- result = dns_db_findext(db, client->query.qname, version, type,
|
|
|
900526 |
+ if (dns64 && rpz)
|
|
|
900526 |
+ rpzqname = client->query.rpz_st->qname;
|
|
|
900526 |
+ else
|
|
|
900526 |
+ rpzqname = client->query.qname;
|
|
|
900526 |
+
|
|
|
900526 |
+ result = dns_db_findext(db, rpzqname, version, type,
|
|
|
900526 |
client->query.dboptions, client->now,
|
|
|
900526 |
&node, fname, &cm, &ci, rdataset, sigrdataset);
|
|
|
900526 |
+ /*
|
|
|
900526 |
+ * Fixup fname and sigrdataset.
|
|
|
900526 |
+ */
|
|
|
900526 |
+ if (dns64 && rpz) {
|
|
|
900526 |
+ isc_result_t rresult;
|
|
|
900526 |
+
|
|
|
900526 |
+ rresult = dns_name_copy(client->query.qname, fname, NULL);
|
|
|
900526 |
+ RUNTIME_CHECK(rresult == ISC_R_SUCCESS);
|
|
|
900526 |
+ if (sigrdataset != NULL &&
|
|
|
900526 |
+ dns_rdataset_isassociated(sigrdataset))
|
|
|
900526 |
+ dns_rdataset_disassociate(sigrdataset);
|
|
|
900526 |
+ }
|
|
|
900526 |
|
|
|
900526 |
resume:
|
|
|
900526 |
CTRACE("query_find: resume");
|
|
|
900526 |
@@ -6067,9 +6087,11 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
switch (rpz_st->m.policy) {
|
|
|
900526 |
case DNS_RPZ_POLICY_NXDOMAIN:
|
|
|
900526 |
result = DNS_R_NXDOMAIN;
|
|
|
900526 |
+ rpz = ISC_TRUE;
|
|
|
900526 |
break;
|
|
|
900526 |
case DNS_RPZ_POLICY_NODATA:
|
|
|
900526 |
result = DNS_R_NXRRSET;
|
|
|
900526 |
+ rpz = ISC_TRUE;
|
|
|
900526 |
break;
|
|
|
900526 |
case DNS_RPZ_POLICY_RECORD:
|
|
|
900526 |
result = rpz_st->m.result;
|
|
|
900526 |
@@ -6089,6 +6111,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
rdataset->ttl = ISC_MIN(rdataset->ttl,
|
|
|
900526 |
rpz_st->m.ttl);
|
|
|
900526 |
}
|
|
|
900526 |
+ rpz = ISC_TRUE;
|
|
|
900526 |
break;
|
|
|
900526 |
case DNS_RPZ_POLICY_WILDCNAME:
|
|
|
900526 |
result = dns_rdataset_first(rdataset);
|
|
|
900526 |
@@ -6130,7 +6153,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
client->attributes &= ~(NS_CLIENTATTR_WANTDNSSEC |
|
|
|
900526 |
DNS_MESSAGEFLAG_AD);
|
|
|
900526 |
query_putrdataset(client, &sigrdataset);
|
|
|
900526 |
- rpz_st->q.is_zone = is_zone;
|
|
|
900526 |
is_zone = ISC_TRUE;
|
|
|
900526 |
rpz_log_rewrite(client, ISC_FALSE, rpz_st->m.policy,
|
|
|
900526 |
rpz_st->m.type, zone, rpz_st->qname);
|
|
|
900526 |
@@ -6509,15 +6531,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
rdataset = NULL;
|
|
|
900526 |
sigrdataset = NULL;
|
|
|
900526 |
type = qtype = dns_rdatatype_a;
|
|
|
900526 |
- rpz_st = client->query.rpz_st;
|
|
|
900526 |
- if (rpz_st != NULL) {
|
|
|
900526 |
- /*
|
|
|
900526 |
- * Arrange for RPZ rewriting of any A records.
|
|
|
900526 |
- */
|
|
|
900526 |
- if ((rpz_st->state & DNS_RPZ_REWRITTEN) != 0)
|
|
|
900526 |
- is_zone = rpz_st->q.is_zone;
|
|
|
900526 |
- rpz_st_clear(client);
|
|
|
900526 |
- }
|
|
|
900526 |
dns64 = ISC_TRUE;
|
|
|
900526 |
goto db_find;
|
|
|
900526 |
}
|
|
|
900526 |
@@ -6786,15 +6799,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
sigrdataset = NULL;
|
|
|
900526 |
fname = NULL;
|
|
|
900526 |
type = qtype = dns_rdatatype_a;
|
|
|
900526 |
- rpz_st = client->query.rpz_st;
|
|
|
900526 |
- if (rpz_st != NULL) {
|
|
|
900526 |
- /*
|
|
|
900526 |
- * Arrange for RPZ rewriting of any A records.
|
|
|
900526 |
- */
|
|
|
900526 |
- if ((rpz_st->state & DNS_RPZ_REWRITTEN) != 0)
|
|
|
900526 |
- is_zone = rpz_st->q.is_zone;
|
|
|
900526 |
- rpz_st_clear(client);
|
|
|
900526 |
- }
|
|
|
900526 |
dns64 = ISC_TRUE;
|
|
|
900526 |
goto db_find;
|
|
|
900526 |
}
|
|
|
900526 |
@@ -7296,15 +7300,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|
|
900526 |
rdataset = NULL;
|
|
|
900526 |
sigrdataset = NULL;
|
|
|
900526 |
type = qtype = dns_rdatatype_a;
|
|
|
900526 |
- rpz_st = client->query.rpz_st;
|
|
|
900526 |
- if (rpz_st != NULL) {
|
|
|
900526 |
- /*
|
|
|
900526 |
- * Arrange for RPZ rewriting of any A records.
|
|
|
900526 |
- */
|
|
|
900526 |
- if ((rpz_st->state & DNS_RPZ_REWRITTEN) != 0)
|
|
|
900526 |
- is_zone = rpz_st->q.is_zone;
|
|
|
900526 |
- rpz_st_clear(client);
|
|
|
900526 |
- }
|
|
|
900526 |
dns64_exclude = dns64 = ISC_TRUE;
|
|
|
900526 |
goto db_find;
|
|
|
900526 |
}
|
|
|
900526 |
diff --git a/lib/dns/message.c b/lib/dns/message.c
|
|
|
900526 |
index 884107e..1417067 100644
|
|
|
900526 |
--- a/lib/dns/message.c
|
|
|
900526 |
+++ b/lib/dns/message.c
|
|
|
900526 |
@@ -1234,8 +1234,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
|
|
900526 |
{
|
|
|
900526 |
isc_region_t r;
|
|
|
900526 |
unsigned int count, rdatalen;
|
|
|
900526 |
- dns_name_t *name;
|
|
|
900526 |
- dns_name_t *name2;
|
|
|
900526 |
+ dns_name_t *name = NULL;
|
|
|
900526 |
+ dns_name_t *name2 = NULL;
|
|
|
900526 |
dns_offsets_t *offsets;
|
|
|
900526 |
dns_rdataset_t *rdataset;
|
|
|
900526 |
dns_rdatalist_t *rdatalist;
|
|
|
900526 |
@@ -1245,7 +1245,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
|
|
900526 |
dns_rdata_t *rdata;
|
|
|
900526 |
dns_ttl_t ttl;
|
|
|
900526 |
dns_namelist_t *section;
|
|
|
900526 |
- isc_boolean_t free_name, free_rdataset;
|
|
|
900526 |
+ isc_boolean_t free_name = ISC_FALSE, free_rdataset = ISC_FALSE;
|
|
|
900526 |
isc_boolean_t preserve_order, best_effort, seen_problem;
|
|
|
900526 |
isc_boolean_t issigzero;
|
|
|
900526 |
|
|
|
900526 |
diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c
|
|
|
900526 |
index 026d771..483ddfb 100644
|
|
|
900526 |
--- a/lib/dns/rdataset.c
|
|
|
900526 |
+++ b/lib/dns/rdataset.c
|
|
|
900526 |
@@ -336,6 +336,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|
|
900526 |
*/
|
|
|
900526 |
|
|
|
900526 |
REQUIRE(DNS_RDATASET_VALID(rdataset));
|
|
|
900526 |
+ REQUIRE(rdataset->methods != NULL);
|
|
|
900526 |
REQUIRE(countp != NULL);
|
|
|
900526 |
REQUIRE((order == NULL) == (order_arg == NULL));
|
|
|
900526 |
REQUIRE(cctx != NULL && cctx->mctx != NULL);
|
|
|
900526 |
--
|
|
|
900526 |
2.9.3
|
|
|
900526 |
|