🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.devel.release
5 messages
5 total messages Started by Marc Haber Wed, 25 Nov 2026 20:00
Bug#1155346: trixie-pu: package sudo/1.9.16p2-3+deb13u6
#1164
Author: Marc Haber
Date: Wed, 25 Nov 2026 20:00
176 lines
8745 bytes
This is a multi-part MIME message sent by reportbug.


--===============4488353172207869289==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: release.debian.org
Severity: normal
Tags: trixie
X-Debbugs-Cc: sudo@packages.debian.org
Control: affects -1 + src:sudo
User: release.debian.org@packages.debian.org
Usertags: pu

This upload fixe a segfault regression introduced by the 13.8 point 
release. This probably warrants a fasttrack-update via trixie-updates 
and a corresponding advisory. If you disagree, please consider this 
upload for 13.9. Same reasons.

[ Reason ]
sudo 1.9.16p2-3+deb13u5 has a regression bug and segfaults if the 
environment is empty. reproducer: env -i sudo id.

[ Impact ]
sudo segfaults if called with empty environment. emptying the 
environment is a common idiom in security-aware scripts.

A segfault in an suid binary is almost always a bad news. However, 
upstream agrees with the Debian security team that this doesnt warrant a 
security release.

[ Tests ]
This update includes a new autopkgtest part that checks sudo with empty 
environment. It is verified to fail in sudo 1.9.16p2-3+deb13u5 and to 
pass with this patch.

[ Risks ]
The patch could be buggy as welll.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
Add patch to fix the issue
Add autopkgtest that checks for the issue.

--===============4488353172207869289==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="sudo_1.9.16p2-3+deb13u5_1.9.16p2-3+deb13u6.debdiff"

