summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHitendra Prajapati <hprajapati@mvista.com>2025-05-29 10:39:14 +0530
committerSteve Sakoman <steve@sakoman.com>2025-06-04 09:06:31 -0700
commit14d260ab2503c75c78f2c4b1e0d6e8b6e287959b (patch)
treeafec58b78a9dfc29c9699e86e33d2690364a6b89
parent94dea33c75f818c1424dc24366a3e3f368a208fe (diff)
downloadpoky-14d260ab2503c75c78f2c4b1e0d6e8b6e287959b.tar.gz
screen: Fix CVE-2025-46805
Upstream-Status: Backport from https://cgit.git.savannah.gnu.org/cgit/screen.git/commit/?id=161f85b98b7e1d5e4893aeed20f4cdb5e3dfaaa4 (From OE-Core rev: b25b0f785e0b7650e31a45a92be196be6b76ea78) Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-extended/screen/screen/CVE-2025-46805.patch121
-rw-r--r--meta/recipes-extended/screen/screen_4.9.0.bb1
2 files changed, 122 insertions, 0 deletions
diff --git a/meta/recipes-extended/screen/screen/CVE-2025-46805.patch b/meta/recipes-extended/screen/screen/CVE-2025-46805.patch
new file mode 100644
index 0000000000..9d9d3e2827
--- /dev/null
+++ b/meta/recipes-extended/screen/screen/CVE-2025-46805.patch
@@ -0,0 +1,121 @@
1From 161f85b98b7e1d5e4893aeed20f4cdb5e3dfaaa4 Mon Sep 17 00:00:00 2001
2From: Matthias Gerstner <matthias.gerstner@suse.de>
3Date: Mon, 12 May 2025 15:38:19 +0200
4Subject: fix CVE-2025-46805: socket.c - don't send signals with root
5 privileges
6
7The CheckPid() function was introduced to address CVE-2023-24626, to
8prevent sending SIGCONT and SIGHUP to arbitrary PIDs in the system. This
9fix still suffers from a TOCTOU race condition. The client can replace
10itself by a privileged process, or try to cycle PIDs until a privileged
11process receives the original PID.
12
13To prevent this, always send signals using the real privileges. Keep
14CheckPid() for error diagnostics. If sending the actual signal fails
15later on then there will be no more error reporting.
16
17It seems the original bugfix already introduced a regression when
18attaching to another's user session that is not owned by root. In this
19case the target sessions runs with real uid X, while for sending a
20signal to the `pid` provided by the client real uid Y (or root
21privileges) are required.
22
23This is hard to properly fix without this regression. On Linux pidfds
24could be used to allow safely sending signals to other PIDs as root
25without involving race conditions. In this case the client PID should
26also be obtained via the UNIX domain socket's SO_PEERCRED option,
27though.
28
29Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/screen.git/commit/?id=161f85b98b7e1d5e4893aeed20f4cdb5e3dfaaa4]
30CVE: CVE-2025-46805
31Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
32---
33 socket.c | 21 +++++++++++++--------
34 1 file changed, 13 insertions(+), 8 deletions(-)
35
36diff --git a/socket.c b/socket.c
37index 9d87445..3bbd64e 100644
38--- a/socket.c
39+++ b/socket.c
40@@ -826,6 +826,11 @@ int pid;
41 return UserStatus();
42 }
43
44+static void KillUnpriv(pid_t pid, int sig) {
45+ UserContext();
46+ UserReturn(kill(pid, sig));
47+}
48+
49 #ifdef hpux
50 /*
51 * From: "F. K. Bruner" <napalm@ugcs.caltech.edu>
52@@ -911,14 +916,14 @@ struct win *wi;
53 {
54 Msg(errno, "Could not perform necessary sanity checks on pts device.");
55 close(i);
56- Kill(pid, SIG_BYE);
57+ KillUnpriv(pid, SIG_BYE);
58 return -1;
59 }
60 if (strcmp(ttyname_in_ns, m->m_tty))
61 {
62 Msg(errno, "Attach: passed fd does not match tty: %s - %s!", ttyname_in_ns, m->m_tty[0] != '\0' ? m->m_tty : "(null)");
63 close(i);
64- Kill(pid, SIG_BYE);
65+ KillUnpriv(pid, SIG_BYE);
66 return -1;
67 }
68 /* m->m_tty so far contains the actual name of the pts device in the
69@@ -935,19 +940,19 @@ struct win *wi;
70 {
71 Msg(errno, "Attach: passed fd does not match tty: %s - %s!", m->m_tty, myttyname ? myttyname : "NULL");
72 close(i);
73- Kill(pid, SIG_BYE);
74+ KillUnpriv(pid, SIG_BYE);
75 return -1;
76 }
77 }
78 else if ((i = secopen(m->m_tty, O_RDWR | O_NONBLOCK, 0)) < 0)
79 {
80 Msg(errno, "Attach: Could not open %s!", m->m_tty);
81- Kill(pid, SIG_BYE);
82+ KillUnpriv(pid, SIG_BYE);
83 return -1;
84 }
85 #ifdef MULTIUSER
86 if (attach)
87- Kill(pid, SIGCONT);
88+ KillUnpriv(pid, SIGCONT);
89 #endif
90
91 #if defined(ultrix) || defined(pyr) || defined(NeXT)
92@@ -960,7 +965,7 @@ struct win *wi;
93 {
94 write(i, "Attaching from inside of screen?\n", 33);
95 close(i);
96- Kill(pid, SIG_BYE);
97+ KillUnpriv(pid, SIG_BYE);
98 Msg(0, "Attach msg ignored: coming from inside.");
99 return -1;
100 }
101@@ -971,7 +976,7 @@ struct win *wi;
102 {
103 write(i, "Access to session denied.\n", 26);
104 close(i);
105- Kill(pid, SIG_BYE);
106+ KillUnpriv(pid, SIG_BYE);
107 Msg(0, "Attach: access denied for user %s.", user);
108 return -1;
109 }
110@@ -1289,7 +1294,7 @@ ReceiveMsg()
111 Msg(0, "Query attempt with bad pid(%d)!", m.m.command.apid);
112 }
113 else {
114- Kill(m.m.command.apid,
115+ KillUnpriv(m.m.command.apid,
116 (queryflag >= 0)
117 ? SIGCONT
118 : SIG_BYE); /* Send SIG_BYE if an error happened */
119--
1202.49.0
121
diff --git a/meta/recipes-extended/screen/screen_4.9.0.bb b/meta/recipes-extended/screen/screen_4.9.0.bb
index 19070d87d8..d137c85600 100644
--- a/meta/recipes-extended/screen/screen_4.9.0.bb
+++ b/meta/recipes-extended/screen/screen_4.9.0.bb
@@ -22,6 +22,7 @@ SRC_URI = "${GNU_MIRROR}/screen/screen-${PV}.tar.gz \
22 file://0001-fix-for-multijob-build.patch \ 22 file://0001-fix-for-multijob-build.patch \
23 file://0001-Remove-more-compatibility-stuff.patch \ 23 file://0001-Remove-more-compatibility-stuff.patch \
24 file://CVE-2023-24626.patch \ 24 file://CVE-2023-24626.patch \
25 file://CVE-2025-46805.patch \
25 " 26 "
26 27
27SRC_URI[sha256sum] = "f9335281bb4d1538ed078df78a20c2f39d3af9a4e91c57d084271e0289c730f4" 28SRC_URI[sha256sum] = "f9335281bb4d1538ed078df78a20c2f39d3af9a4e91c57d084271e0289c730f4"