[packages/sudo] Rel 3.

arekm arekm at pld-linux.org
Thu Oct 29 09:40:52 CET 2026


commit cd99f7688a977efc5847704169ab89d2be2b31f0
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Oct 29 09:24:14 2026 +0100

    Rel 3.
    
    Fixes CVE-2026-96512, CVE-2026-35535.

 CVE-2026-35535.patch            | 145 ++++++++++++++++++++++++++
 CVE-2026-96512.patch            | 224 ++++++++++++++++++++++++++++++++++++++++
 sudo-set_user_groups-fail.patch |  28 +++++
 sudo.spec                       |  13 ++-
 4 files changed, 408 insertions(+), 2 deletions(-)
---
diff --git a/sudo.spec b/sudo.spec
index cc38ca3..f8e47c0 100644
--- a/sudo.spec
+++ b/sudo.spec
@@ -30,7 +30,7 @@ Summary(uk.UTF-8):	Дозволяє вказаним користувачам в
 Name:		sudo
 # please see docs/UPGRADE.md for important changes each time updating sudo
 Version:	1.9.17p2
-Release:	2
+Release:	3
 Epoch:		1
 License:	BSD
 Group:		Applications/System
@@ -41,7 +41,11 @@ Source2:	%{name}-i.pamd
 Patch0:		%{name}-env.patch
 Patch1:		config.patch
 Patch2:		%{name}-sh.patch
-URL:		http://www.sudo.ws/sudo/
+Patch3:		CVE-2026-35535.patch
+Patch4:		CVE-2026-96512.patch
+# https://github.com/sudo-project/sudo/commit/0d98cb88ae89b01955adef3908422ce3a48e1d62
+Patch5:		%{name}-set_user_groups-fail.patch
+URL:		https://www.sudo.ws/sudo/
 %{?with_audit:BuildRequires:	audit-libs-devel}
 BuildRequires:	autoconf >= 2.69
 BuildRequires:	automake
@@ -53,6 +57,7 @@ BuildRequires:	gettext-tools
 %{?with_selinux:BuildRequires:	libselinux-devel}
 BuildRequires:	libtool >= 2:2.2.6
 %{?with_ldap:BuildRequires:	openldap-devel >= 2.3.0}
+BuildRequires:	openssl-devel
 %{?with_pam:BuildRequires:	pam-devel}
 BuildRequires:	rpm >= 4.4.9-56
 BuildRequires:	rpm-build >= 4.6
@@ -194,6 +199,9 @@ cp -p acinclude.m4 acinclude.m4.orig
 %patch -P0 -p1
 %patch -P1 -p1
 %patch -P2 -p1
+%patch -P3 -p1
+%patch -P4 -p1
+%patch -P5 -p1
 
 %build
 %{__libtoolize}
@@ -201,6 +209,7 @@ cp -p acinclude.m4 acinclude.m4.orig
 %{__autoconf}
 %configure \
 	MANDOC=/usr/bin/mandoc \
+	--enable-openssl \
 	--enable-zlib=system \
 	%{__with_without apparmor} \
 	--with-env-editor \
