From ce9aecdce07054e92b72e106ec3075a8cb16144b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Tue, 26 Sep 2017 18:00:01 +0200 Subject: [PATCH] Security fix, CVE-2017-14495, OOM in DNS response creation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix out-of-memory Dos vulnerability. An attacker which can send malicious DNS queries to dnsmasq can trigger memory allocations in the add_pseudoheader function The allocated memory is never freed which leads to a DoS through memory exhaustion. dnsmasq is vulnerable only if one of the following option is specified: --add-mac, --add-cpe-id or --add-subnet. Signed-off-by: Petr Menšík --- dnsmasq-2.77-CVE-2017-14495.patch | 41 +++++++++++++++++++++++++++++++ dnsmasq.spec | 3 +++ 2 files changed, 44 insertions(+) create mode 100644 dnsmasq-2.77-CVE-2017-14495.patch diff --git a/dnsmasq-2.77-CVE-2017-14495.patch b/dnsmasq-2.77-CVE-2017-14495.patch new file mode 100644 index 0000000..0f793aa --- /dev/null +++ b/dnsmasq-2.77-CVE-2017-14495.patch @@ -0,0 +1,41 @@ +From 51eadb692a5123b9838e5a68ecace3ac579a3a45 Mon Sep 17 00:00:00 2001 +From: Simon Kelley +Date: Mon, 25 Sep 2017 20:16:50 +0100 +Subject: [PATCH 7/9] Security fix, CVE-2017-14495, OOM in DNS response + creation. + +Fix out-of-memory Dos vulnerability. An attacker which can +send malicious DNS queries to dnsmasq can trigger memory +allocations in the add_pseudoheader function +The allocated memory is never freed which leads to a DoS +through memory exhaustion. dnsmasq is vulnerable only +if one of the following option is specified: +--add-mac, --add-cpe-id or --add-subnet. +--- + src/edns0.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/edns0.c b/src/edns0.c +index 95b74ee..89b2692 100644 +--- a/src/edns0.c ++++ b/src/edns0.c +@@ -192,9 +192,15 @@ size_t add_pseudoheader(struct dns_header *header, size_t plen, unsigned char *l + !(p = skip_section(p, + ntohs(header->ancount) + ntohs(header->nscount) + ntohs(header->arcount), + header, plen))) ++ { ++ free(buff); + return plen; ++ } + if (p + 11 > limit) +- return plen; /* Too big */ ++ { ++ free(buff); ++ return plen; /* Too big */ ++ } + *p++ = 0; /* empty name */ + PUTSHORT(T_OPT, p); + PUTSHORT(udp_sz, p); /* max packet length, 512 if not given in EDNS0 header */ +-- +2.9.5 + diff --git a/dnsmasq.spec b/dnsmasq.spec index 0e99f7b..0a77cff 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -28,6 +28,7 @@ Patch3: dnsmasq-2.77-CVE-2017-14492.patch Patch4: dnsmasq-2.77-CVE-2017-14493.patch Patch5: dnsmasq-2.77-CVE-2017-14494.patch Patch6: dnsmasq-2.77-CVE-2017-14496.patch +Patch7: dnsmasq-2.77-CVE-2017-14495.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -68,6 +69,7 @@ query/remove a DHCP server's leases. %patch4 -p1 -b .CVE-2017-14493 %patch5 -p1 -b .CVE-2017-14494 %patch6 -p1 -b .CVE-2017-14496 +%patch7 -p1 -b .CVE-2017-14495 # use /var/lib/dnsmasq instead of /var/lib/misc for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do @@ -160,6 +162,7 @@ rm -rf $RPM_BUILD_ROOT - Security fix, CVE-2017-14493, DHCPv6 - Stack buffer overflow - Security fix, CVE-2017-14494, Infoleak handling DHCPv6 - Security fix, CVE-2017-14496, Integer underflow in DNS response creation +- Security fix, CVE-2017-14495, OOM in DNS response creation * Thu Sep 14 2017 Petr Menšík - 2.77-7 - Fix CVE-2017-13704