🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #6742

Bug#1155790: pam_u2f second factor broken in polkit dialogs: sandboxed polkit-agent-helper@.service blocks /dev/hidraw* and u2f_...

#6742
From: Heinz Pechtl
Date: Sun, 29 Nov 2026 16:20
128 lines
8604 bytes
Package: libpam-u2f
Version: 1.4.0-3+b2
Severity: important

Subject: pam_u2f second factor broken in polkit dialogs: sandboxed polkit-agent-helper@.service blocks /dev/hidraw* and u2f_keys

Description:
   Since polkit 127, polkit-agent-helper-1 is socket-activated and
   runs in a strict systemd sandbox (unit
   polkit-agent-helper@.service, shipped by polkitd 127+). The PAM
   stack of the polkit authentication dialog (e.g. /etc/pam.d/polkit-1,
   which includes common-auth) is executed inside this helper process.

   With pam_u2f enabled (pam-auth-update;
   'auth [success=1 default=ignore] pam_u2f.so' in
   /etc/pam.d/common-auth), U2F/YubiKey second-factor authentication
   fails in all polkit dialogs (pkexec, KDE System Settings, ...),
   while the exact same authentication works in sudo, getty/login and
   GDM, which do not run in this sandbox.

   Root cause: the shipped unit enables
       PrivateDevices=yes
       DevicePolicy=closed
       ProtectHome=yes
   which prevents pam_u2f from
       1) opening the YubiKey (a USB HID device, /dev/hidraw*), and
       2) reading the key mapping file ~/.config/Yubico/u2f_keys.

   The polkit-agent-helper(8) man page (SANDBOXING section) states
   that PAM module vendors should ship a systemd drop-in that relaxes
   only the specific directives their module requires. Arch and NixOS
   ship exactly such a drop-in for pam_u2f (see References); the
   Debian package libpam-u2f does not, so U2F authentication is
   broken out of the box with polkit >= 127.

Steps to reproduce:
   1. Install libpam-u2f and enroll a key:
        pam-auth-update  (enable libpam-u2f)
        u2f-prepare      (creates ~/.config/Yubico/u2f_keys)
      A YubiKey 4/5 (U2F) must be plugged in (/dev/hidraw*).
   2. Log into a graphical session that uses a polkit agent
      (Polkit-KDE agent / Plasma on this system).
   3. Trigger a polkit authorization, e.g.:
        run0
   4. When the authentication dialog appears, touch the YubiKey.

Expected result:
   The dialog authenticates via the U2F touch (as it does with sudo).

Actual result:
   The U2F touch is not accepted; authentication fails or silently
   falls back to the password module.

Workaround (confirmed in the upstream threads, referenced below):
   sudo systemctl edit polkit-agent-helper@.service  and add:

     [Service]
     ProtectHome=read-only
     PrivateDevices=no
     DeviceAllow=/dev/urandom r
     DeviceAllow=char-hidraw rw

   then: sudo systemctl daemon-reload
   (Trade-off: the root-running helper gets full /dev and read-only
   access to /home again; polkit maintainers call this the correct
   way to solve the issue.)

Suggested fix:
   Ship a vendor drop-in with the libpam-u2f package, e.g.
   /usr/lib/systemd/system/polkit-agent-helper@.service.d/pam-u2f.conf:

     [Service]
     ProtectHome=read-only
     PrivateDevices=no
     DeviceAllow=/dev/urandom r
     DeviceAllow=char-hidraw rw

   (This is what Arch ships for pam_u2f; see References. If pam_u2f
   can be made to work with the device sandbox kept active, a
   narrower override with only
   'DeviceAllow=char-hidraw rw', 'DeviceAllow=/dev/urandom r' and
   'ProtectHome=read-only' would be preferable.)