diff --git a/CVE-2026-35535.patch b/CVE-2026-35535.patch
new file mode 100644
index 0000000..35554ae
--- /dev/null
+++ b/CVE-2026-35535.patch
@@ -0,0 +1,145 @@
+From 3e474c2f201484be83d994ae10a4e20e8c81bb69 Mon Sep 17 00:00:00 2001
+From: "Todd C. Miller" <Todd.Miller at sudo.ws>
+Date: Sat, 8 Nov 2025 15:34:02 -0700
+Subject: [PATCH] exec_mailer: Set group as well as uid when running the mailer
+
+Also make a setuid(), setgid() or setgroups() failure fatal.
+
+Found by the ZeroPath AI Security Engineer <https://zeropath.com>
+
+Rebased onto 1.9.17p2 (eventlog_conf.c context), as in Debian 1.9.17p2-5.
+---
+ include/sudo_eventlog.h      |  3 ++-
+ lib/eventlog/eventlog.c      | 21 +++++++++++++++++----
+ lib/eventlog/eventlog_conf.c |  4 +++-
+ plugins/sudoers/logging.c    |  2 +-
+ plugins/sudoers/policy.c     |  2 +-
+ 5 files changed, 24 insertions(+), 8 deletions(-)
+
+diff --git a/include/sudo_eventlog.h b/include/sudo_eventlog.h
+index eb9f4f4..485d259 100644
+--- a/include/sudo_eventlog.h
++++ b/include/sudo_eventlog.h
+@@ -80,6 +80,7 @@ struct eventlog_config {
+     int syslog_rejectpri;
+     int syslog_alertpri;
+     uid_t mailuid;
++    gid_t mailgid;
+     bool omit_hostname;
+     const char *logpath;
+     const char *time_fmt;
+@@ -151,7 +152,7 @@ void eventlog_set_syslog_rejectpri(int pri);
+ void eventlog_set_syslog_alertpri(int pri);
+ void eventlog_set_syslog_maxlen(size_t len);
+ void eventlog_set_file_maxlen(size_t len);
+-void eventlog_set_mailuid(uid_t uid);
++void eventlog_set_mailuser(uid_t uid, gid_t gid);
+ void eventlog_set_omit_hostname(bool omit_hostname);
+ void eventlog_set_logpath(const char *path);
+ void eventlog_set_time_fmt(const char *fmt);
+diff --git a/lib/eventlog/eventlog.c b/lib/eventlog/eventlog.c
+index 5a32824..d56c4e4 100644
+--- a/lib/eventlog/eventlog.c
++++ b/lib/eventlog/eventlog.c
+@@ -304,15 +304,13 @@ exec_mailer(int pipein)
+ 	syslog(LOG_ERR, _("unable to dup stdin: %m")); // -V618
+ 	sudo_debug_printf(SUDO_DEBUG_ERROR,
+ 	    "unable to dup stdin: %s", strerror(errno));
+-	sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
+-	_exit(127);
++	goto bad;
+     }
+ 
+     /* Build up an argv based on the mailer path and flags */
+     if ((mflags = strdup(evl_conf->mailerflags)) == NULL) {
+ 	syslog(LOG_ERR, _("unable to allocate memory")); // -V618
+-	sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
+-	_exit(127);
++	goto bad;
+     }
+     argv[0] = sudo_basename(mpath);
+ 
+@@ -331,11 +329,23 @@ exec_mailer(int pipein)
+     if (setuid(ROOT_UID) != 0) {
+ 	sudo_debug_printf(SUDO_DEBUG_ERROR, "unable to change uid to %u",
+ 	    ROOT_UID);
++	goto bad;
++    }
++    if (setgid(evl_conf->mailgid) != 0) {
++	sudo_debug_printf(SUDO_DEBUG_ERROR, "unable to change gid to %u",
++	    (unsigned int)evl_conf->mailgid);
++	goto bad;
++    }
++    if (setgroups(1, &evl_conf->mailgid) != 0) {
++	sudo_debug_printf(SUDO_DEBUG_ERROR, "unable to set groups to %u",
++	    (unsigned int)evl_conf->mailgid);
++	goto bad;
+     }
+     if (evl_conf->mailuid != ROOT_UID) {
+ 	if (setuid(evl_conf->mailuid) != 0) {
+ 	    sudo_debug_printf(SUDO_DEBUG_ERROR, "unable to change uid to %u",
+ 		(unsigned int)evl_conf->mailuid);
++	    goto bad;
+ 	}
+     }
+     sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
+@@ -347,6 +357,9 @@ exec_mailer(int pipein)
+     sudo_debug_printf(SUDO_DEBUG_ERROR, "unable to execute %s: %s",
+ 	mpath, strerror(errno));
+     _exit(127);
++bad:
++    sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
++    _exit(127);
+ }
+ 
+ /* Send a message to the mailto user */
+diff --git a/lib/eventlog/eventlog_conf.c b/lib/eventlog/eventlog_conf.c
+index 0663a38..ec3b569 100644
+--- a/lib/eventlog/eventlog_conf.c
++++ b/lib/eventlog/eventlog_conf.c
+@@ -70,6 +70,7 @@ static struct eventlog_config evl_conf = {
+     MAXSYSLOGLEN,		/* syslog_maxlen */
+     0,				/* file_maxlen */
+     ROOT_UID,			/* mailuid */
++    ROOT_GID,			/* mailgid */
+     false,			/* omit_hostname */
+     _PATH_SUDO_LOGFILE,		/* logpath */
+     "%h %e %T",			/* time_fmt */
+@@ -151,9 +152,10 @@ eventlog_set_file_maxlen(size_t len)
+ }
+ 
+ void
+-eventlog_set_mailuid(uid_t uid)
++eventlog_set_mailuser(uid_t uid, gid_t gid)
+ {
+     evl_conf.mailuid = uid;
++    evl_conf.mailgid = gid;
+ }
+ 
+ void
+diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c
+index bd4de92..9535289 100644
+--- a/plugins/sudoers/logging.c
++++ b/plugins/sudoers/logging.c
+@@ -1157,7 +1157,7 @@ init_eventlog_config(void)
+     eventlog_set_syslog_alertpri(def_syslog_badpri);
+     eventlog_set_syslog_maxlen(def_syslog_maxlen);
+     eventlog_set_file_maxlen(def_loglinelen);
+-    eventlog_set_mailuid(ROOT_UID);
++    eventlog_set_mailuser(ROOT_UID, ROOT_GID);
+     eventlog_set_omit_hostname(!def_log_host);
+     eventlog_set_logpath(def_logfile);
+     eventlog_set_time_fmt(def_log_year ? "%h %e %T %Y" : "%h %e %T");
+diff --git a/plugins/sudoers/policy.c b/plugins/sudoers/policy.c
+index f3adfb0..27f6e58 100644
+--- a/plugins/sudoers/policy.c
++++ b/plugins/sudoers/policy.c
+@@ -639,7 +639,7 @@ sudoers_policy_deserialize_info(struct sudoers_context *ctx, void *v,
+     }
+ 
+ #ifdef NO_ROOT_MAILER
+-    eventlog_set_mailuid(ctx->user.uid);
++    eventlog_set_mailuser(ctx->user.uid, ctx->user.gid);
+ #endif
+ 
+     /* Dump settings and user info (XXX - plugin args) */
diff --git a/CVE-2026-96512.patch b/CVE-2026-96512.patch
new file mode 100644
index 0000000..b1cc787
--- /dev/null
+++ b/CVE-2026-96512.patch
@@ -0,0 +1,224 @@
+From db669167ca599f2a94cd8a4c5fae9e473c81a2fd Mon Sep 17 00:00:00 2001
+From: "Todd C. Miller" <Todd.Miller at sudo.ws>
+Date: Sat, 14 Mar 2026 13:13:17 -0600
+Subject: [PATCH] sudo: ignore user-specified TZ environment variable
+
+This avoids potential issues caused by a user-specified timezone
+when running sudo, such as the parsing of NOTBEFORE/NOTAFTER values
+in sudoers.  The TZ variable is still passed to the command being
+run unless blocked by sudoers rules.
+
+Credit:
+- XlabAI Team of Tencent Xuanwu Lab (xlabai at tencent.com)
+- Atuin Automated Vulnerability Discovery Engine
+- Guannan Wang, Zhanpeng Liu, Guancheng Li
+---
+ src/sudo.c | 22 +++++++++++++++++++++-
+ 1 file changed, 21 insertions(+), 1 deletion(-)
+
+diff --git a/src/sudo.c b/src/sudo.c
+index 0d1667d505..859ba4cba3 100644
+--- a/src/sudo.c
++++ b/src/sudo.c
+@@ -94,6 +94,7 @@ static void sudo_check_suid(const char *path);
+ static char **get_user_info(struct user_details *);
+ static void command_info_to_details(char * const info[],
+     struct command_details *details);
++static void set_time_zone(void);
+ static void gc_init(void);
+ 
+ /* Policy plugin convenience functions. */
+@@ -158,7 +159,8 @@ main(int argc, char *argv[], char *envp[])
+     bindtextdomain(PACKAGE_NAME, LOCALEDIR);
+     textdomain(PACKAGE_NAME);
+ 
+-    (void) tzset();
++    /* Use system time zone, not user-specified. */
++    set_time_zone();
+ 
+     /* Must be done before we do any password lookups */
+ #if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS)
+@@ -336,6 +338,24 @@ main(int argc, char *argv[], char *envp[])
+     return EXIT_FAILURE;
+ }
+ 
++/*
++ * Set the time zone using tzset(3), ignoring the user's TZ
++ * environment variable.  The original value of TZ may still
++ * be present in the command's environment, depending on sudoers.
++ */
++static void
++set_time_zone(void)
++{
++    extern char **environ;
++    char **real_environ = environ;
++    char *empty[] = { NULL };
++
++    /* Use system time zone, not user-specified. */
++    environ = empty;
++    (void) tzset();
++    environ = real_environ;
++}
++
+ int
+ os_init_common(int argc, char *argv[], char *envp[])
+ {
+From 1820a349687522f51023d1ae5925125f59679a8c Mon Sep 17 00:00:00 2001
+From: "Todd C. Miller" <Todd.Miller at sudo.ws>
+Date: Fri, 28 Aug 2026 16:13:52 -0600
+Subject: [PATCH] Remove TZ from sudo's working environment without modifying
+ envp.
+
+The earlier change to prevent NOTBEFORE/NOTAFTER in sudoers from
+being affected by a user-specified timezone was not effective since
+the mktime() function re-reads the TZ environment variable each
+time it is called.
+
+Reported by Ermenson Junior
+---
+ src/sudo.c | 31 ++++++++++++++++++++++++-------
+ 1 file changed, 24 insertions(+), 7 deletions(-)
+
+diff --git a/src/sudo.c b/src/sudo.c
+index 859ba4cba3..5c80ce43d6 100644
+--- a/src/sudo.c
++++ b/src/sudo.c
+@@ -339,30 +339,47 @@ main(int argc, char *argv[], char *envp[])
+ }
+ 
+ /*
+- * Set the time zone using tzset(3), ignoring the user's TZ
++ * Set the time zone using tzset(3), removing the user's TZ
+  * environment variable.  The original value of TZ may still
+  * be present in the command's environment, depending on sudoers.
+  */
+ static void
+ set_time_zone(void)
+ {
+-    extern char **environ;
+-    char **real_environ = environ;
+-    char *empty[] = { NULL };
+-
+     /* Use system time zone, not user-specified. */
+-    environ = empty;
++    unsetenv("TZ");
+     (void) tzset();
+-    environ = real_environ;
+ }
+ 
+ int
+ os_init_common(int argc, char *argv[], char *envp[])
+ {
++    extern char **environ;
++    int envc;
+ #ifdef STATIC_SUDOERS_PLUGIN
+     preload_static_symbols();
+ #endif
+     gc_init();
++
++    /*
++     * Make a copy of environ[] that is distinct from envp[].
++     * This allows us to remove variables from sudo's environment
++     * while still providing the original envp to the plugins.
++     */
++    for (envc = 0; envp[envc] != NULL; envc++)
++	continue;
++    if (envc != 0) {
++	char **new_env = reallocarray(NULL, sizeof(char *), envc + 1);
++	if (new_env == NULL || !gc_add(GC_PTR, new_env)) {
++	    sudo_fatalx_nodebug(U_("%s: %s"), __func__,
++		U_("unable to allocate memory"));
++	}
++	for (envc = 0; envp[envc] != NULL; envc++)
++	    new_env[envc] = envp[envc];
++	new_env[envc] = NULL;
++	environ = new_env;
++    }
++
+     return 0;
+ }
+ 
+From 194042b55c54055c7337fbbd93a518e8da69866f Mon Sep 17 00:00:00 2001
+From: "Todd C. Miller" <Todd.Miller at sudo.ws>
+Date: Sun, 30 Aug 2026 08:38:05 -0600
+Subject: [PATCH] Copy envp -> submit_envp instead of replacing the environ
+ pointer.
+
+This has the same effect of passing the unmodified environment to
+the plugin without needing to manually change the environ pointer.
+---
+ src/sudo.c | 26 +++++++++++++++-----------
+ 1 file changed, 15 insertions(+), 11 deletions(-)
+
+diff --git a/src/sudo.c b/src/sudo.c
+index 5c80ce43d6..41d38b3911 100644
+--- a/src/sudo.c
++++ b/src/sudo.c
+@@ -128,8 +128,10 @@ static void approval_show_version(int verbose);
+ sudo_dso_public int main(int argc, char *argv[], char *envp[]);
+ 
+ static struct sudo_settings *sudo_settings;
+-static char * const *user_info, * const *submit_argv, * const *submit_envp;
+-static int submit_optind;
++static char * const *user_info;
++static char * const *submit_argv;	/* argv[] from main() */
++static char **submit_envp;		/* shallow copy of envp[] from main() */
++static int submit_optind;		/* optind from after getopt() */
+ 
+ int
+ main(int argc, char *argv[], char *envp[])
+@@ -200,9 +202,8 @@ main(int argc, char *argv[], char *envp[])
+     if (sudo_conf_disable_coredump())
+ 	disable_coredump();
+ 
+-    /* Parse command line arguments, preserving the original argv/envp. */
++    /* Parse command line arguments, preserving the original argv. */
+     submit_argv = argv;
+-    submit_envp = envp;
+     sudo_mode = parse_args(argc, argv, user_details.shell, &submit_optind,
+ 	&nargc, &nargv, &sudo_settings, &env_add, &list_user);
+     sudo_debug_printf(SUDO_DEBUG_DEBUG, "sudo_mode 0x%x", sudo_mode);
+@@ -351,10 +352,14 @@ set_time_zone(void)
+     (void) tzset();
+ }
+ 
++/*
++ * Initialize garbage collection, load symbols for static sudoers,
++ * and make a shallow copy of envp[] for the plugins to use.
++ * Called via os_init().
++ */
+ int
+ os_init_common(int argc, char *argv[], char *envp[])
+ {
+-    extern char **environ;
+     int envc;
+ #ifdef STATIC_SUDOERS_PLUGIN
+     preload_static_symbols();
+@@ -362,22 +367,21 @@ os_init_common(int argc, char *argv[], char *envp[])
+     gc_init();
+ 
+     /*
+-     * Make a copy of environ[] that is distinct from 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.
+      */
+     for (envc = 0; envp[envc] != NULL; envc++)
+ 	continue;
+     if (envc != 0) {
+-	char **new_env = reallocarray(NULL, sizeof(char *), envc + 1);
+-	if (new_env == NULL || !gc_add(GC_PTR, new_env)) {
++	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++)
+-	    new_env[envc] = envp[envc];
+-	new_env[envc] = NULL;
+-	environ = new_env;
++	    submit_envp[envc] = envp[envc];
++	submit_envp[envc] = NULL;
+     }
+ 
+     return 0;
diff --git a/sudo-set_user_groups-fail.patch b/sudo-set_user_groups-fail.patch
new file mode 100644
index 0000000..dd2bbf8
--- /dev/null
+++ b/sudo-set_user_groups-fail.patch
@@ -0,0 +1,28 @@
+From 0d98cb88ae89b01955adef3908422ce3a48e1d62 Mon Sep 17 00:00:00 2001
+From: AZero13 <gfunni234 at gmail.com>
+Date: Thu, 18 Dec 2025 11:11:44 -0500
+Subject: [PATCH] ret needs to be false if set_user_groups fails
+
+---
+ src/sudo.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/sudo.c b/src/sudo.c
+index 82541f224c..0d1667d505 100644
+--- a/src/sudo.c
++++ b/src/sudo.c
+@@ -1411,9 +1411,11 @@ policy_init_session(struct command_details *details)
+      * groups to be set via pam_group(8) in pam_setcred(3).
+      */
+     if (ISSET(details->flags, CD_SET_GROUPS)) {
+-	/* set_user_groups() prints error message on failure. */
+-	if (!set_user_groups(details))
+-	    goto done;
++        /* set_user_groups() prints error message on failure. */
++        if (!set_user_groups(details)) {
++            ret = false;
++            goto done;
++        }
+     }
+ 
+     /* Session setup may override sudoers umask so set it first. */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/sudo.git/commitdiff/cd99f7688a977efc5847704169ab89d2be2b31f0



More information about the pld-cvs-commit mailing list