Version in base suite: 3.11-1 Base version: needrestart_3.11-1 Target version: needrestart_3.11-1.1~deb13u2 Base file: /srv/ftp-master.debian.org/ftp/pool/main/n/needrestart/needrestart_3.11-1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/n/needrestart/needrestart_3.11-1.1~deb13u2.dsc changelog | 27 +++++ patches/needrestart-anchor-the-systemd-cgroup-matches.patch | 53 ++++++++++ patches/needrestart-replace-non-ASCII-and-control-characters.patch | 41 +++++++ patches/notify.d-pass-the-notification-text-to-su-through-th.patch | 43 ++++++++ patches/series | 3 5 files changed, 167 insertions(+) dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmpultci5ph/needrestart_3.11-1.dsc: no acceptable signature found dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmpultci5ph/needrestart_3.11-1.1~deb13u2.dsc: no acceptable signature found diff -Nru needrestart-3.11/debian/changelog needrestart-3.11/debian/changelog --- needrestart-3.11/debian/changelog 2025-04-15 11:48:01.000000000 +0000 +++ needrestart-3.11/debian/changelog 2026-11-18 23:05:06.000000000 +0000 @@ -1,3 +1,30 @@ +needrestart (3.11-1.1~deb13u2) trixie-security; urgency=high + + * Non-maintainer upload by the Security Team. + * Fix incorrect backport of "notify.d: pass the notification text to su + through the environment" + Thanks to Guilhem Moulin + + -- Salvatore Bonaccorso Thu, 19 Nov 2026 00:05:06 +0100 + +needrestart (3.11-1.1~deb13u1) trixie-security; urgency=high + + * Non-maintainer upload by the Security Team. + * Rebuild for trixie-security + + -- Salvatore Bonaccorso Wed, 18 Nov 2026 19:49:28 +0100 + +needrestart (3.11-1.1) unstable; urgency=high + + * Non-maintainer upload. + * notify.d: pass the notification text to su through the environment + (CVE-2026-124757) + * needrestart: anchor the systemd cgroup matches (CVE-2026-124757) + * needrestart: replace non-ASCII and control characters in process names + (CVE-2026-124757) + + -- Salvatore Bonaccorso Tue, 17 Nov 2026 22:47:05 +0100 + needrestart (3.11-1) unstable; urgency=medium * New upstream release. diff -Nru needrestart-3.11/debian/patches/needrestart-anchor-the-systemd-cgroup-matches.patch needrestart-3.11/debian/patches/needrestart-anchor-the-systemd-cgroup-matches.patch --- needrestart-3.11/debian/patches/needrestart-anchor-the-systemd-cgroup-matches.patch 1970-01-01 00:00:00.000000000 +0000 +++ needrestart-3.11/debian/patches/needrestart-anchor-the-systemd-cgroup-matches.patch 2026-11-18 18:47:24.000000000 +0000 @@ -0,0 +1,53 @@ +From: Armaan Sandhu +Date: Fri, 23 Oct 2026 18:16:55 -0400 +Subject: needrestart: anchor the systemd cgroup matches +Origin: https://github.com/liske/needrestart/commit/7874c082c86f041512b01a02860a89b463524684 +Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2026-124757 + +needrestart files a process under a user session, a user manager or a user service by matching the path in /proc/PID/cgroup. Those matches were not anchored at the start, so a directory with the right name created inside a user's own delegated user@UID.service cgroup could give a process a different uid. A process started by one user could be filed under root's session, and the notification hook then ran su as root with that process name. + +The session, user manager and user service matches now only accept paths that begin with systemd's slice components before the user-N.slice, user@N.service or session scope. Paths that match the systemd layout are classified as before, and paths that only contain the same text inside a user-owned subtree no longer match. + +This was tested against systemd layouts only. Hosts whose cgroup paths have a different prefix, such as some container setups, may classify those processes differently. + +Found and reported privately by Armaan Sandhu. +--- + needrestart | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/needrestart b/needrestart +index 7fb1adf09890..bfb3348438ef 100755 +--- a/needrestart ++++ b/needrestart +@@ -723,24 +723,24 @@ if(defined($opt_l)) { + next; + } + # `systemd --user` manager +- if($cgroup =~ m@/user\@(\d+)\.service/init\.scope$@ && $ptable->{$pid}->{fname} ne "(sd-pam)") { ++ if($cgroup =~ m@^(?:/[^/]+\.slice)*/user\@(\d+)\.service/init\.scope$@ && $ptable->{$pid}->{fname} ne "(sd-pam)") { + print STDERR "$LOGPREF #$pid is user systemd manager: uid=$1\n" if($nrconf{verbosity} > 1); + # TODO: restart specific `systemd --user` instance? + $restart{q(systemd-user)}++; + next; + } + +- if($cgroup =~ m@/user-(\d+)\.slice/session-(\d+)\.scope@) { ++ if($cgroup =~ m@^(?:/[^/]+\.slice)*/user-(\d+)\.slice/session-(\d+)\.scope@) { + print STDERR "$LOGPREF #$pid part of user session: uid=$1 sess=$2\n" if($nrconf{verbosity} > 1); + push(@{ $sessions{$1}->{"session #$2"}->{ $ptable->{$pid}->{fname} } }, $pid); + next; + } +- if($cgroup =~ m@/user\@(\d+)\.service(/.+\.slice)*/([^/]+\.service)$@) { ++ if($cgroup =~ m@^(?:/[^/]+\.slice)*/user\@(\d+)\.service(/.+\.slice)*/([^/]+\.service)$@) { + print STDERR "$LOGPREF #$pid part of user service: uid=$1 unit=$3\n" if($nrconf{verbosity} > 1); + push(@{ $sessions{$1}->{'user service'}->{ $3 } }, $pid); + next; + } +- if($cgroup =~ m@/user\@(\d+)\.service@) { ++ if($cgroup =~ m@^(?:/[^/]+\.slice)*/user\@(\d+)\.service@) { + print STDERR "$LOGPREF #$pid part of user manager: uid=$1\n" if($nrconf{verbosity} > 1); + push(@{ $sessions{$1}->{'user manager'}->{ $ptable->{$pid}->{fname} } }, $pid); + next; +-- +2.55.0 + diff -Nru needrestart-3.11/debian/patches/needrestart-replace-non-ASCII-and-control-characters.patch needrestart-3.11/debian/patches/needrestart-replace-non-ASCII-and-control-characters.patch --- needrestart-3.11/debian/patches/needrestart-replace-non-ASCII-and-control-characters.patch 1970-01-01 00:00:00.000000000 +0000 +++ needrestart-3.11/debian/patches/needrestart-replace-non-ASCII-and-control-characters.patch 2026-11-18 18:47:24.000000000 +0000 @@ -0,0 +1,41 @@ +From: Armaan Sandhu +Date: Fri, 23 Oct 2026 18:16:55 -0400 +Subject: needrestart: replace non-ASCII and control characters in process + names +Origin: https://github.com/liske/needrestart/commit/e8ae1f22f16b0b6023f86af0bcfdd88277f8ecec +Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2026-124757 + +Process names come from /proc and can contain escape sequences and newlines. They were printed to the terminal unchanged, which allowed terminal escape injection in the process list shown to the administrator. A newline in a name could also split a line of the machine readable NEEDRESTART-PID output. + +Only printable ASCII characters (0x20 to 0x7e) are now kept in the displayed copies and in the text passed to notification hooks. Every other byte is replaced with ?, so control characters and the bytes of UTF-8 encoded names are covered by one simple rule. A name with non-ASCII letters therefore shows one ? per byte. That is a deliberate trade-off: the rule is easy to read and cannot miss an escape that is encoded as UTF-8. The stored process names are not changed. + +Found and reported privately by Armaan Sandhu. +--- + needrestart | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/needrestart b/needrestart +index bfb3348438ef..7d644b30b8a6 100755 +--- a/needrestart ++++ b/needrestart +@@ -879,7 +879,7 @@ if(defined($opt_l)) { + if($uid && scalar %stage2) { + my %fnames; + foreach my $pid (keys %stage2) { +- push(@{$fnames{ $ptable->{$pid}->{fname} }}, $pid); ++ push(@{$fnames{ $ptable->{$pid}->{fname} =~ s/[^\x20-\x7e]/?/gr }}, $pid); + } + + if($opt_b) { +@@ -1372,7 +1372,7 @@ if(defined($opt_l) && !$uid) { + unless($opt_p || $opt_b) { + foreach my $uid (sort { ncmp(uid2name($a), uid2name($b)); } keys %sessions) { + foreach my $sess (sort keys %{ $sessions{$uid} }) { +- my $fnames = join(', ',map { $_.'['.join(',', @{ $sessions{$uid}->{$sess}->{$_} }).']'; } nsort keys %{ $sessions{$uid}->{$sess} }); ++ my $fnames = join(', ',map { (s/[^\x20-\x7e]/?/gr).'['.join(',', @{ $sessions{$uid}->{$sess}->{$_} }).']'; } nsort keys %{ $sessions{$uid}->{$sess} }); + $ui->notice(' '.uid2name($uid)." @ $sess: $fnames") unless($opt_m eq 'e'); + if($nrconf{sendnotify}) { + local %ENV; +-- +2.55.0 + diff -Nru needrestart-3.11/debian/patches/notify.d-pass-the-notification-text-to-su-through-th.patch needrestart-3.11/debian/patches/notify.d-pass-the-notification-text-to-su-through-th.patch --- needrestart-3.11/debian/patches/notify.d-pass-the-notification-text-to-su-through-th.patch 1970-01-01 00:00:00.000000000 +0000 +++ needrestart-3.11/debian/patches/notify.d-pass-the-notification-text-to-su-through-th.patch 2026-11-18 23:04:53.000000000 +0000 @@ -0,0 +1,43 @@ +From: Armaan Sandhu +Date: Fri, 23 Oct 2026 18:16:55 -0400 +Subject: notify.d: pass the notification text to su through the environment +Origin: https://github.com/liske/needrestart/commit/b1996a1a6e2b22fbfdf3062d06712b0a49a99d73 +Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2026-124757 + +The 400-notify-send hook built the su -c command string from the notification title and body. The body contains the process names that needrestart reports, and a process sets its own 15 byte comm name with prctl(PR_SET_NAME). A name that closes the quote and adds shell syntax was therefore executed by the shell that su starts, instead of being shown as text. + +The title and body are now stored in NR_NOTIFY_TITLE and NR_NOTIFY_BODY, exported, and expanded by the inner shell as quoted data, so the command string no longer contains any notification text. The existing MSGTITLE and MSGBODY variables are renamed instead of being copied into new ones, so there is no second copy of the text to keep in sync. + +Found and reported privately by Armaan Sandhu. +[Salvatore Bonaccorso: Backport for Debian which switches from su invocation to runuser, +in 10-notify-send-timeout.diff patch] +--- + ex/notify.d/400-notify-send | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/ex/notify.d/400-notify-send b/ex/notify.d/400-notify-send +index 800bc754486b..af5e6bc00014 100755 +--- a/ex/notify.d/400-notify-send ++++ b/ex/notify.d/400-notify-send +@@ -48,11 +48,15 @@ case "$NR_SESSION" in + + echo "[$0] notify user $NR_USERNAME on $DISPLAY" 1>&2 + +- MSGTITLE=$(gettext 'Relogin or restarts required!') +- MSGBODY=$(gettext 'Your session is running obsolete binaries or libraries as listed below. ++ NR_NOTIFY_TITLE=$(gettext 'Relogin or restarts required!') ++ NR_NOTIFY_BODY=$(gettext 'Your session is running obsolete binaries or libraries as listed below. + Please consider a relogin or restart of the affected processes!')'\n'$(cat) + +- runuser -p -u "$NR_USERNAME" -- "$NSEND" -a needrestart -u critical -i dialog-warning "$MSGTITLE" "$MSGBODY" ++ # Pass the text to su through the environment: the inner shell expands it as ++ # data, so process names in the body are never parsed as shell code. ++ export NR_NOTIFY_TITLE NR_NOTIFY_BODY ++ ++ runuser -p -u "$NR_USERNAME" -- "$NSEND" -a needrestart -u critical -i dialog-warning "$NR_NOTIFY_TITLE" "$NR_NOTIFY_BODY" + ;; + *) + echo "[$0] skip session '$NR_SESSION'" 1>&2 +-- +2.55.0 + diff -Nru needrestart-3.11/debian/patches/series needrestart-3.11/debian/patches/series --- needrestart-3.11/debian/patches/series 2025-04-15 11:48:01.000000000 +0000 +++ needrestart-3.11/debian/patches/series 2026-11-18 18:47:24.000000000 +0000 @@ -2,3 +2,6 @@ 03-ignore-serial-getty.diff 08-uninitialized-vars-arm.diff 10-notify-send-timeout.diff +notify.d-pass-the-notification-text-to-su-through-th.patch +needrestart-anchor-the-systemd-cgroup-matches.patch +needrestart-replace-non-ASCII-and-control-characters.patch