diff options
author | Seonah Moon <seonah1.moon@samsung.com> | 2023-02-20 14:04:19 +0900 |
---|---|---|
committer | seonah moon <seonah1.moon@samsung.com> | 2023-02-20 07:34:45 +0000 |
commit | f1dcbc8fb1cc1ef08751c31f3fd39600db74277c (patch) | |
tree | 59bf6e6ee17da81b89df8dead927859863f4f92d | |
parent | 69d5f318491054e9d38d44f2baa01e1cba619e7b (diff) | |
download | bind-f1dcbc8fb1cc1ef08751c31f3fd39600db74277c.tar.gz bind-f1dcbc8fb1cc1ef08751c31f3fd39600db74277c.tar.bz2 bind-f1dcbc8fb1cc1ef08751c31f3fd39600db74277c.zip |
[CVE-2021-25215] Properly answer queries for DNAME records that require the DNAME to be processed to resolve itself
See merge request isc-private/bind9!281
https://kb.isc.org/v1/docs/cve-2021-25215
Change-Id: Ibd8d0ee0e637eda7d4540c567dca6a7569f04058
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | lib/ns/query.c | 14 |
2 files changed, 14 insertions, 4 deletions
@@ -1,3 +1,7 @@ +5616. [security] named crashed when a DNAME record placed in the ANSWER + section during DNAME chasing turned out to be the final + answer to a client query. (CVE-2021-25215) [GL #2540] + 5562. [security] Fix off-by-one bug in ISC SPNEGO implementation. (CVE-2020-8625) [GL #2354] diff --git a/lib/ns/query.c b/lib/ns/query.c index 0d29a80a..7203070f 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -7306,10 +7306,16 @@ query_respond(query_ctx_t *qctx) { query_addnoqnameproof(qctx); /* - * We shouldn't ever fail to add 'rdataset' - * because it's already in the answer. - */ - INSIST(qctx->rdataset == NULL); + * 'qctx->rdataset' will only be non-NULL here if the ANSWER section of + * the message to be sent to the client already contains an RRset with + * the same owner name and the same type as 'qctx->rdataset'. This + * should never happen, with one exception: when chasing DNAME records, + * one of the DNAME records placed in the ANSWER section may turn out + * to be the final answer to the client's query, but we have no way of + * knowing that until now. In such a case, 'qctx->rdataset' will be + * freed later, so we do not need to free it here. + */ + INSIST(qctx->rdataset == NULL || qctx->qtype == dns_rdatatype_dname); query_addauth(qctx); |