Journal excerpt (reproduced before applying the workaround):
Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@0-4122-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
Nov 29 10:05:17 earth polkit-agent-helper-1[8247]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
Nov 29 10:05:17 earth polkit-agent-helper-1[8247]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@1-36881-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
Nov 29 10:05:17 earth systemd[1]: polkit-agent-helper@0-4122-1601_41079-1000.service: Deactivated successfully.
Nov 29 10:05:17 earth systemd[1]: Finished polkit-agent-helper@0-4122-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).
Nov 29 10:05:17 earth polkit-agent-helper-1[8268]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
Nov 29 10:05:17 earth polkit-agent-helper-1[8268]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
Nov 29 10:05:17 earth systemd[1]: Starting polkit-agent-helper@2-24609-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000)...
Nov 29 10:05:18 earth polkit-agent-helper-1[8273]: PAM (polkit-1) /usr/lib/pam.d is not supported on this system; see /usr/share/doc/libpam0g/Debian-PAM-MiniPolicy.gz
Nov 29 10:05:18 earth polkit-agent-helper-1[8273]: polkit-agent-helper-1: pam_authenticate failed: Authentication failure
Nov 29 10:05:18 earth systemd[1]: polkit-agent-helper@1-36881-1601_41079-1000.service: Deactivated successfully.
Nov 29 10:05:18 earth systemd[1]: Finished polkit-agent-helper@1-36881-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).
Nov 29 10:05:18 earth systemd[1]: polkit-agent-helper@2-24609-1601_41079-1000.service: Deactivated successfully.
Nov 29 10:05:18 earth systemd[1]: Finished polkit-agent-helper@2-24609-1601_41079-1000.service - Authorization Manager Agent Helper (PID 1601/UID 1000).

System information:
   Kernel:          7.3.6+deb14-amd64 (Debian 7.3.6-1, 2026-11-24), x86_64
   Distribution:    Debian GNU/Linux forky/sid (Debian 14)
   systemd:         262.2-1
   glibc:           2.43 (2.43-7)
   polkitd:         128-1
   libpam-u2f:      1.4.0-3+b2
   polkit-kde-agent-1: 4:6.7.4-1
   libpam-runtime:  1.7.0-8
   YubiKey:         Bus 001 Device 005: ID 1050:0407
                    Yubico.com Yubikey 4/5 OTP+U2F+CCID
                    (present as /dev/hidraw0..6)
   PAM config:      /etc/pam.d/common-auth, Primary block:
                    auth [success=1 default=ignore] pam_u2f.so
   No local drop-in for polkit-agent-helper@.service is present;
   the as-shipped unit contains (among others):
     PrivateDevices=yes, DevicePolicy=closed, ProtectHome=yes,
     ProtectSystem=strict, PrivateNetwork=yes, NoNewPrivileges=yes

References:
   - https://github.com/polkit-org/polkit/issues/622
     (polkit 127 sandbox breaks pam_u2f; polkit maintainer: the
     drop-in above is "the correct way to solve these issues")
   - https://github.com/Yubico/pam-u2f/issues/389
     (same breakage reported; Arch's shipped fix discussed)
   - Arch fix commit:
     https://gitlab.archlinux.org/archlinux/packaging/packages/pam-u2f/-/commit/888507cc6e4307e8acdfccec8718b7be559b08e9
   - man 8 polkit-agent-helper, section "SANDBOXING"
Technical Details
Message-ID: <O4PN8-eUUr-25@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Heinz Pechtl <heinz.pechtl@asamnet.de>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1155790: pam_u2f second factor broken in polkit dialogs: sandboxed polkit-agent-helper@.service blocks /dev/hidraw* and u2f_keys
Date: Sun, 29 Nov 2026 17:20:02 +0100
Message-ID: <O4PN8-eUUr-25@gated-at.bofh.it>
X-Original-To: submit@bugs.debian.org
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sun Nov 29 16:15:10 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.451
Reply-To: Heinz Pechtl <heinz.pechtl@asamnet.de>, 1155790@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: team+pkg-security@tracker.debian.org
X-Debian-Pr-Message: report 1155790
X-Debian-Pr-Package: libpam-u2f
X-Debian-Pr-Source: pam-u2f
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: de-DE
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Last-Tls-Session-Version: TLSv1.3
X-Greylist: delayed 339 seconds by postgrey-1.37 at buxtehude; Sun, 29 Nov 2026 16:13:59 UTC
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2005891
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 128
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sun, 29 Nov 2026 17:08:14 +0100
X-Original-Message-ID: <bf69027b-317d-4f4b-8ebf-7d4cc9c52b51@asamnet.de>