[packages/pam] Up to 1.7.3
arekm
arekm at pld-linux.org
Thu Oct 29 08:53:59 CET 2026
commit 908a33aa259d5a73da1be474c795196d70548c2c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Oct 29 00:10:31 2026 +0100
Up to 1.7.3
Fixes CVE-2026-54411.
pam.spec | 9 +--
pam_userdb-consttime-compare.patch | 157 -------------------------------------
2 files changed, 3 insertions(+), 163 deletions(-)
---
diff --git a/pam.spec b/pam.spec
index d8d3539..50dd8e8 100644
--- a/pam.spec
+++ b/pam.spec
@@ -21,8 +21,8 @@ Summary(ru.UTF-8): Интструмент, обеспечивающий ауте
Summary(tr.UTF-8): Modüler, artımsal doğrulama birimleri
Summary(uk.UTF-8): Інструмент, що забезпечує аутентифікацію для програм
Name: pam
-Version: 1.7.2
-Release: 2
+Version: 1.7.3
+Release: 1
Epoch: 1
# The library is BSD licensed with option to relicense as GPLv2+
# - this option is redundant as the BSD license allows that anyway.
@@ -30,7 +30,7 @@ Epoch: 1
License: BSD and GPL v2+
Group: Base
Source0: https://github.com/linux-pam/linux-pam/releases/download/v%{version}/Linux-PAM-%{version}.tar.xz
-# Source0-md5: 934c26eca3fada956356a30489e86291
+# Source0-md5: 0880bc3b28cfd8e415ee3d5a7378ebe0
Source2: ftp://ftp.pld-linux.org/software/pam/%{name}-pld-%{pam_pld_version}.tar.gz
# Source2-md5: f9ec6fcafcf1801bf318e60040244f2e
Source3: other.pamd
@@ -48,8 +48,6 @@ Patch5: %{name}-exec-failok.patch
Patch6: pam_console_pam_tty.patch
Patch9: pam_pwgen-const-argv.patch
Patch10: pam_pwgen-pam_i18n.patch
-# CVE-2026-54411, fixed upstream after 1.7.2
-Patch11: pam_userdb-consttime-compare.patch
URL: http://www.linux-pam.org/
%{?with_audit:BuildRequires: audit-libs-devel >= 1.6.9}
BuildRequires: bison
@@ -249,7 +247,6 @@ danych GDBM.
%patch -P6 -p1
%patch -P9 -p1
%patch -P10 -p1
-%patch -P11 -p1
%build
# -Dvendordir= : 1.7.2 turned vendordir on by default, which would move the
diff --git a/pam_userdb-consttime-compare.patch b/pam_userdb-consttime-compare.patch
deleted file mode 100644
index 5be97d9..0000000
--- a/pam_userdb-consttime-compare.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-From 30708d973b63891bf700299ce3ae0f1086398284 Mon Sep 17 00:00:00 2001
-From: vlefebvre <valentin.lefebvre at suse.com>
-Date: Tue, 16 Jun 2026 16:31:29 +0200
-Subject: [PATCH] pam_userdb: fix password comparison timing leak
-
-* libpam/include/pam_inline.h: Include <ctype.h>.
-(pam_consttime_strcaseeq): New function that implements a constant-time,
-case-insensitive string equality check.
-* modules/pam_userdb/pam_userdb.c (user_lookup): Use it along with
-pam_consttime_streq instead of strncmp and strncasecmp to fix
-timing side-channel that leaks password prefix bytes and length
-(CWE-208).
-
-Resolves: https://github.com/linux-pam/linux-pam/issues/992
-Co-authored-by: Dmitry V. Levin <ldv at strace.io>
----
- libpam/include/pam_inline.h | 20 +++++++++
- modules/pam_userdb/pam_userdb.c | 75 +++++++++++++++++++--------------
- 2 files changed, 64 insertions(+), 31 deletions(-)
-
-diff --git a/libpam/include/pam_inline.h b/libpam/include/pam_inline.h
-index d79d6fdf2..86d131cf4 100644
---- a/libpam/include/pam_inline.h
-+++ b/libpam/include/pam_inline.h
-@@ -9,6 +9,7 @@
- #define PAM_INLINE_H
-
- #include "pam_cc_compat.h"
-+#include <ctype.h>
- #include <stdarg.h>
- #include <stdio.h>
- #include <stdlib.h>
-@@ -244,4 +245,23 @@ pam_consttime_streq(const char *userinput, const char *secret) {
- return ret == 0;
- }
-
-+/*
-+ * Constant-time, case-insensitive string equality check.
-+ * Same contract as pam_consttime_streq but uses tolower() on each byte.
-+ * Runs for exactly strlen(userinput)+1 iterations regardless of secret.
-+ */
-+static inline int
-+pam_consttime_strcaseeq(const char *userinput, const char *secret) {
-+ volatile const char *u = userinput, *s = secret;
-+ volatile int ret = 0;
-+
-+ do {
-+ ret |= tolower((unsigned char)*u) ^ tolower((unsigned char)*s);
-+
-+ s += !!*s;
-+ } while (*u++ != '\0');
-+
-+ return ret == 0;
-+}
-+
- #endif /* PAM_INLINE_H */
-diff --git a/modules/pam_userdb/pam_userdb.c b/modules/pam_userdb/pam_userdb.c
-index bdb8553cc..b37f096cd 100644
---- a/modules/pam_userdb/pam_userdb.c
-+++ b/modules/pam_userdb/pam_userdb.c
-@@ -321,15 +321,24 @@ user_lookup (pam_handle_t *pamh, const char *database, const char *cryptmode,
- } else {
-
- /* Unknown password encryption method -
-- * default to plaintext password storage
-+ * default to plaintext password storage.
-+ * Use constant-time comparison: strncmp/strncasecmp leak prefix bytes
-+ * and the length pre-check leaks the password length (CWE-208).
- */
-
-- if (strlen(pass) != (size_t)data.dsize) {
-- compare = 1; /* wrong password len -> wrong password */
-- } else if (ctrl & PAM_ICASE_ARG) {
-- compare = strncasecmp(data.dptr, pass, data.dsize);
-+ /* libdb is not guaranteed to produce null-terminated strings */
-+ char *stored = strndup(data.dptr, data.dsize);
-+ if (stored == NULL) {
-+ pam_syslog(pamh, LOG_CRIT, "strndup failed: data.dptr");
-+ compare = -2;
- } else {
-- compare = strncmp(data.dptr, pass, data.dsize);
-+ if (ctrl & PAM_ICASE_ARG) {
-+ compare = pam_consttime_strcaseeq(pass, stored) ? 0 : 1;
-+ } else {
-+ compare = pam_consttime_streq(pass, stored) ? 0 : 1;
-+ }
-+ pam_overwrite_string(stored);
-+ free(stored);
- }
-
- if (cryptmode && pam_str_skip_icase_prefix(cryptmode, "none") == NULL
-@@ -361,36 +370,40 @@ user_lookup (pam_handle_t *pamh, const char *database, const char *cryptmode,
- }
-
- /* now handle the key_only case */
-+ size_t ulen = strlen(user);
- for (key = db_firstkey(dbm);
- key.dptr != NULL;
- key = db_nextkey(dbm, key)) {
-- int compare;
-- /* first compare the user portion (case sensitive) */
-- compare = strncmp(key.dptr, user, strlen(user));
-- if (compare == 0) {
-- /* assume failure */
-- compare = -1;
-- /* if we have the divider where we expect it to be... */
-- if (key.dptr[strlen(user)] == '-') {
-- saw_user = 1;
-- if ((size_t)key.dsize == strlen(user) + 1 + strlen(pass)) {
-- if (ctrl & PAM_ICASE_ARG) {
-- /* compare the password portion (case insensitive)*/
-- compare = strncasecmp(key.dptr + strlen(user) + 1,
-- pass,
-- strlen(pass));
-- } else {
-- /* compare the password portion (case sensitive) */
-- compare = strncmp(key.dptr + strlen(user) + 1,
-- pass,
-- strlen(pass));
-- }
-- }
-- }
-- if (compare == 0) {
-+ /* assume failure */
-+ int compare = -1;
-+
-+ /*
-+ * First compare the user portion (case sensitive);
-+ * user is caller-supplied, so this memcmp leaks nothing secret.
-+ */
-+ if ((size_t)key.dsize > ulen &&
-+ key.dptr[ulen] == '-' &&
-+ memcmp(key.dptr, user, ulen) == 0) {
-+ saw_user = 1;
-+ char *stored_pass = strndup(key.dptr + ulen + 1,
-+ key.dsize - ulen - 1);
-+ if (stored_pass == NULL) {
- db_close(dbm);
-- return 0; /* match */
-+ return -2;
- }
-+ /* compare the password portion (case (in)sensitive) */
-+ if (ctrl & PAM_ICASE_ARG) {
-+ compare = pam_consttime_strcaseeq(pass, stored_pass) ? 0 : 1;
-+ } else {
-+ compare = pam_consttime_streq(pass, stored_pass) ? 0 : 1;
-+ }
-+ pam_overwrite_string(stored_pass);
-+ free(stored_pass);
-+ }
-+
-+ if (compare == 0) {
-+ db_close(dbm);
-+ return 0; /* match */
- }
- }
- db_close(dbm);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/pam.git/commitdiff/908a33aa259d5a73da1be474c795196d70548c2c
More information about the pld-cvs-commit
mailing list