Skip to contentSkip to conversation

dnsmasq: backport CVE fixes from dnsmasq 2.78

PATCH In review Joe Slater 3 participants 3 messages May 4, 2018 – May 27, 2018

lore
Share & tools
lore

Joe Slater

author
#0 lore raw

PATCH 1/1 dnsmasq: backport CVE fixes from dnsmasq 2.78

From: Zhang Xiao <[email protected]>

CVE-2017-1449{1-6}

---
 .../dnsmasq/dnsmasq-CVE-2017-14491-02.patch        |  75 ++++++
 .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491.patch   | 268 +++++++++++++++++++++
 .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14492.patch   |  37 +++
 .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14493.patch   |  37 +++
 .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14494.patch   |  37 +++
 .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14495.patch   |  48 ++++
 .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14496.patch   |  73 ++++++
 .../recipes-support/dnsmasq/dnsmasq_2.76.bb        |   7 +
 8 files changed, 582 insertions(+)
 create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491-02.patch
 create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491.patch
 create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14492.patch
 create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14493.patch
 create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14494.patch
 create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14495.patch
 create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14496.patch
meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491-02.patch new file +75 -0
new file mode 100644
index 0000000..3e73feb
@@ -0,0 +1,75 @@
+From e441ac5247cf8252ac8db08d53862af4065d9586 Mon Sep 17 00:00:00 2001
+From: Simon Kelley <[email protected]>
+Date: Tue, 26 Sep 2017 22:00:11 +0100
+Subject: [PATCH 7/7] Security fix, CVE-2017-14491, DNS heap buffer overflow.
+
+commit 62cb936cb7ad5f219715515ae7d32dd281a5aa1f upstream
+git://thekelleys.org.uk/dnsmasq
+
+Further fix to 0549c73b7ea6b22a3c49beb4d432f185a81efcbc
+Handles case when RR name is not a pointer to the question,
+only occurs for some auth-mode replies, therefore not
+detected by fuzzing (?)
+
+Upstream-Status: Backport
+
+Signed-off-by: Zhang Xiao <[email protected]>
+---
+ src/rfc1035.c | 27 +++++++++++++++------------
+ 1 file changed, 15 insertions(+), 12 deletions(-)
+
+diff --git a/src/rfc1035.c b/src/rfc1035.c
+index 78410d6..e5628ba 100644
+--- a/src/rfc1035.c
++++ b/src/rfc1035.c
+@@ -1071,32 +1071,35 @@ int add_resource_record(struct dns_header *header, char *limit, int *truncp, int
+ 
+   va_start(ap, format);   /* make ap point to 1st unamed argument */
+ 
+-  /* nameoffset (1 or 2) + type (2) + class (2) + ttl (4) + 0 (2) */
+-  CHECK_LIMIT(12);
+-
+   if (nameoffset > 0)
+     {
++      CHECK_LIMIT(2);
+       PUTSHORT(nameoffset | 0xc000, p);
+     }
+   else
+     {
+       char *name = va_arg(ap, char *);
+-      if (name)
+-	p = do_rfc1035_name(p, name, limit);
+-        if (!p)
+-          {
+-            va_end(ap);
+-            goto truncated;
+-          }
+-
++      if (name && !(p = do_rfc1035_name(p, name, limit)))
++	{
++	  va_end(ap);
++	  goto truncated;
++	}
++      
+       if (nameoffset < 0)
+ 	{
++	  CHECK_LIMIT(2);
+ 	  PUTSHORT(-nameoffset | 0xc000, p);
+ 	}
+       else
+-	*p++ = 0;
++	{
++	  CHECK_LIMIT(1);
++	  *p++ = 0;
++	}
+     }
+ 
++  /* type (2) + class (2) + ttl (4) + rdlen (2) */
++  CHECK_LIMIT(10);
++  
+   PUTSHORT(type, p);
+   PUTSHORT(class, p);
+   PUTLONG(ttl, p);      /* TTL */
+-- 
+2.11.0
+
meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491.patch new file +268 -0

268 lines not on this page · raw message

meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14492.patch new file +37 -0
new file mode 100644
index 0000000..1994931
@@ -0,0 +1,37 @@
+From 6a0e7dbac67a8393e4505e593e5c46544c53eae0 Mon Sep 17 00:00:00 2001
+From: Simon Kelley <[email protected]>
+Date: Mon, 25 Sep 2017 18:47:15 +0100
+Subject: [PATCH 2/7] Security fix, CVE-2017-14492, DHCPv6 RA heap overflow.
+
+commit 24036ea507862c7b7898b68289c8130f85599c10 upstream
+git://thekelleys.org.uk/dnsmasq
+
+Fix heap overflow in IPv6 router advertisement code.
+This is a potentially serious security hole, as a
+crafted RA request can overflow a buffer and crash or
+control dnsmasq. Attacker must be on the local network.
+
+Upstream-Status: Backport
+
+Signed-off-by: Zhang Xiao <[email protected]>
+---
+ src/radv.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/radv.c b/src/radv.c
+index 749b666..d09fe0e 100644
+--- a/src/radv.c
++++ b/src/radv.c
+@@ -198,6 +198,9 @@ void icmp6_packet(time_t now)
+       /* look for link-layer address option for logging */
+       if (sz >= 16 && packet[8] == ICMP6_OPT_SOURCE_MAC && (packet[9] * 8) + 8 <= sz)
+ 	{
++	  if ((packet[9] * 8 - 2) * 3 - 1 >= MAXDNAME) {
++	    return;
++	  }
+ 	  print_mac(daemon->namebuff, &packet[10], (packet[9] * 8) - 2);
+ 	  mac = daemon->namebuff;
+ 	}
+-- 
+2.11.0
+
meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14493.patch new file +37 -0
new file mode 100644
index 0000000..ae99cf4
@@ -0,0 +1,37 @@
+From f23f4be3cb72d307806e3d3ca14779f69ac5494c Mon Sep 17 00:00:00 2001
+From: Simon Kelley <[email protected]>
+Date: Mon, 25 Sep 2017 18:52:50 +0100
+Subject: [PATCH 3/7] Security fix, CVE-2017-14493, DHCPv6 - Stack buffer
+ overflow.
+
+commit 3d4ff1ba8419546490b464418223132529514033 upstream
+git://thekelleys.org.uk/dnsmasq
+
+Fix stack overflow in DHCPv6 code. An attacker who can send
+a DHCPv6 request to dnsmasq can overflow the stack frame and
+crash or control dnsmasq.
+
+Upstream-Status: Backport
+
+Signed-off-by: Zhang Xiao <[email protected]>
+---
+ src/rfc3315.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/rfc3315.c b/src/rfc3315.c
+index 73bdee4..8d18a28 100644
+--- a/src/rfc3315.c
++++ b/src/rfc3315.c
+@@ -206,6 +206,9 @@ static int dhcp6_maybe_relay(struct state *state, void *inbuff, size_t sz,
+   /* RFC-6939 */
+   if ((opt = opt6_find(opts, end, OPTION6_CLIENT_MAC, 3)))
+     {
++      if (opt6_len(opt) - 2 > DHCP_CHADDR_MAX) {
++        return 0;
++      }
+       state->mac_type = opt6_uint(opt, 0, 2);
+       state->mac_len = opt6_len(opt) - 2;
+       memcpy(&state->mac[0], opt6_ptr(opt, 2), state->mac_len);
+-- 
+2.11.0
+
meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14494.patch new file +37 -0
new file mode 100644
index 0000000..a6f0e2a
@@ -0,0 +1,37 @@
+From aba3f8df87d104d599920ea44e96191601638961 Mon Sep 17 00:00:00 2001
+From: Simon Kelley <[email protected]>
+Date: Mon, 25 Sep 2017 20:05:11 +0100
+Subject: [PATCH 4/7] Security fix, CVE-2017-14494, Infoleak handling DHCPv6
+ forwarded requests.
+
+commit 33e3f1029c9ec6c63e430ff51063a6301d4b2262 upstream
+git://thekelleys.org.uk/dnsmasq
+
+Fix information leak in DHCPv6. A crafted DHCPv6 packet can
+cause dnsmasq to forward memory from outside the packet
+buffer to a DHCPv6 server when acting as a relay.
+
+Upstream-Status: Backport
+
+Signed-off-by: Zhang Xiao <[email protected]>
+---
+ src/rfc3315.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/rfc3315.c b/src/rfc3315.c
+index 8d18a28..03b3f84 100644
+--- a/src/rfc3315.c
++++ b/src/rfc3315.c
+@@ -216,6 +216,9 @@ static int dhcp6_maybe_relay(struct state *state, void *inbuff, size_t sz,
+   
+   for (opt = opts; opt; opt = opt6_next(opt, end))
+     {
++      if (opt6_ptr(opt, 0) + opt6_len(opt) >= end) {
++        return 0;
++      }
+       int o = new_opt6(opt6_type(opt));
+       if (opt6_type(opt) == OPTION6_RELAY_MSG)
+ 	{
+-- 
+2.11.0
+
meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14495.patch new file +48 -0

48 lines not on this page · raw message

meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14496.patch new file +73 -0

73 lines not on this page · raw message

meta-networking/recipes-support/dnsmasq/dnsmasq_2.76.bb +7 -0
index 41573d9..5b68d98 100644
@@ -2,6 +2,13 @@ require dnsmasq.inc
 
 SRC_URI += "\
     file://lua.patch \
+    file://dnsmasq-CVE-2017-14491.patch \
+    file://dnsmasq-CVE-2017-14492.patch \
+    file://dnsmasq-CVE-2017-14493.patch \
+    file://dnsmasq-CVE-2017-14494.patch \
+    file://dnsmasq-CVE-2017-14496.patch \
+    file://dnsmasq-CVE-2017-14495.patch \
+    file://dnsmasq-CVE-2017-14491-02.patch \
 "
 
 SRC_URI[dnsmasq-2.76.md5sum] = "6610f8233ca89b15a1bb47c788ffb84f"
Signature · 1 line
2.7.4
#1 lore raw

Khem,

Are you handling backports for morty as well?
This _is_ in patchworks so it might reduce your ping emails if you state that you'll get to the backlog over the coming month or so.

Thanks,
../Randy

Quoted 24 lines · Joe Slater

From: Zhang Xiao <[email protected]>

CVE-2017-1449{1-6}

---
  .../dnsmasq/dnsmasq-CVE-2017-14491-02.patch        |  75 ++++++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491.patch   | 268 +++++++++++++++++++++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14492.patch   |  37 +++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14493.patch   |  37 +++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14494.patch   |  37 +++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14495.patch   |  48 ++++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14496.patch   |  73 ++++++
  .../recipes-support/dnsmasq/dnsmasq_2.76.bb        |   7 +
  8 files changed, 582 insertions(+)

create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491-02.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14492.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14493.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14494.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14495.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14496.patch

Signature · 2 lines
# Randy MacLeod
# Wind River Linux
#2 lore raw
Quoted 4 lines · Randy MacLeod

Khem,

Are you handling backports for morty as well?

Nope. That is on me still.  I should be processing your request this weekend.

- armin

Quoted 42 lines

This _is_ in patchworks so it might reduce your ping emails if you state that you'll get to the backlog over the coming month or so.

Thanks,
../Randy

Quoted 32 lines · Joe Slater

From: Zhang Xiao <[email protected]>

CVE-2017-1449{1-6}

---
  .../dnsmasq/dnsmasq-CVE-2017-14491-02.patch        |  75 ++++++ .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491.patch   | 268
+++++++++++++++++++++

  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14492.patch   |  37 +++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14493.patch   |  37 +++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14494.patch   |  37 +++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14495.patch   |  48 ++++
  .../dnsmasq/dnsmasq/dnsmasq-CVE-2017-14496.patch   |  73 ++++++
  .../recipes-support/dnsmasq/dnsmasq_2.76.bb        |   7 +
  8 files changed, 582 insertions(+)

  create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491-02.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14491.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14492.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14493.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14494.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14495.patch create mode 100644 meta-networking/recipes-support/dnsmasq/dnsmasq/dnsmasq-CVE-2017-14496.patch