Skip to contentSkip to conversation

c-ares: CVE-2023-32067 0-byte UDP payload Denial of Service

PATCH In review [email protected] 2 participants 3 messages Jul 18, 2023 – Jul 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 c-ares: CVE-2023-32067 0-byte UDP payload Denial of Service

From: Vijay Anusuri <[email protected]>

Upstream-Status: Backport from https://github.com/c-ares/c-ares/commit/b9b8413cfdb70a3f99e1573333b23052d57ec1ae

---
 .../c-ares/c-ares/CVE-2023-32067.patch        | 84 +++++++++++++++++++
 .../recipes-support/c-ares/c-ares_1.18.1.bb   |  1 +
 2 files changed, 85 insertions(+)
 create mode 100644 meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +84 -0
new file mode 100644
index 000000000..63192d3c8
@@ -0,0 +1,84 @@
+From b9b8413cfdb70a3f99e1573333b23052d57ec1ae Mon Sep 17 00:00:00 2001
+From: Brad House <[email protected]>
+Date: Mon, 22 May 2023 06:51:49 -0400
+Subject: [PATCH] Merge pull request from GHSA-9g78-jv2r-p7vc
+
+Link: https://github.com/c-ares/c-ares/releases/tag/cares-1_19_1
+
+Upstream-Status: Backport [https://github.com/c-ares/c-ares/commit/b9b8413cfdb70a3f99e1573333b23052d57ec1ae]
+CVE: CVE-2023-32067
+Signed-off-by: Vijay Anusuri <[email protected]>
+---
+ src/lib/ares_process.c | 41 +++++++++++++++++++++++++----------------
+ 1 file changed, 25 insertions(+), 16 deletions(-)
+
+diff --git a/src/lib/ares_process.c b/src/lib/ares_process.c
+index bf0cde464..6cac0a99f 100644
+--- a/src/lib/ares_process.c
++++ b/src/lib/ares_process.c
+@@ -470,7 +470,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
+ {
+   struct server_state *server;
+   int i;
+-  ares_ssize_t count;
++  ares_ssize_t read_len;
+   unsigned char buf[MAXENDSSZ + 1];
+ #ifdef HAVE_RECVFROM
+   ares_socklen_t fromlen;
+@@ -513,32 +513,41 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
+       /* To reduce event loop overhead, read and process as many
+        * packets as we can. */
+       do {
+-        if (server->udp_socket == ARES_SOCKET_BAD)
+-          count = 0;
+-
+-        else {
+-          if (server->addr.family == AF_INET)
++        if (server->udp_socket == ARES_SOCKET_BAD) {
++          read_len = -1;
++        } else {
++          if (server->addr.family == AF_INET) {
+             fromlen = sizeof(from.sa4);
+-          else
++          } else {
+             fromlen = sizeof(from.sa6);
+-          count = socket_recvfrom(channel, server->udp_socket, (void *)buf,
+-                                  sizeof(buf), 0, &from.sa, &fromlen);
++          }
++          read_len = socket_recvfrom(channel, server->udp_socket, (void *)buf,
++                                     sizeof(buf), 0, &from.sa, &fromlen);
+         }
+ 
+-        if (count == -1 && try_again(SOCKERRNO))
++        if (read_len == 0) {
++          /* UDP is connectionless, so result code of 0 is a 0-length UDP
++           * packet, and not an indication the connection is closed like on
++           * tcp */
+           continue;
+-        else if (count <= 0)
++        } else if (read_len < 0) {
++          if (try_again(SOCKERRNO))
++            continue;
++
+           handle_error(channel, i, now);
++
+ #ifdef HAVE_RECVFROM
+-        else if (!same_address(&from.sa, &server->addr))
++        } else if (!same_address(&from.sa, &server->addr)) {
+           /* The address the response comes from does not match the address we
+            * sent the request to. Someone may be attempting to perform a cache
+            * poisoning attack. */
+-          break;
++          continue;
+ #endif
+-        else
+-          process_answer(channel, buf, (int)count, i, 0, now);
+-       } while (count > 0);
++
++        } else {
++          process_answer(channel, buf, (int)read_len, i, 0, now);
++        }
++      } while (read_len >= 0);
+     }
+ }
+ 
meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb +1 -0
index 152d91332..2aa789760 100644
@@ -9,6 +9,7 @@ SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
            file://CVE-2022-4904.patch \
            file://CVE-2023-31130.patch \
            file://CVE-2023-31147.patch \
+           file://CVE-2023-32067.patch \
           "
 SRCREV = "2aa086f822aad5017a6f2061ef656f237a62d0ed"
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 5 lines · Vijay Anusuri

From: Vijay Anusuri <[email protected]>

Upstream-Status: Backport from https://github.com/c-ares/c-ares/commit/b9b8413cfdb70a3f99e1573333b23052d57ec1ae

Any chance of getting a kirkstone fix?  I will be updating Micklerdore to 1.19.1 (master) to address this issue.

-Armin

Quoted 117 lines
---
  .../c-ares/c-ares/CVE-2023-32067.patch        | 84 +++++++++++++++++++
  .../recipes-support/c-ares/c-ares_1.18.1.bb   |  1 +
  2 files changed, 85 insertions(+)

