diff options
| author | Divya Chellam <divya.chellam@windriver.com> | 2025-06-09 15:40:26 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-06-13 08:42:35 -0700 |
| commit | 145b1ddb2bcd208280a249fa9e8709d21787ee35 (patch) | |
| tree | 1758158aff3fc2f0b4a4de41bdf89cf77a6aa47b /meta/recipes-extended | |
| parent | c6848d874c2f49e9b9aead0dbac475dedd8a1492 (diff) | |
| download | poky-145b1ddb2bcd208280a249fa9e8709d21787ee35.tar.gz | |
screen: fix CVE-2025-46802
For a short time they PTY is set to mode 666, allowing any user on the
system to connect to the screen session.
Reference:
https://security-tracker.debian.org/tracker/CVE-2025-46802
Upstream-patch:
https://cgit.git.savannah.gnu.org/cgit/screen.git/commit/?id=049b26b22e197ba3be9c46e5c193032e01a4724a
(From OE-Core rev: b4074e06ff0531481dbb3788a5c1bf9e013b6239)
Signed-off-by: Divya Chellam <divya.chellam@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-extended')
| -rw-r--r-- | meta/recipes-extended/screen/screen/CVE-2025-46802.patch | 146 | ||||
| -rw-r--r-- | meta/recipes-extended/screen/screen_4.9.0.bb | 1 |
2 files changed, 147 insertions, 0 deletions
diff --git a/meta/recipes-extended/screen/screen/CVE-2025-46802.patch b/meta/recipes-extended/screen/screen/CVE-2025-46802.patch new file mode 100644 index 0000000000..aa2cbeac21 --- /dev/null +++ b/meta/recipes-extended/screen/screen/CVE-2025-46802.patch | |||
| @@ -0,0 +1,146 @@ | |||
| 1 | From 049b26b22e197ba3be9c46e5c193032e01a4724a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Matthias Gerstner <matthias.gerstner@suse.de> | ||
| 3 | Date: Mon, 12 May 2025 15:15:38 +0200 | ||
| 4 | Subject: [PATCH] fix CVE-2025-46802: attacher.c - prevent temporary 0666 mode | ||
| 5 | on PTYs | ||
| 6 | |||
| 7 | This temporary chmod of the PTY to mode 0666 is most likely a remnant of | ||
| 8 | past times, before the PTY file descriptor was passed to the target | ||
| 9 | session via the UNIX domain socket. | ||
| 10 | |||
| 11 | This chmod() causes a race condition during which any other user in the | ||
| 12 | system can open the PTY for reading and writing, and thus allows PTY | ||
| 13 | hijacking. | ||
| 14 | |||
| 15 | Simply remove this logic completely. | ||
| 16 | |||
| 17 | CVE: CVE-2025-46802 | ||
| 18 | |||
| 19 | Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/screen.git/commit/?id=049b26b22e197ba3be9c46e5c193032e01a4724a] | ||
| 20 | |||
| 21 | Signed-off-by: Divya Chellam <divya.chellam@windriver.com> | ||
| 22 | --- | ||
| 23 | attacher.c | 27 --------------------------- | ||
| 24 | screen.c | 19 ------------------- | ||
| 25 | 2 files changed, 46 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/attacher.c b/attacher.c | ||
| 28 | index 18ba43c..257bd75 100644 | ||
| 29 | --- a/attacher.c | ||
| 30 | +++ b/attacher.c | ||
| 31 | @@ -73,7 +73,6 @@ extern int MasterPid, attach_fd; | ||
| 32 | #ifdef MULTIUSER | ||
| 33 | extern char *multi; | ||
| 34 | extern int multiattach, multi_uid, own_uid; | ||
| 35 | -extern int tty_mode, tty_oldmode; | ||
| 36 | # ifndef USE_SETEUID | ||
| 37 | static int multipipe[2]; | ||
| 38 | # endif | ||
| 39 | @@ -160,9 +159,6 @@ int how; | ||
| 40 | |||
| 41 | if (pipe(multipipe)) | ||
| 42 | Panic(errno, "pipe"); | ||
| 43 | - if (chmod(attach_tty, 0666)) | ||
| 44 | - Panic(errno, "chmod %s", attach_tty); | ||
| 45 | - tty_oldmode = tty_mode; | ||
| 46 | eff_uid = -1; /* make UserContext fork */ | ||
| 47 | real_uid = multi_uid; | ||
| 48 | if ((ret = UserContext()) <= 0) | ||
| 49 | @@ -174,11 +170,6 @@ int how; | ||
| 50 | Panic(errno, "UserContext"); | ||
| 51 | close(multipipe[1]); | ||
| 52 | read(multipipe[0], &dummy, 1); | ||
| 53 | - if (tty_oldmode >= 0) | ||
| 54 | - { | ||
| 55 | - chmod(attach_tty, tty_oldmode); | ||
| 56 | - tty_oldmode = -1; | ||
| 57 | - } | ||
| 58 | ret = UserStatus(); | ||
| 59 | #ifdef LOCK | ||
| 60 | if (ret == SIG_LOCK) | ||
| 61 | @@ -224,9 +215,6 @@ int how; | ||
| 62 | xseteuid(multi_uid); | ||
| 63 | xseteuid(own_uid); | ||
| 64 | #endif | ||
| 65 | - if (chmod(attach_tty, 0666)) | ||
| 66 | - Panic(errno, "chmod %s", attach_tty); | ||
| 67 | - tty_oldmode = tty_mode; | ||
| 68 | } | ||
| 69 | # endif /* USE_SETEUID */ | ||
| 70 | #endif /* MULTIUSER */ | ||
| 71 | @@ -423,13 +411,6 @@ int how; | ||
| 72 | ContinuePlease = 0; | ||
| 73 | # ifndef USE_SETEUID | ||
| 74 | close(multipipe[1]); | ||
| 75 | -# else | ||
| 76 | - xseteuid(own_uid); | ||
| 77 | - if (tty_oldmode >= 0) | ||
| 78 | - if (chmod(attach_tty, tty_oldmode)) | ||
| 79 | - Panic(errno, "chmod %s", attach_tty); | ||
| 80 | - tty_oldmode = -1; | ||
| 81 | - xseteuid(real_uid); | ||
| 82 | # endif | ||
| 83 | } | ||
| 84 | #endif | ||
| 85 | @@ -505,14 +486,6 @@ AttacherFinit SIGDEFARG | ||
| 86 | close(s); | ||
| 87 | } | ||
| 88 | } | ||
| 89 | -#ifdef MULTIUSER | ||
| 90 | - if (tty_oldmode >= 0) | ||
| 91 | - { | ||
| 92 | - if (setuid(own_uid)) | ||
| 93 | - Panic(errno, "setuid"); | ||
| 94 | - chmod(attach_tty, tty_oldmode); | ||
| 95 | - } | ||
| 96 | -#endif | ||
| 97 | exit(0); | ||
| 98 | SIGRETURN; | ||
| 99 | } | ||
| 100 | diff --git a/screen.c b/screen.c | ||
| 101 | index 8bce303..f2e8171 100644 | ||
| 102 | --- a/screen.c | ||
| 103 | +++ b/screen.c | ||
| 104 | @@ -230,8 +230,6 @@ char *multi_home; | ||
| 105 | int multi_uid; | ||
| 106 | int own_uid; | ||
| 107 | int multiattach; | ||
| 108 | -int tty_mode; | ||
| 109 | -int tty_oldmode = -1; | ||
| 110 | #endif | ||
| 111 | |||
| 112 | char HostName[MAXSTR]; | ||
| 113 | @@ -1009,9 +1007,6 @@ int main(int ac, char** av) | ||
| 114 | |||
| 115 | /* ttyname implies isatty */ | ||
| 116 | SetTtyname(true, &st); | ||
| 117 | -#ifdef MULTIUSER | ||
| 118 | - tty_mode = (int)st.st_mode & 0777; | ||
| 119 | -#endif | ||
| 120 | |||
| 121 | fl = fcntl(0, F_GETFL, 0); | ||
| 122 | if (fl != -1 && (fl & (O_RDWR|O_RDONLY|O_WRONLY)) == O_RDWR) | ||
| 123 | @@ -2170,20 +2165,6 @@ DEFINE_VARARGS_FN(Panic) | ||
| 124 | if (D_userpid) | ||
| 125 | Kill(D_userpid, SIG_BYE); | ||
| 126 | } | ||
| 127 | -#ifdef MULTIUSER | ||
| 128 | - if (tty_oldmode >= 0) { | ||
| 129 | - | ||
| 130 | -# ifdef USE_SETEUID | ||
| 131 | - if (setuid(own_uid)) | ||
| 132 | - xseteuid(own_uid); /* may be a loop. sigh. */ | ||
| 133 | -# else | ||
| 134 | - setuid(own_uid); | ||
| 135 | -# endif | ||
| 136 | - | ||
| 137 | - debug1("Panic: changing back modes from %s\n", attach_tty); | ||
| 138 | - chmod(attach_tty, tty_oldmode); | ||
| 139 | - } | ||
| 140 | -#endif | ||
| 141 | eexit(1); | ||
| 142 | } | ||
| 143 | |||
| 144 | -- | ||
| 145 | 2.40.0 | ||
| 146 | |||
diff --git a/meta/recipes-extended/screen/screen_4.9.0.bb b/meta/recipes-extended/screen/screen_4.9.0.bb index d137c85600..540a78e04b 100644 --- a/meta/recipes-extended/screen/screen_4.9.0.bb +++ b/meta/recipes-extended/screen/screen_4.9.0.bb | |||
| @@ -23,6 +23,7 @@ SRC_URI = "${GNU_MIRROR}/screen/screen-${PV}.tar.gz \ | |||
| 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 | file://CVE-2025-46805.patch \ |
| 26 | file://CVE-2025-46802.patch \ | ||
| 26 | " | 27 | " |
| 27 | 28 | ||
| 28 | SRC_URI[sha256sum] = "f9335281bb4d1538ed078df78a20c2f39d3af9a4e91c57d084271e0289c730f4" | 29 | SRC_URI[sha256sum] = "f9335281bb4d1538ed078df78a20c2f39d3af9a4e91c57d084271e0289c730f4" |
