summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/connman
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/connman')
-rw-r--r--meta/recipes-connectivity/connman/connman/0001-gdhcp-Verify-and-sanitize-packet-length-first.patch63
-rw-r--r--meta/recipes-connectivity/connman/connman_1.41.bb1
2 files changed, 64 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/connman/connman/0001-gdhcp-Verify-and-sanitize-packet-length-first.patch b/meta/recipes-connectivity/connman/connman/0001-gdhcp-Verify-and-sanitize-packet-length-first.patch
new file mode 100644
index 0000000000..8e2f47a1d5
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-gdhcp-Verify-and-sanitize-packet-length-first.patch
@@ -0,0 +1,63 @@
1From 99e2c16ea1cced34a5dc450d76287a1c3e762138 Mon Sep 17 00:00:00 2001
2From: Daniel Wagner <wagi@monom.org>
3Date: Tue, 11 Apr 2023 08:12:56 +0200
4Subject: [PATCH] gdhcp: Verify and sanitize packet length first
5
6Avoid overwriting the read packet length after the initial test. Thus
7move all the length checks which depends on the total length first
8and do not use the total lenght from the IP packet afterwards.
9
10Fixes CVE-2023-28488
11
12Reported by Polina Smirnova <moe.hwr@gmail.com>
13
14CVE: CVE-2023-28488
15Upstream-Status: Backport
16Signed-off-by: Ross Burton <ross.burton@arm.com>
17
18---
19 gdhcp/client.c | 16 +++++++++-------
20 1 file changed, 9 insertions(+), 7 deletions(-)
21
22diff --git a/gdhcp/client.c b/gdhcp/client.c
23index 7efa7e45..82017692 100644
24--- a/gdhcp/client.c
25+++ b/gdhcp/client.c
26@@ -1319,9 +1319,9 @@ static bool sanity_check(struct ip_udp_dhcp_packet *packet, int bytes)
27 static int dhcp_recv_l2_packet(struct dhcp_packet *dhcp_pkt, int fd,
28 struct sockaddr_in *dst_addr)
29 {
30- int bytes;
31 struct ip_udp_dhcp_packet packet;
32 uint16_t check;
33+ int bytes, tot_len;
34
35 memset(&packet, 0, sizeof(packet));
36
37@@ -1329,15 +1329,17 @@ static int dhcp_recv_l2_packet(struct dhcp_packet *dhcp_pkt, int fd,
38 if (bytes < 0)
39 return -1;
40
41- if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp)))
42- return -1;
43-
44- if (bytes < ntohs(packet.ip.tot_len))
45+ tot_len = ntohs(packet.ip.tot_len);
46+ if (bytes > tot_len) {
47+ /* ignore any extra garbage bytes */
48+ bytes = tot_len;
49+ } else if (bytes < tot_len) {
50 /* packet is bigger than sizeof(packet), we did partial read */
51 return -1;
52+ }
53
54- /* ignore any extra garbage bytes */
55- bytes = ntohs(packet.ip.tot_len);
56+ if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp)))
57+ return -1;
58
59 if (!sanity_check(&packet, bytes))
60 return -1;
61--
622.34.1
63
diff --git a/meta/recipes-connectivity/connman/connman_1.41.bb b/meta/recipes-connectivity/connman/connman_1.41.bb
index 79542b2175..3f2e29820f 100644
--- a/meta/recipes-connectivity/connman/connman_1.41.bb
+++ b/meta/recipes-connectivity/connman/connman_1.41.bb
@@ -8,6 +8,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
8 file://CVE-2022-32293_p1.patch \ 8 file://CVE-2022-32293_p1.patch \
9 file://CVE-2022-32293_p2.patch \ 9 file://CVE-2022-32293_p2.patch \
10 file://CVE-2022-32292.patch \ 10 file://CVE-2022-32292.patch \
11 file://0001-gdhcp-Verify-and-sanitize-packet-length-first.patch \
11 " 12 "
12 13
13SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch" 14SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"