summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended
diff options
context:
space:
mode:
authorVijay Anusuri <vanusuri@mvista.com>2023-07-04 09:35:39 +0530
committerSteve Sakoman <steve@sakoman.com>2023-07-12 05:13:58 -1000
commiteb7bb5b5893ca6c19f8ab1830cfc661f15b3721c (patch)
treec8a49bfec614e534bce43cb10c44606277108a69 /meta/recipes-extended
parentbc3497092e819715f25228cbcc2a68e904f4b2de (diff)
downloadpoky-eb7bb5b5893ca6c19f8ab1830cfc661f15b3721c.tar.gz
cups: Fix CVE-2023-34241
OpenPrinting CUPS is a standards-based, open source printing system for Linux and other Unix-like operating systems. Starting in version 2.0.0 and prior to version 2.4.6, CUPS logs data of free memory to the logging service AFTER the connection has been closed, when it should have logged the data right before. This is a use-after-free bug that impacts the entire cupsd process. The exact cause of this issue is the function `httpClose(con->http)` being called in `scheduler/client.c`. The problem is that httpClose always, provided its argument is not null, frees the pointer at the end of the call, only for cupsdLogClient to pass the pointer to httpGetHostname. This issue happens in function `cupsdAcceptClient` if LogLevel is warn or higher and in two scenarios: there is a double-lookup for the IP Address (HostNameLookups Double is set in `cupsd.conf`) which fails to resolve, or if CUPS is compiled with TCP wrappers and the connection is refused by rules from `/etc/hosts.allow` and `/etc/hosts.deny`. Version 2.4.6 has a patch for this issue. References: https://nvd.nist.gov/vuln/detail/CVE-2023-34241 https://github.com/OpenPrinting/cups/security/advisories/GHSA-qjgh-5hcq-5f25 https://security-tracker.debian.org/tracker/CVE-2023-34241 Upstream Patch: https://github.com/OpenPrinting/cups/commit/9809947a959e18409dcf562a3466ef246cb90cb2 (From OE-Core rev: 28b25ba7a8c6aa5c5744ca17e8686f2762791c72) Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r--meta/recipes-extended/cups/cups.inc1
-rw-r--r--meta/recipes-extended/cups/cups/CVE-2023-34241.patch65
2 files changed, 66 insertions, 0 deletions
diff --git a/meta/recipes-extended/cups/cups.inc b/meta/recipes-extended/cups/cups.inc
index d6e7d95800..1d2377486a 100644
--- a/meta/recipes-extended/cups/cups.inc
+++ b/meta/recipes-extended/cups/cups.inc
@@ -15,6 +15,7 @@ SRC_URI = "https://github.com/apple/cups/releases/download/v${PV}/${BP}-source.t
15 file://0004-cups-fix-multilib-install-file-conflicts.patch\ 15 file://0004-cups-fix-multilib-install-file-conflicts.patch\
16 file://CVE-2022-26691.patch \ 16 file://CVE-2022-26691.patch \
17 file://CVE-2023-32324.patch \ 17 file://CVE-2023-32324.patch \
18 file://CVE-2023-34241.patch \
18 " 19 "
19 20
20UPSTREAM_CHECK_URI = "https://github.com/apple/cups/releases" 21UPSTREAM_CHECK_URI = "https://github.com/apple/cups/releases"
diff --git a/meta/recipes-extended/cups/cups/CVE-2023-34241.patch b/meta/recipes-extended/cups/cups/CVE-2023-34241.patch
new file mode 100644
index 0000000000..816efc2946
--- /dev/null
+++ b/meta/recipes-extended/cups/cups/CVE-2023-34241.patch
@@ -0,0 +1,65 @@
1From ffd290b4ab247f82722927ba9b21358daa16dbf1 Mon Sep 17 00:00:00 2001
2From: Rose <83477269+AtariDreams@users.noreply.github.com>
3Date: Thu, 1 Jun 2023 11:33:39 -0400
4Subject: [PATCH] Log result of httpGetHostname BEFORE closing the connection
5
6httpClose frees the memory of con->http. This is problematic because httpGetHostname then tries to access the memory it points to.
7
8We have to log the hostname first.
9
10Upstream-Status: Backport [https://github.com/OpenPrinting/cups/commit/9809947a959e18409dcf562a3466ef246cb90cb2]
11CVE: CVE-2023-34241
12Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
13---
14 scheduler/client.c | 16 +++++++---------
15 1 file changed, 7 insertions(+), 9 deletions(-)
16
17diff --git a/scheduler/client.c b/scheduler/client.c
18index 91e441188c..327473a4d1 100644
19--- a/scheduler/client.c
20+++ b/scheduler/client.c
21@@ -193,13 +193,11 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
22 /*
23 * Can't have an unresolved IP address with double-lookups enabled...
24 */
25-
26- httpClose(con->http);
27-
28 cupsdLogClient(con, CUPSD_LOG_WARN,
29- "Name lookup failed - connection from %s closed!",
30+ "Name lookup failed - closing connection from %s!",
31 httpGetHostname(con->http, NULL, 0));
32
33+ httpClose(con->http);
34 free(con);
35 return;
36 }
37@@ -235,11 +233,11 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
38 * with double-lookups enabled...
39 */
40
41- httpClose(con->http);
42-
43 cupsdLogClient(con, CUPSD_LOG_WARN,
44- "IP lookup failed - connection from %s closed!",
45+ "IP lookup failed - closing connection from %s!",
46 httpGetHostname(con->http, NULL, 0));
47+
48+ httpClose(con->http);
49 free(con);
50 return;
51 }
52@@ -256,11 +254,11 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
53
54 if (!hosts_access(&wrap_req))
55 {
56- httpClose(con->http);
57-
58 cupsdLogClient(con, CUPSD_LOG_WARN,
59 "Connection from %s refused by /etc/hosts.allow and "
60 "/etc/hosts.deny rules.", httpGetHostname(con->http, NULL, 0));
61+
62+ httpClose(con->http);
63 free(con);
64 return;
65 }