Skip to content

Commit fad4d61

Browse files
[AUTO-CHERRYPICK] Fix CVE-2024-35235 for cups :2.0 - branch main (#11186)
Co-authored-by: KavyaSree2610 <92566732+KavyaSree2610@users.noreply.github.com>
1 parent 96aab8d commit fad4d61

2 files changed

Lines changed: 101 additions & 1 deletion

File tree

SPECS/cups/CVE-2024-35235.patch

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
From 192f5bd1b197e577b2332d4fdc8038c6b2993d6e Mon Sep 17 00:00:00 2001
2+
From: kavyasree <kkaitepalli@microsoft.com>
3+
Date: Thu, 21 Nov 2024 13:46:00 +0530
4+
Subject: [PATCH] Fix CVE-2024-35235
5+
6+
---
7+
cups/http-addr.c | 37 +++++++++++++++++++------------------
8+
scheduler/conf.c | 20 ++++++++++++++++++++
9+
2 files changed, 39 insertions(+), 18 deletions(-)
10+
11+
diff --git a/cups/http-addr.c b/cups/http-addr.c
12+
index 8e81c6f..d65d4cc 100644
13+
--- a/cups/http-addr.c
14+
+++ b/cups/http-addr.c
15+
@@ -199,28 +199,29 @@ httpAddrListen(http_addr_t *addr, /* I - Address to bind to */
16+
/*
17+
* Remove any existing domain socket file...
18+
*/
19+
+ if ((status = unlink(addr->un.sun_path)) < 0)
20+
+ {
21+
+ DEBUG_printf("1httpAddrListen: Unable to unlink \"%s\": %s", addr->un.sun_path, strerror(errno));
22+
23+
- unlink(addr->un.sun_path);
24+
-
25+
- /*
26+
- * Save the current umask and set it to 0 so that all users can access
27+
- * the domain socket...
28+
- */
29+
-
30+
- mask = umask(0);
31+
-
32+
- /*
33+
- * Bind the domain socket...
34+
- */
35+
36+
- status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr));
37+
+ if (errno == ENOENT)
38+
+ status = 0;
39+
+ }
40+
41+
- /*
42+
- * Restore the umask and fix permissions...
43+
- */
44+
+ if (!status)
45+
+ {
46+
+ // Save the current umask and set it to 0 so that all users can access
47+
+ // the domain socket...
48+
+ mask = umask(0);
49+
50+
- umask(mask);
51+
- chmod(addr->un.sun_path, 0140777);
52+
+ // Bind the domain socket...
53+
+ if ((status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr))) < 0)
54+
+ {
55+
+ DEBUG_printf("1httpAddrListen: Unable to bind domain socket \"%s\": %s", addr->un.sun_path, strerror(errno));
56+
+ }
57+
+ // Restore the umask...
58+
+ umask(mask);
59+
+ }
60+
}
61+
else
62+
#endif /* AF_LOCAL */
63+
diff --git a/scheduler/conf.c b/scheduler/conf.c
64+
index 74531a8..180ef9b 100644
65+
--- a/scheduler/conf.c
66+
+++ b/scheduler/conf.c
67+
@@ -3071,6 +3071,26 @@ read_cupsd_conf(cups_file_t *fp) /* I - File to read from */
68+
cupsd_listener_t *lis; /* New listeners array */
69+
70+
71+
+ /*
72+
+ * If we are launched on-demand, do not use domain sockets from the config
73+
+ * file. Also check that the domain socket path is not too long...
74+
+ */
75+
+
76+
+#ifdef HAVE_ONDEMAND
77+
+ if (*value == '/' && OnDemand)
78+
+ {
79+
+ if (strcmp(value, CUPS_DEFAULT_DOMAINSOCKET))
80+
+ cupsdLogMessage(CUPSD_LOG_INFO, "Ignoring %s address %s at line %d - only using domain socket from launchd/systemd.", line, value, linenum);
81+
+ continue;
82+
+ }
83+
+#endif // HAVE_ONDEMAND
84+
+
85+
+ if (*value == '/' && strlen(value) > (sizeof(addr->addr.un.sun_path) - 1))
86+
+ {
87+
+ cupsdLogMessage(CUPSD_LOG_INFO, "Ignoring %s address %s at line %d - too long.", line, value, linenum);
88+
+ continue;
89+
+ }
90+
+
91+
/*
92+
* Get the address list...
93+
*/
94+
--
95+
2.34.1
96+

SPECS/cups/cups.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Summary: CUPS printing system
1313
Name: cups
1414
Version: 2.3.3%{OP_VER}
15-
Release: 8%{?dist}
15+
Release: 9%{?dist}
1616
License: ASL 2.0 with exceptions
1717
Vendor: Microsoft Corporation
1818
Distribution: Mariner
@@ -64,6 +64,7 @@ Patch14: CVE-2023-4504.patch
6464
Patch15: CVE-2023-32324.patch
6565
Patch16: CVE-2023-34241.patch
6666
Patch17: CVE-2022-26691.patch
67+
Patch18: CVE-2024-35235.patch
6768
#### UPSTREAM PATCHES (starts with 1000) ####
6869
##### Patches removed because IMHO they aren't no longer needed
6970
##### but still I'll leave them in git in case their removal
@@ -657,6 +658,9 @@ rm -f %{cups_serverbin}/backend/smb
657658
%{_mandir}/man7/ippeveps.7.gz
658659

659660
%changelog
661+
* Thu Nov 21 2024 Kavya Sree Kaitepalli <kkaitepalli@microsoft.com> - 2.3.3op2-9
662+
- Add patch for CVE-2024-35235
663+
660664
* Tue May 21 2024 Lanze Liu <lanzeliu@microsoft.com> - 2.3.3op2-8
661665
- Add patch for CVE-2022-26691.
662666

0 commit comments

Comments
 (0)