Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: car...@debian.org

Hi SRM,

connman is affected by a stack based buffer overflow vulnerability,
CVE-2021-33833. The issue has been fixed in unstable, though it has
not yet migrated to testing (an unblock request has not been done
yet).

Debdiff for the change attached.

Regards,
Salvatore
diff -Nru connman-1.36/debian/changelog connman-1.36/debian/changelog
--- connman-1.36/debian/changelog       2021-02-05 18:11:52.000000000 +0100
+++ connman-1.36/debian/changelog       2021-06-12 14:48:40.000000000 +0200
@@ -1,3 +1,11 @@
+connman (1.36-2.1~deb10u2) buster; urgency=medium
+
+  * Non-maintainer upload.
+  * dnsproxy: Check the length of buffers before memcpy (CVE-2021-33833)
+    (Closes: #989662)
+
+ -- Salvatore Bonaccorso <car...@debian.org>  Sat, 12 Jun 2021 14:48:40 +0200
+
 connman (1.36-2.1~deb10u1) buster-security; urgency=high
 
   * Non-maintainer upload by the Security Team.
diff -Nru 
connman-1.36/debian/patches/dnsproxy-Check-the-length-of-buffers-before-memcpy.patch
 
connman-1.36/debian/patches/dnsproxy-Check-the-length-of-buffers-before-memcpy.patch
--- 
connman-1.36/debian/patches/dnsproxy-Check-the-length-of-buffers-before-memcpy.patch
        1970-01-01 01:00:00.000000000 +0100
+++ 
connman-1.36/debian/patches/dnsproxy-Check-the-length-of-buffers-before-memcpy.patch
        2021-06-12 14:47:31.000000000 +0200
@@ -0,0 +1,68 @@
+From: Valery Kashcheev <v.kasch...@omp.ru>
+Date: Mon, 7 Jun 2021 18:58:24 +0200
+Subject: dnsproxy: Check the length of buffers before memcpy
+Origin: 
https://git.kernel.org/pub/scm/network/connman/connman.git/commit?id=eceb2e8d2341c041df55a5e2f047d9a8c491463c
+Bug-Debian: https://bugs.debian.org/989662
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-33833
+
+Fix using a stack-based buffer overflow attack by checking the length of
+the ptr and uptr buffers.
+
+Fix debug message output.
+
+Fixes: CVE-2021-33833
+---
+ src/dnsproxy.c | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/src/dnsproxy.c b/src/dnsproxy.c
+index de52df5ad0a0..38dbdd71e425 100644
+--- a/src/dnsproxy.c
++++ b/src/dnsproxy.c
+@@ -1788,17 +1788,15 @@ static char *uncompress(int16_t field_count, char 
*start, char *end,
+                * tmp buffer.
+                */
+ 
+-              debug("pos %d ulen %d left %d name %s", pos, ulen,
+-                      (int)(uncomp_len - (uptr - uncompressed)), uptr);
+-
+-              ulen = strlen(name);
+-              if ((uptr + ulen + 1) > uncomp_end) {
++              ulen = strlen(name) + 1;
++              if ((uptr + ulen) > uncomp_end)
+                       goto out;
+-              }
+-              strncpy(uptr, name, uncomp_len - (uptr - uncompressed));
++              strncpy(uptr, name, ulen);
++
++              debug("pos %d ulen %d left %d name %s", pos, ulen,
++                      (int)(uncomp_end - (uptr + ulen)), uptr);
+ 
+               uptr += ulen;
+-              *uptr++ = '\0';
+ 
+               ptr += pos;
+ 
+@@ -1841,7 +1839,7 @@ static char *uncompress(int16_t field_count, char 
*start, char *end,
+               } else if (dns_type == ns_t_a || dns_type == ns_t_aaaa) {
+                       dlen = uptr[-2] << 8 | uptr[-1];
+ 
+-                      if (ptr + dlen > end) {
++                      if ((ptr + dlen) > end || (uptr + dlen) > uncomp_end) {
+                               debug("data len %d too long", dlen);
+                               goto out;
+                       }
+@@ -1880,6 +1878,10 @@ static char *uncompress(int16_t field_count, char 
*start, char *end,
+                        * refresh interval, retry interval, expiration
+                        * limit and minimum ttl). They are 20 bytes long.
+                        */
++                      if ((uptr + 20) > uncomp_end || (ptr + 20) > end) {
++                              debug("soa record too long");
++                              goto out;
++                      }
+                       memcpy(uptr, ptr, 20);
+                       uptr += 20;
+                       ptr += 20;
+-- 
+2.32.0
+
diff -Nru connman-1.36/debian/patches/series connman-1.36/debian/patches/series
--- connman-1.36/debian/patches/series  2021-02-05 18:05:34.000000000 +0100
+++ connman-1.36/debian/patches/series  2021-06-12 14:47:31.000000000 +0200
@@ -4,3 +4,4 @@
 gdhcp-Avoid-reading-invalid-data-in-dhcp_get_option.patch
 gdhcp-Avoid-leaking-stack-data-via-unitiialized-vari.patch
 dnsproxy-Add-length-checks-to-prevent-buffer-overflo.patch
+dnsproxy-Check-the-length-of-buffers-before-memcpy.patch

Reply via email to