diff -Nru sudo-1.9.16p2/debian/changelog sudo-1.9.16p2/debian/changelog
--- sudo-1.9.16p2/debian/changelog	2026-09-29 16:02:29.000000000 +0200
+++ sudo-1.9.16p2/debian/changelog	2026-11-25 07:26:49.000000000 +0100
@@ -1,3 +1,11 @@
+sudo (1.9.16p2-3+deb13u6) trixie; urgency=medium
+
+  * add autopkgtest to test sudo with empty environment
+  * add upstream patch: always copy envp, even when it is empty.
+    Thanks to Michael Kriese (Closes: #1154725)
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Wed, 25 Nov 2026 07:26:49 +0100
+
 sudo (1.9.16p2-3+deb13u5) trixie; urgency=medium
 
   * bump version number to allow git-debpush to work again
diff -Nru sudo-1.9.16p2/debian/patches/0014-os_init_common-always-copy-envp-even-when-it-is-empt.patch sudo-1.9.16p2/debian/patches/0014-os_init_common-always-copy-envp-even-when-it-is-empt.patch
--- sudo-1.9.16p2/debian/patches/0014-os_init_common-always-copy-envp-even-when-it-is-empt.patch	1970-01-01 01:00:00.000000000 +0100
+++ sudo-1.9.16p2/debian/patches/0014-os_init_common-always-copy-envp-even-when-it-is-empt.patch	2026-11-25 07:26:33.000000000 +0100
@@ -0,0 +1,48 @@
+From: Michael Kriese <michael.kriese@gmx.de>
+Date: Mon, 23 Nov 2026 13:16:34 +0100
+Subject: os_init_common: always copy envp, even when it is empty
+
+Since 194042b, submit_envp is only allocated when the environment
+is not empty.  With an empty environment (e.g. "env -i sudo true")
+it stays NULL and the plugins get a NULL envp, which makes sudoers.so
+crash with a NULL pointer dereference.  Allocate the copy
+unconditionally so plugins always get a NULL-terminated array.
+
+Co-Authored-By: Claude Opus 5.5 <michael.kriese+claude-code@gmx.de>
+---
+ src/sudo.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/sudo.c b/src/sudo.c
+index de7e809..93a3c50 100644
+--- a/src/sudo.c
++++ b/src/sudo.c
+@@ -375,19 +375,19 @@ os_init_common(int argc, char *argv[], char *envp[])
+      * Make a shallow copy of envp[] and store in submit_envp[].
+      * This allows us to remove variables from sudo's environment
+      * while still providing the original envp to the plugins.
++     * The copy is made even for an empty environment since the
++     * plugins expect a non-NULL envp.
+      */
+     for (envc = 0; envp[envc] != NULL; envc++)
+ 	continue;
+-    if (envc != 0) {
+-	submit_envp = reallocarray(NULL, sizeof(char *), envc + 1);
+-	if (submit_envp == NULL || !gc_add(GC_PTR, submit_envp)) {
+-	    sudo_fatalx_nodebug(U_("%s: %s"), __func__,
+-		U_("unable to allocate memory"));
+-	}
+-	for (envc = 0; envp[envc] != NULL; envc++)
+-	    submit_envp[envc] = envp[envc];
+-	submit_envp[envc] = NULL;
++    submit_envp = reallocarray(NULL, sizeof(char *), envc + 1);
++    if (submit_envp == NULL || !gc_add(GC_PTR, submit_envp)) {
++	sudo_fatalx_nodebug(U_("%s: %s"), __func__,
++	    U_("unable to allocate memory"));
+     }
++    for (envc = 0; envp[envc] != NULL; envc++)
++	submit_envp[envc] = envp[envc];
++    submit_envp[envc] = NULL;
+ 
+     return 0;
+ }
diff -Nru sudo-1.9.16p2/debian/patches/series sudo-1.9.16p2/debian/patches/series
--- sudo-1.9.16p2/debian/patches/series	2026-09-29 16:02:29.000000000 +0200
+++ sudo-1.9.16p2/debian/patches/series	2026-11-25 07:26:33.000000000 +0100
@@ -11,3 +11,4 @@
 0011-sudo-ignore-user-specified-TZ-environment-variable.patch
 0012-Remove-TZ-from-sudo-s-working-environment-without-mo.patch
 0013-Copy-envp-submit_envp-instead-of-replacing-the-envir.patch
+0014-os_init_common-always-copy-envp-even-when-it-is-empt.patch
diff -Nru sudo-1.9.16p2/debian/tests/01-getroot sudo-1.9.16p2/debian/tests/01-getroot
--- sudo-1.9.16p2/debian/tests/01-getroot	2026-09-29 16:02:29.000000000 +0200
+++ sudo-1.9.16p2/debian/tests/01-getroot	2026-11-25 07:26:33.000000000 +0100
@@ -96,5 +96,21 @@
   fi
 done
 
-printf "test series sucessful, exit 0\n"
+printf "========= test %s\.4: account group member, empty sudo environment\n" "${TESTNR}"
+rm -f "${HOMEDIRA}/std*"
+RET=0
+printf "trying %s with empty sudo environment\n" "${ACCTA}"
+su - "${ACCTA}" -c "ASUSER_EMPTY_ENV=1 ${COMMONDIR}/asuser ${PASSWD}" || RET=$?
+printf "%s with empty sudo environment, return value %s\n" "${ACCTA}" "${RET}"
+if [ "$(cat ${HOMEDIRA}/stdout)" != "0" ]; then
+  echo >&2 "id -u did not give 0"
+  printf >&2 "stdout:\n"
+  cat >&2 "${HOMEDIRA}/stdout"
+  printf >&2 "stderr:\n"
+  cat >&2 "${HOMEDIRA}/stderr"
+  printf >&2 "exit code %s\n" "${RET}"
+  exit 1
+fi
+
+printf "test series successful, exit 0\n"
 exit 0
diff -Nru sudo-1.9.16p2/debian/tests/common/asuser sudo-1.9.16p2/debian/tests/common/asuser
--- sudo-1.9.16p2/debian/tests/common/asuser	2026-09-29 16:02:29.000000000 +0200
+++ sudo-1.9.16p2/debian/tests/common/asuser	2026-11-25 07:26:33.000000000 +0100
@@ -2,6 +2,9 @@
 
 set -e
 
-echo "${1:-}" | sudo -u "${2:-root}" --stdin id -u > "${3:-stdout}" 2> "${4:-stderr}"
-
+ENVI=""
+if [[ "${ASUSER_EMPTY_ENV:-}" = 1 ]]; then
+  ENVI="env -i"
+fi
 
+echo "${1:-}" | ${ENVI} /usr/bin/sudo -u "${2:-root}" --stdin id -u > "${3:-stdout}" 2> "${4:-stderr}"

--===============4488353172207869289==--
Processed: trixie-pu: package sudo/1.9.16p2-3+deb13u6
#1163
Author: Debian Bug Tracking System
Date: Wed, 25 Nov 2026 20:00
10 lines
2206 bytes
Processing control commands:

> affects -1 + src:sudo
Bug #1155346 [release.debian.org] trixie-pu: package sudo/1.9.16p2-3+deb13u6
Added indication that 1155346 affects src:sudo

-- 
1155346: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1155346
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
Bug#1155346: trixie-pu: package sudo/1.9.16p2-3+deb13u6
#1248
Author: Adam D. Barratt
Date: Tue, 01 Dec 2026 19:20
19 lines
2515 bytes
Control: tags -1 + confirmed

On Wed, 2026-11-25 at 08:20 +0100, Marc Haber wrote:
> sudo 1.9.16p2-3+deb13u5 has a regression bug and segfaults if the 
> environment is empty. reproducer: env -i sudo id.
> 
> [ Impact ]
> sudo segfaults if called with empty environment. emptying the 
> environment is a common idiom in security-aware scripts.
> 
> A segfault in an suid binary is almost always a bad news. However, 
> upstream agrees with the Debian security team that this doesnt
> warrant a security release.

Please go ahead.

Regards,

Adam
Processed: Re: Bug#1155346: trixie-pu: package sudo/1.9.16p2-3+deb13u6
#1249
Author: Debian Bug Tracking System
Date: Tue, 01 Dec 2026 19:20
13 lines
2421 bytes
Processing control commands:

> tags -1 + confirmed
Bug #1155346 [release.debian.org] trixie-pu: package sudo/1.9.16p2-3+deb13u6
Bug #1155201 [release.debian.org] trixie-pu: package sudo/1.9.16p2-3+deb13u6
Added tag(s) confirmed.
Added tag(s) confirmed.

-- 
1155201: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1155201
1155346: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1155346
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
Bug#1155346: trixie-pu: package sudo/1.9.16p2-3+deb13u6
#1250
Author: Marc Haber
Date: Tue, 01 Dec 2026 20:20
27 lines
3466 bytes
On Tue, Dec 01, 2026 at 07:14:49PM +0000, Adam D. Barratt wrote:
>Please go ahead.

thanks for the review. The package sudo/1.9.16p2-3+deb13u6 is already in 
stable-new:

sudo       | 1.9.5p2-3+deb11u1  | oldoldstable       | source, amd64, arm64, armhf, i386
sudo       | 1.9.5p2-3+deb11u1  | oldoldstable-debug | source
sudo       | 1.9.13p3-1+deb12u4 | oldstable          | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
sudo       | 1.9.13p3-1+deb12u4 | oldstable-debug    | source
sudo       | 1.9.16p2-3+deb13u5 | stable             | source, amd64, arm64, armel, armhf, i386, ppc64el, riscv64, s390x
sudo       | 1.9.16p2-3+deb13u5 | stable-debug       | source
sudo       | 1.9.16p2-3+deb13u6 | stable-new         | source
sudo       | 1.9.17p2-12        | testing            | source, amd64, arm64, armhf, i386, loong64, ppc64el, riscv64, s390x
sudo       | 1.9.17p2-12        | unstable           | source, amd64, arm64, armhf, i386, loong64, ppc64el, riscv64, s390x
sudo       | 1.9.17p2-12        | unstable-debug     | source

How do I go ahead from here?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads