From 90256816a846ddd8f01b393d65d5de497b913942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= Date: Tue, 14 Apr 2026 10:09:04 +0200 Subject: [PATCH 1/9] Fix CVE-2026-35535 - Resolves: rhbz#2458153 --- 0001-cve-2026-35535.patch | 142 ++++++++++++++++++++++++++++++++++++++ sudo.spec | 6 +- 2 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 0001-cve-2026-35535.patch diff --git a/0001-cve-2026-35535.patch b/0001-cve-2026-35535.patch new file mode 100644 index 0000000..0f3f39a --- /dev/null +++ b/0001-cve-2026-35535.patch @@ -0,0 +1,142 @@ +From 3e474c2f201484be83d994ae10a4e20e8c81bb69 Mon Sep 17 00:00:00 2001 +From: "Todd C. Miller" +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 + +Backported by Alejandro Lopez +--- + +diff --git a/include/sudo_eventlog.h b/include/sudo_eventlog.h +index eb9f4f4a8..485d2593e 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 f4a9f330d..2db2f251c 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 bbc3daaac..3d37b632c 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 ec092d14e..1626a28cb 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 af3210dda..706c492b7 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) */ +-- +2.53.0 + diff --git a/sudo.spec b/sudo.spec index be44d00..f7a3164 100644 --- a/sudo.spec +++ b/sudo.spec @@ -4,9 +4,9 @@ Summary: Allows restricted root access for specified users Name: sudo Version: 1.9.17 -# remove -b 3 after rebase !!! +# Remove "-b 3" after rebase !!! # use "-p -e % {?extraver}" when beta -# use "-e % {?extraver}"" when patch version +# use "-e % {?extraver}" when patch version # use nothing special when normal version Release: %autorelease -e %{?extraver} License: ISC @@ -30,6 +30,8 @@ BuildRequires: systemd-rpm-macros BuildRequires: gettext BuildRequires: zlib-devel +Patch1: 0001-cve-2026-35535.patch + %description Sudo (superuser do) allows a system administrator to give certain users (or groups of users) the ability to run some (or all) commands From 9cd9faa3f98fcfb363ff68fbd8ce6ff438e20e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavol=20=C5=BD=C3=A1=C4=8Dik?= Date: Mon, 11 May 2026 15:26:15 +0200 Subject: [PATCH 2/9] Add OpenSSL 4.0 compatibility patch --- 0002-Fix-OpenSSL-4.0-compatibility.patch | 45 ++++++++++++++++++++++++ sudo.spec | 1 + 2 files changed, 46 insertions(+) create mode 100644 0002-Fix-OpenSSL-4.0-compatibility.patch diff --git a/0002-Fix-OpenSSL-4.0-compatibility.patch b/0002-Fix-OpenSSL-4.0-compatibility.patch new file mode 100644 index 0000000..d076d1d --- /dev/null +++ b/0002-Fix-OpenSSL-4.0-compatibility.patch @@ -0,0 +1,45 @@ +From ec5ede886a5f8ca36474fd2990adc2d3e2c1a056 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pavol=20=C5=BD=C3=A1=C4=8Dik?= +Date: Mon, 11 May 2026 15:17:33 +0200 +Subject: [PATCH] Fix OpenSSL 4.0 compatibility + +Use ASN1_STRING accessor functions and adjust constness. +--- + lib/iolog/hostcheck.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lib/iolog/hostcheck.c b/lib/iolog/hostcheck.c +index efb016c..cba3a0f 100644 +--- a/lib/iolog/hostcheck.c ++++ b/lib/iolog/hostcheck.c +@@ -188,8 +188,8 @@ validate_name(const char *hostname, ASN1_STRING *certname_asn1) + static HostnameValidationResult + matches_common_name(const char *hostname, const char *ipaddr, const X509 *cert, int resolve) + { +- X509_NAME_ENTRY *common_name_entry = NULL; +- ASN1_STRING *common_name_asn1 = NULL; ++ const X509_NAME_ENTRY *common_name_entry = NULL; ++ const ASN1_STRING *common_name_asn1 = NULL; + int common_name_loc; + debug_decl(matches_common_name, SUDO_DEBUG_UTIL); + +@@ -323,14 +323,14 @@ matches_subject_alternative_name(const char *hostname, const char *ipaddr, const + #endif + + /* IPV4 address */ +- if(current_name->d.iPAddress->length == 4) { ++ if(ASN1_STRING_length(current_name->d.iPAddress) == 4) { + if (inet_ntop(AF_INET, san_ip, san_ip_str, INET_ADDRSTRLEN) == NULL) { + result = MalformedCertificate; + break; + } + #if defined(HAVE_STRUCT_IN6_ADDR) + /* IPV6 address */ +- } else if (current_name->d.iPAddress->length == 16) { ++ } else if (ASN1_STRING_length(current_name->d.iPAddress) == 16) { + if (inet_ntop(AF_INET6, san_ip, san_ip_str, INET6_ADDRSTRLEN) == NULL) { + result = MalformedCertificate; + break; +-- +2.53.0 + diff --git a/sudo.spec b/sudo.spec index f7a3164..8900242 100644 --- a/sudo.spec +++ b/sudo.spec @@ -31,6 +31,7 @@ BuildRequires: gettext BuildRequires: zlib-devel Patch1: 0001-cve-2026-35535.patch +Patch2: 0002-Fix-OpenSSL-4.0-compatibility.patch %description Sudo (superuser do) allows a system administrator to give certain From e2cab26d879ed542cb09f2d5587a80bcebba0f9b Mon Sep 17 00:00:00 2001 From: Python Maint Date: Wed, 3 Jun 2026 17:49:58 +0200 Subject: [PATCH 3/9] Rebuilt for Python 3.15 From a0305f8c5ee8e6b35b9d4829a50525cb5f1a29f7 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 12 Jun 2026 19:51:23 -0400 Subject: [PATCH 4/9] Rebuilt for openssl 4.0 From eee5e533168c1d5f62fc8ce8f19fd1f4d4022407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= Date: Fri, 5 Jun 2026 15:34:39 +0200 Subject: [PATCH 5/9] - Resolves: rhbz#2379016 - don't recommend sudo-python-plugins --- sudo.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/sudo.spec b/sudo.spec index 8900242..64488ea 100644 --- a/sudo.spec +++ b/sudo.spec @@ -15,7 +15,6 @@ Source0: %{url}/dist/%{name}-%{version}%{?extraver}.tar.gz Source1: sudoers Requires: pam Recommends: system-default-editor -Recommends: %{name}-python-plugin%{?_isa} = %{version}-%{release} BuildRequires: make BuildRequires: pam-devel From 0d1368ebc7cbcd63c2be54c9a5b0e13d0e7d3b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= Date: Fri, 5 Jun 2026 15:42:02 +0200 Subject: [PATCH 6/9] Removed some unneeded build-time dependencies --- sudo.spec | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sudo.spec b/sudo.spec index 64488ea..146f10a 100644 --- a/sudo.spec +++ b/sudo.spec @@ -18,15 +18,11 @@ Recommends: system-default-editor BuildRequires: make BuildRequires: pam-devel -BuildRequires: groff BuildRequires: openldap-devel -BuildRequires: flex -BuildRequires: bison BuildRequires: libtool BuildRequires: audit-libs-devel libcap-devel BuildRequires: libselinux-devel BuildRequires: systemd-rpm-macros -BuildRequires: gettext BuildRequires: zlib-devel Patch1: 0001-cve-2026-35535.patch From 181500c8c557e43f3ece2cfff8011f9b28950fd7 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 17 Jun 2026 09:26:53 -0400 Subject: [PATCH 7/9] Rebuilt for openssl 4.0 From 94bd1bdd144b5992a652baa4ca253ebf0761ebd8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jul 2026 07:07:38 +0000 Subject: [PATCH 8/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild From 73b278971be774e690770ba07c639dd440061f9a Mon Sep 17 00:00:00 2001 From: Python Maint Date: Wed, 22 Jul 2026 10:20:34 +0200 Subject: [PATCH 9/9] Rebuilt for Python 3.15.0b4 ABI change