diff options
Diffstat (limited to 'meta/recipes-connectivity/bind/bind/CVE-2016-1286_2.patch')
-rw-r--r-- | meta/recipes-connectivity/bind/bind/CVE-2016-1286_2.patch | 317 |
1 files changed, 0 insertions, 317 deletions
diff --git a/meta/recipes-connectivity/bind/bind/CVE-2016-1286_2.patch b/meta/recipes-connectivity/bind/bind/CVE-2016-1286_2.patch deleted file mode 100644 index 5f5cb0d340..0000000000 --- a/meta/recipes-connectivity/bind/bind/CVE-2016-1286_2.patch +++ /dev/null | |||
@@ -1,317 +0,0 @@ | |||
1 | From 7602be276a73a6eb5431c5acd9718e68a55e8b61 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mark Andrews <marka@isc.org> | ||
3 | Date: Mon, 29 Feb 2016 07:16:48 +1100 | ||
4 | Subject: [PATCH] Part 2 of: 4319. [security] Fix resolver assertion | ||
5 | failure due to improper DNAME handling when parsing | ||
6 | fetch reply messages. (CVE-2016-1286) [RT #41753] | ||
7 | |||
8 | CVE: CVE-2016-1286 | ||
9 | Upstream-Status: Backport | ||
10 | |||
11 | (cherry picked from commit 2de89ee9de8c8da9dc153a754b02dcdbb7fe2374) | ||
12 | Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com> | ||
13 | --- | ||
14 | lib/dns/resolver.c | 192 ++++++++++++++++++++++++++--------------------------- | ||
15 | 1 file changed, 93 insertions(+), 99 deletions(-) | ||
16 | |||
17 | diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c | ||
18 | index 70aba87..41e9df4 100644 | ||
19 | --- a/lib/dns/resolver.c | ||
20 | +++ b/lib/dns/resolver.c | ||
21 | @@ -6074,14 +6074,11 @@ cname_target(dns_rdataset_t *rdataset, dns_name_t *tname) { | ||
22 | } | ||
23 | |||
24 | static inline isc_result_t | ||
25 | -dname_target(fetchctx_t *fctx, dns_rdataset_t *rdataset, dns_name_t *qname, | ||
26 | - dns_name_t *oname, dns_fixedname_t *fixeddname) | ||
27 | +dname_target(dns_rdataset_t *rdataset, dns_name_t *qname, | ||
28 | + unsigned int nlabels, dns_fixedname_t *fixeddname) | ||
29 | { | ||
30 | isc_result_t result; | ||
31 | dns_rdata_t rdata = DNS_RDATA_INIT; | ||
32 | - unsigned int nlabels; | ||
33 | - int order; | ||
34 | - dns_namereln_t namereln; | ||
35 | dns_rdata_dname_t dname; | ||
36 | dns_fixedname_t prefix; | ||
37 | |||
38 | @@ -6096,21 +6093,6 @@ dname_target(fetchctx_t *fctx, dns_rdataset_t *rdataset, dns_name_t *qname, | ||
39 | if (result != ISC_R_SUCCESS) | ||
40 | return (result); | ||
41 | |||
42 | - /* | ||
43 | - * Get the prefix of qname. | ||
44 | - */ | ||
45 | - namereln = dns_name_fullcompare(qname, oname, &order, &nlabels); | ||
46 | - if (namereln != dns_namereln_subdomain) { | ||
47 | - char qbuf[DNS_NAME_FORMATSIZE]; | ||
48 | - char obuf[DNS_NAME_FORMATSIZE]; | ||
49 | - | ||
50 | - dns_rdata_freestruct(&dname); | ||
51 | - dns_name_format(qname, qbuf, sizeof(qbuf)); | ||
52 | - dns_name_format(oname, obuf, sizeof(obuf)); | ||
53 | - log_formerr(fctx, "unrelated DNAME in answer: " | ||
54 | - "%s is not in %s", qbuf, obuf); | ||
55 | - return (DNS_R_FORMERR); | ||
56 | - } | ||
57 | dns_fixedname_init(&prefix); | ||
58 | dns_name_split(qname, nlabels, dns_fixedname_name(&prefix), NULL); | ||
59 | dns_fixedname_init(fixeddname); | ||
60 | @@ -6736,13 +6718,13 @@ static isc_result_t | ||
61 | answer_response(fetchctx_t *fctx) { | ||
62 | isc_result_t result; | ||
63 | dns_message_t *message; | ||
64 | - dns_name_t *name, *qname, tname, *ns_name; | ||
65 | + dns_name_t *name, *dname, *qname, tname, *ns_name; | ||
66 | dns_rdataset_t *rdataset, *ns_rdataset; | ||
67 | isc_boolean_t done, external, chaining, aa, found, want_chaining; | ||
68 | isc_boolean_t have_answer, found_cname, found_type, wanted_chaining; | ||
69 | unsigned int aflag; | ||
70 | dns_rdatatype_t type; | ||
71 | - dns_fixedname_t dname, fqname; | ||
72 | + dns_fixedname_t fdname, fqname; | ||
73 | dns_view_t *view; | ||
74 | |||
75 | FCTXTRACE("answer_response"); | ||
76 | @@ -6770,10 +6752,15 @@ answer_response(fetchctx_t *fctx) { | ||
77 | view = fctx->res->view; | ||
78 | result = dns_message_firstname(message, DNS_SECTION_ANSWER); | ||
79 | while (!done && result == ISC_R_SUCCESS) { | ||
80 | + dns_namereln_t namereln; | ||
81 | + int order; | ||
82 | + unsigned int nlabels; | ||
83 | + | ||
84 | name = NULL; | ||
85 | dns_message_currentname(message, DNS_SECTION_ANSWER, &name); | ||
86 | external = ISC_TF(!dns_name_issubdomain(name, &fctx->domain)); | ||
87 | - if (dns_name_equal(name, qname)) { | ||
88 | + namereln = dns_name_fullcompare(qname, name, &order, &nlabels); | ||
89 | + if (namereln == dns_namereln_equal) { | ||
90 | wanted_chaining = ISC_FALSE; | ||
91 | for (rdataset = ISC_LIST_HEAD(name->list); | ||
92 | rdataset != NULL; | ||
93 | @@ -6898,10 +6885,11 @@ answer_response(fetchctx_t *fctx) { | ||
94 | */ | ||
95 | INSIST(!external); | ||
96 | if (aflag == | ||
97 | - DNS_RDATASETATTR_ANSWER) | ||
98 | + DNS_RDATASETATTR_ANSWER) { | ||
99 | have_answer = ISC_TRUE; | ||
100 | - name->attributes |= | ||
101 | - DNS_NAMEATTR_ANSWER; | ||
102 | + name->attributes |= | ||
103 | + DNS_NAMEATTR_ANSWER; | ||
104 | + } | ||
105 | rdataset->attributes |= aflag; | ||
106 | if (aa) | ||
107 | rdataset->trust = | ||
108 | @@ -6956,6 +6944,8 @@ answer_response(fetchctx_t *fctx) { | ||
109 | if (wanted_chaining) | ||
110 | chaining = ISC_TRUE; | ||
111 | } else { | ||
112 | + dns_rdataset_t *dnameset = NULL; | ||
113 | + | ||
114 | /* | ||
115 | * Look for a DNAME (or its SIG). Anything else is | ||
116 | * ignored. | ||
117 | @@ -6963,10 +6953,8 @@ answer_response(fetchctx_t *fctx) { | ||
118 | wanted_chaining = ISC_FALSE; | ||
119 | for (rdataset = ISC_LIST_HEAD(name->list); | ||
120 | rdataset != NULL; | ||
121 | - rdataset = ISC_LIST_NEXT(rdataset, link)) { | ||
122 | - isc_boolean_t found_dname = ISC_FALSE; | ||
123 | - dns_name_t *dname_name; | ||
124 | - | ||
125 | + rdataset = ISC_LIST_NEXT(rdataset, link)) | ||
126 | + { | ||
127 | /* | ||
128 | * Only pass DNAME or RRSIG(DNAME). | ||
129 | */ | ||
130 | @@ -6980,20 +6968,41 @@ answer_response(fetchctx_t *fctx) { | ||
131 | * its signature should not be external. | ||
132 | */ | ||
133 | if (!chaining && external) { | ||
134 | - log_formerr(fctx, "external DNAME"); | ||
135 | + char qbuf[DNS_NAME_FORMATSIZE]; | ||
136 | + char obuf[DNS_NAME_FORMATSIZE]; | ||
137 | + | ||
138 | + dns_name_format(name, qbuf, | ||
139 | + sizeof(qbuf)); | ||
140 | + dns_name_format(&fctx->domain, obuf, | ||
141 | + sizeof(obuf)); | ||
142 | + log_formerr(fctx, "external DNAME or " | ||
143 | + "RRSIG covering DNAME " | ||
144 | + "in answer: %s is " | ||
145 | + "not in %s", qbuf, obuf); | ||
146 | + return (DNS_R_FORMERR); | ||
147 | + } | ||
148 | + | ||
149 | + if (namereln != dns_namereln_subdomain) { | ||
150 | + char qbuf[DNS_NAME_FORMATSIZE]; | ||
151 | + char obuf[DNS_NAME_FORMATSIZE]; | ||
152 | + | ||
153 | + dns_name_format(qname, qbuf, | ||
154 | + sizeof(qbuf)); | ||
155 | + dns_name_format(name, obuf, | ||
156 | + sizeof(obuf)); | ||
157 | + log_formerr(fctx, "unrelated DNAME " | ||
158 | + "in answer: %s is " | ||
159 | + "not in %s", qbuf, obuf); | ||
160 | return (DNS_R_FORMERR); | ||
161 | } | ||
162 | |||
163 | - found = ISC_FALSE; | ||
164 | aflag = 0; | ||
165 | if (rdataset->type == dns_rdatatype_dname) { | ||
166 | - found = ISC_TRUE; | ||
167 | want_chaining = ISC_TRUE; | ||
168 | POST(want_chaining); | ||
169 | aflag = DNS_RDATASETATTR_ANSWER; | ||
170 | - result = dname_target(fctx, rdataset, | ||
171 | - qname, name, | ||
172 | - &dname); | ||
173 | + result = dname_target(rdataset, qname, | ||
174 | + nlabels, &fdname); | ||
175 | if (result == ISC_R_NOSPACE) { | ||
176 | /* | ||
177 | * We can't construct the | ||
178 | @@ -7005,14 +7014,12 @@ answer_response(fetchctx_t *fctx) { | ||
179 | } else if (result != ISC_R_SUCCESS) | ||
180 | return (result); | ||
181 | else | ||
182 | - found_dname = ISC_TRUE; | ||
183 | + dnameset = rdataset; | ||
184 | |||
185 | - dname_name = dns_fixedname_name(&dname); | ||
186 | + dname = dns_fixedname_name(&fdname); | ||
187 | if (!is_answertarget_allowed(view, | ||
188 | - qname, | ||
189 | - rdataset->type, | ||
190 | - dname_name, | ||
191 | - &fctx->domain)) { | ||
192 | + qname, rdataset->type, | ||
193 | + dname, &fctx->domain)) { | ||
194 | return (DNS_R_SERVFAIL); | ||
195 | } | ||
196 | } else { | ||
197 | @@ -7020,73 +7027,60 @@ answer_response(fetchctx_t *fctx) { | ||
198 | * We've found a signature that | ||
199 | * covers the DNAME. | ||
200 | */ | ||
201 | - found = ISC_TRUE; | ||
202 | aflag = DNS_RDATASETATTR_ANSWERSIG; | ||
203 | } | ||
204 | |||
205 | - if (found) { | ||
206 | + /* | ||
207 | + * We've found an answer to our | ||
208 | + * question. | ||
209 | + */ | ||
210 | + name->attributes |= DNS_NAMEATTR_CACHE; | ||
211 | + rdataset->attributes |= DNS_RDATASETATTR_CACHE; | ||
212 | + rdataset->trust = dns_trust_answer; | ||
213 | + if (!chaining) { | ||
214 | /* | ||
215 | - * We've found an answer to our | ||
216 | - * question. | ||
217 | + * This data is "the" answer to | ||
218 | + * our question only if we're | ||
219 | + * not chaining. | ||
220 | */ | ||
221 | - name->attributes |= | ||
222 | - DNS_NAMEATTR_CACHE; | ||
223 | - rdataset->attributes |= | ||
224 | - DNS_RDATASETATTR_CACHE; | ||
225 | - rdataset->trust = dns_trust_answer; | ||
226 | - if (!chaining) { | ||
227 | - /* | ||
228 | - * This data is "the" answer | ||
229 | - * to our question only if | ||
230 | - * we're not chaining. | ||
231 | - */ | ||
232 | - INSIST(!external); | ||
233 | - if (aflag == | ||
234 | - DNS_RDATASETATTR_ANSWER) | ||
235 | - have_answer = ISC_TRUE; | ||
236 | + INSIST(!external); | ||
237 | + if (aflag == DNS_RDATASETATTR_ANSWER) { | ||
238 | + have_answer = ISC_TRUE; | ||
239 | name->attributes |= | ||
240 | DNS_NAMEATTR_ANSWER; | ||
241 | - rdataset->attributes |= aflag; | ||
242 | - if (aa) | ||
243 | - rdataset->trust = | ||
244 | - dns_trust_authanswer; | ||
245 | - } else if (external) { | ||
246 | - rdataset->attributes |= | ||
247 | - DNS_RDATASETATTR_EXTERNAL; | ||
248 | - } | ||
249 | - | ||
250 | - /* | ||
251 | - * DNAME chaining. | ||
252 | - */ | ||
253 | - if (found_dname) { | ||
254 | - /* | ||
255 | - * Copy the dname into the | ||
256 | - * qname fixed name. | ||
257 | - * | ||
258 | - * Although we check for | ||
259 | - * failure of the copy | ||
260 | - * operation, in practice it | ||
261 | - * should never fail since | ||
262 | - * we already know that the | ||
263 | - * result fits in a fixedname. | ||
264 | - */ | ||
265 | - dns_fixedname_init(&fqname); | ||
266 | - result = dns_name_copy( | ||
267 | - dns_fixedname_name(&dname), | ||
268 | - dns_fixedname_name(&fqname), | ||
269 | - NULL); | ||
270 | - if (result != ISC_R_SUCCESS) | ||
271 | - return (result); | ||
272 | - wanted_chaining = ISC_TRUE; | ||
273 | - name->attributes |= | ||
274 | - DNS_NAMEATTR_CHAINING; | ||
275 | - rdataset->attributes |= | ||
276 | - DNS_RDATASETATTR_CHAINING; | ||
277 | - qname = dns_fixedname_name( | ||
278 | - &fqname); | ||
279 | } | ||
280 | + rdataset->attributes |= aflag; | ||
281 | + if (aa) | ||
282 | + rdataset->trust = | ||
283 | + dns_trust_authanswer; | ||
284 | + } else if (external) { | ||
285 | + rdataset->attributes |= | ||
286 | + DNS_RDATASETATTR_EXTERNAL; | ||
287 | } | ||
288 | } | ||
289 | + | ||
290 | + /* | ||
291 | + * DNAME chaining. | ||
292 | + */ | ||
293 | + if (dnameset != NULL) { | ||
294 | + /* | ||
295 | + * Copy the dname into the qname fixed name. | ||
296 | + * | ||
297 | + * Although we check for failure of the copy | ||
298 | + * operation, in practice it should never fail | ||
299 | + * since we already know that the result fits | ||
300 | + * in a fixedname. | ||
301 | + */ | ||
302 | + dns_fixedname_init(&fqname); | ||
303 | + qname = dns_fixedname_name(&fqname); | ||
304 | + result = dns_name_copy(dname, qname, NULL); | ||
305 | + if (result != ISC_R_SUCCESS) | ||
306 | + return (result); | ||
307 | + wanted_chaining = ISC_TRUE; | ||
308 | + name->attributes |= DNS_NAMEATTR_CHAINING; | ||
309 | + dnameset->attributes |= | ||
310 | + DNS_RDATASETATTR_CHAINING; | ||
311 | + } | ||
312 | if (wanted_chaining) | ||
313 | chaining = ISC_TRUE; | ||
314 | } | ||
315 | -- | ||
316 | 1.9.1 | ||
317 | |||