create mode 100644 meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +84 -0
new file mode 100644
index 000000000..63192d3c8
@@ -0,0 +1,84 @@
+From b9b8413cfdb70a3f99e1573333b23052d57ec1ae Mon Sep 17 00:00:00 2001
+From: Brad House <[email protected]>
+Date: Mon, 22 May 2023 06:51:49 -0400
+Subject: [PATCH] Merge pull request from GHSA-9g78-jv2r-p7vc
+
+Link: https://github.com/c-ares/c-ares/releases/tag/cares-1_19_1
+
+Upstream-Status: Backport [https://github.com/c-ares/c-ares/commit/b9b8413cfdb70a3f99e1573333b23052d57ec1ae]
+CVE: CVE-2023-32067
+Signed-off-by: Vijay Anusuri <[email protected]>
+---
+ src/lib/ares_process.c | 41 +++++++++++++++++++++++++----------------
+ 1 file changed, 25 insertions(+), 16 deletions(-)
+
+diff --git a/src/lib/ares_process.c b/src/lib/ares_process.c
+index bf0cde464..6cac0a99f 100644
+--- a/src/lib/ares_process.c
++++ b/src/lib/ares_process.c
+@@ -470,7 +470,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
+ {
+   struct server_state *server;
+   int i;
+-  ares_ssize_t count;
++  ares_ssize_t read_len;
+   unsigned char buf[MAXENDSSZ + 1];
+ #ifdef HAVE_RECVFROM
+   ares_socklen_t fromlen;
+@@ -513,32 +513,41 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
+       /* To reduce event loop overhead, read and process as many
+        * packets as we can. */
+       do {
+-        if (server->udp_socket == ARES_SOCKET_BAD)
+-          count = 0;
+-
+-        else {
+-          if (server->addr.family == AF_INET)
++        if (server->udp_socket == ARES_SOCKET_BAD) {
++          read_len = -1;
++        } else {
++          if (server->addr.family == AF_INET) {
+             fromlen = sizeof(from.sa4);
+-          else
++          } else {
+             fromlen = sizeof(from.sa6);
+-          count = socket_recvfrom(channel, server->udp_socket, (void *)buf,
+-                                  sizeof(buf), 0, &from.sa, &fromlen);
++          }
++          read_len = socket_recvfrom(channel, server->udp_socket, (void *)buf,
++                                     sizeof(buf), 0, &from.sa, &fromlen);
+         }
+
+-        if (count == -1 && try_again(SOCKERRNO))
++        if (read_len == 0) {
++          /* UDP is connectionless, so result code of 0 is a 0-length UDP
++           * packet, and not an indication the connection is closed like on
++           * tcp */
+           continue;
+-        else if (count <= 0)
++        } else if (read_len < 0) {
++          if (try_again(SOCKERRNO))
++            continue;
++
+           handle_error(channel, i, now);
++
+ #ifdef HAVE_RECVFROM
+-        else if (!same_address(&from.sa, &server->addr))
++        } else if (!same_address(&from.sa, &server->addr)) {
+           /* The address the response comes from does not match the address we
+            * sent the request to. Someone may be attempting to perform a cache
+            * poisoning attack. */
+-          break;
++          continue;
+ #endif
+-        else
+-          process_answer(channel, buf, (int)count, i, 0, now);
+-       } while (count > 0);
++
++        } else {
++          process_answer(channel, buf, (int)read_len, i, 0, now);
++        }
++      } while (read_len >= 0);
+     }
+ }
+
meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb +1 -1
index 152d91332..2aa789760 100644
@@ -9,6 +9,7 @@ SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
             file://CVE-2022-4904.patch \
             file://CVE-2023-31130.patch \
             file://CVE-2023-31147.patch \
+           file://CVE-2023-32067.patch \
            "
  SRCREV = "2aa086f822aad5017a6f2061ef656f237a62d0ed"
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#103892): https://lists.openembedded.org/g/openembedded-devel/message/103892
Mute This Topic: https://lists.openembedded.org/mt/100209081/3616698
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Armin,

Already patches have been sent to fix CVE-2023-32067 for kirkstone.

Below is the commit
https://git.openembedded.org/meta-openembedded-contrib/commit/?h=stable/kirkstone-nut&id=c34b8aad5717d5e6cfa1baef5d3da1eab544def9

Thanks & Regards,
Vijay

Quoted 150 lines · On Sat, Jul 22, 2023 at 5:17 PM akuster808 <[email protected]> wrote:
Quoted 3 lines · Vijay Anusuri

From: Vijay Anusuri <[email protected]>

Upstream-Status: Backport from

https://github.com/c-ares/c-ares/commit/b9b8413cfdb70a3f99e1573333b23052d57ec1ae

Quoted 2 lines

Any chance of getting a kirkstone fix? I will be updating Micklerdore to 1.19.1 (master) to address this issue.

-Armin

Quoted 5 lines
---
  .../c-ares/c-ares/CVE-2023-32067.patch        | 84 +++++++++++++++++++
  .../recipes-support/c-ares/c-ares_1.18.1.bb   |  1 +
  2 files changed, 85 insertions(+)

