public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH access-control] fix #8053: auth: accept "0" as password for pam and pve realms
Date: Fri, 25 Sep 2026 09:21:57 +0000	[thread overview]
Message-ID: <20260925092157.7-1-me@dualfroz.com> (raw)

Both plugins rejected the password with a plain boolean check, and in
Perl the string "0" is false. So a user whose password is "0" could
never log in, getting a generic authentication failure.

Only reject undefined or empty passwords.

Signed-off-by: Michal Fox <me@dualfroz.com>
---
 src/PVE/Auth/PAM.pm | 2 +-
 src/PVE/Auth/PVE.pm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Auth/PAM.pm b/src/PVE/Auth/PAM.pm
index 8586da5..11750c5 100755
--- a/src/PVE/Auth/PAM.pm
+++ b/src/PVE/Auth/PAM.pm
@@ -25,7 +25,7 @@ sub authenticate_user {
     my ($class, $config, $realm, $username, $password) = @_;
 
     # user (www-data) need to be able to read /etc/passwd /etc/shadow
-    die "no password\n" if !$password;
+    die "no password\n" if !defined($password) || $password eq '';
 
     # PAM modules may temporarily override $SIG{CHLD}, causing SIGCHLDs from
     # RESTEnvironment workers to be lost. Running the PAM interaction in a fork
diff --git a/src/PVE/Auth/PVE.pm b/src/PVE/Auth/PVE.pm
index ab439a8..ca0fae7 100755
--- a/src/PVE/Auth/PVE.pm
+++ b/src/PVE/Auth/PVE.pm
@@ -73,7 +73,7 @@ sub options {
 sub authenticate_user {
     my ($class, $config, $realm, $username, $password) = @_;
 
-    die "no password\n" if !$password;
+    die "no password\n" if !defined($password) || $password eq '';
 
     my $shadow_cfg = cfs_read_file($shadowconfigfile);
 
-- 
2.43.0




                 reply	other threads:[~2026-09-25  9:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925092157.7-1-me@dualfroz.com \
    --to=me@dualfroz.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal