|
|
e20e41 |
From f2ad2cecb55825f7e4409222de1688b9ceebceda Mon Sep 17 00:00:00 2001
|
|
|
e20e41 |
From: Simon Kelley <simon@thekelleys.org.uk>
|
|
|
e20e41 |
Date: Mon, 25 Sep 2017 20:16:50 +0100
|
|
|
e20e41 |
Subject: [PATCH 6/9] Security fix, CVE-2017-14495, OOM in DNS response
|
|
|
e20e41 |
creation.
|
|
|
e20e41 |
|
|
|
e20e41 |
Fix out-of-memory Dos vulnerability. An attacker which can
|
|
|
e20e41 |
send malicious DNS queries to dnsmasq can trigger memory
|
|
|
e20e41 |
allocations in the add_pseudoheader function
|
|
|
e20e41 |
The allocated memory is never freed which leads to a DoS
|
|
|
e20e41 |
through memory exhaustion. dnsmasq is vulnerable only
|
|
|
e20e41 |
if one of the following option is specified:
|
|
|
e20e41 |
--add-mac, --add-cpe-id or --add-subnet.
|
|
|
e20e41 |
---
|
|
|
e20e41 |
src/edns0.c | 8 +++++++-
|
|
|
e20e41 |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
e20e41 |
|
|
|
e20e41 |
diff --git a/src/edns0.c b/src/edns0.c
|
|
|
e20e41 |
index eed135e..5bdc133 100644
|
|
|
e20e41 |
--- a/src/edns0.c
|
|
|
e20e41 |
+++ b/src/edns0.c
|
|
|
e20e41 |
@@ -192,9 +192,15 @@ size_t add_pseudoheader(struct dns_header *header, size_t plen, unsigned char *l
|
|
|
e20e41 |
!(p = skip_section(p,
|
|
|
e20e41 |
ntohs(header->ancount) + ntohs(header->nscount) + ntohs(header->arcount),
|
|
|
e20e41 |
header, plen)))
|
|
|
e20e41 |
+ {
|
|
|
e20e41 |
+ free(buff);
|
|
|
e20e41 |
return plen;
|
|
|
e20e41 |
+ }
|
|
|
e20e41 |
if (p + 11 > limit)
|
|
|
e20e41 |
- return plen; /* Too big */
|
|
|
e20e41 |
+ {
|
|
|
e20e41 |
+ free(buff);
|
|
|
e20e41 |
+ return plen; /* Too big */
|
|
|
e20e41 |
+ }
|
|
|
e20e41 |
*p++ = 0; /* empty name */
|
|
|
e20e41 |
PUTSHORT(T_OPT, p);
|
|
|
e20e41 |
PUTSHORT(udp_sz, p); /* max packet length, 512 if not given in EDNS0 header */
|
|
|
e20e41 |
--
|
|
|
e20e41 |
2.9.5
|
|
|
e20e41 |
|