create mode 100644

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

b/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch line 8

Quoted 13 lines

new file mode 100644
index 000000000..63192d3c8

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +8 -0
@@ -0,0 +1,84 @@
+From b9b8413cfdb70a3f99e1573333b23052d57ec1ae Mon Sep 17 00:00:00 2001
+From: Brad House <[email protected]>
+Date: Mon, 22 May 2023 06:51:49 -0400
+Subject: [PATCH] Merge pull request from GHSA-9g78-jv2r-p7vc
+
+Link: https://github.com/c-ares/c-ares/releases/tag/cares-1_19_1
+
+Upstream-Status: Backport [

https://github.com/c-ares/c-ares/commit/b9b8413cfdb70a3f99e1573333b23052d57ec1ae
]

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

Quoted 11 lines
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +11 -0
+CVE: CVE-2023-32067
+Signed-off-by: Vijay Anusuri <[email protected]>
+---
+ src/lib/ares_process.c | 41 +++++++++++++++++++++++++----------------
+ 1 file changed, 25 insertions(+), 16 deletions(-)
+
+diff --git a/src/lib/ares_process.c b/src/lib/ares_process.c
+index bf0cde464..6cac0a99f 100644
+--- a/src/lib/ares_process.c
++++ b/src/lib/ares_process.c
+@@ -470,7 +470,7 @@ static void read_udp_packets(ares_channel channel,

fd_set *read_fds,

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

Quoted 9 lines
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +9 -0
+ {
+   struct server_state *server;
+   int i;
+-  ares_ssize_t count;
++  ares_ssize_t read_len;
+   unsigned char buf[MAXENDSSZ + 1];
+ #ifdef HAVE_RECVFROM
+   ares_socklen_t fromlen;
+@@ -513,32 +513,41 @@ static void read_udp_packets(ares_channel

channel, fd_set *read_fds,

Quoted 7 lines
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +7 -0
+       /* To reduce event loop overhead, read and process as many
+        * packets as we can. */
+       do {
+-        if (server->udp_socket == ARES_SOCKET_BAD)
+-          count = 0;
+-
+-        else {

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

Quoted 10 lines
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +10 -0
+-          if (server->addr.family == AF_INET)
++        if (server->udp_socket == ARES_SOCKET_BAD) {
++          read_len = -1;
++        } else {
++          if (server->addr.family == AF_INET) {
+             fromlen = sizeof(from.sa4);
+-          else
++          } else {
+             fromlen = sizeof(from.sa6);
+-          count = socket_recvfrom(channel, server->udp_socket, (void

*)buf,

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

Quoted 3 lines
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +3 -0
+-                                  sizeof(buf), 0, &from.sa, &fromlen);
++          }
++          read_len = socket_recvfrom(channel, server->udp_socket,

(void *)buf,

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch line 49

Quoted 1 line
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +1 -0
++                                     sizeof(buf), 0, &from.sa,

&fromlen);

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

Quoted 5 lines
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +5 -0
+         }
+
+-        if (count == -1 && try_again(SOCKERRNO))
++        if (read_len == 0) {
++          /* UDP is connectionless, so result code of 0 is a 0-length

UDP

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch line 55

Quoted 1 line
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +1 -0
++           * packet, and not an indication the connection is closed

like on

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch

Quoted 13 lines
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +13 -0
++           * tcp */
+           continue;
+-        else if (count <= 0)
++        } else if (read_len < 0) {
++          if (try_again(SOCKERRNO))
++            continue;
++
+           handle_error(channel, i, now);
++
+ #ifdef HAVE_RECVFROM
+-        else if (!same_address(&from.sa, &server->addr))
++        } else if (!same_address(&from.sa, &server->addr)) {
+           /* The address the response comes from does not match the

address we

meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch line 69

Quoted 1 line
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +1 -0
+            * sent the request to. Someone may be attempting to perform

a cache

Review

Quoted 16 lines
meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch new file +15 -0
+            * poisoning attack. */
+-          break;
++          continue;
+ #endif
+-        else
+-          process_answer(channel, buf, (int)count, i, 0, now);
+-       } while (count > 0);
++
++        } else {
++          process_answer(channel, buf, (int)read_len, i, 0, now);
++        }
++      } while (read_len >= 0);
+     }
+ }
+
(quoted diff) +0 -0

b/meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb

meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb SRC_URI = "git://

Quoted 4 lines

index 152d91332..2aa789760 100644

meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb +0 -0
@@ -9,6 +9,7 @@ SRC_URI = "git://

github.com/c-ares/c-ares.git;branch=main;protocol=https \

Quoted 11 lines
meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb +1 -1
             file://CVE-2022-4904.patch \
             file://CVE-2023-31130.patch \
             file://CVE-2023-31147.patch \
+           file://CVE-2023-32067.patch \
            "
  SRCREV = "2aa086f822aad5017a6f2061ef656f237a62d0ed"
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#103892):

https://lists.openembedded.org/g/openembedded-devel/message/103892

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/100209081/3616698
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-