/

CVE-2026-47272

Severity:

HIGH RISK

(7.1)

Improper Authentication in pam_usb Hardware Token

CVE-2026-47272

Deferred

Vulnerability type

Category:

Improper Authentication

CWE:

CWE-287, CWE-908

Impact:

Bypass of Multi-Factor / Hardware-Based Authentication

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

pam_usb, a Linux PAM module for USB-based hardware authentication, contained flawed pad verification logic that allowed logins to succeed without validating the USB device.

If a local user deletes or makes their local pad file unreadable, certain code paths treat this as a non-fatal error, effectively disabling the USB requirement and permitting authentication without the physical device.

Affected context

This vulnerability appears in Linux systems using pam_usb to enforce USB-based authentication as an additional factor or primary login mechanism.

It is relevant when:

  • pam_usb is configured in PAM stacks (e.g., for login, sudo, or graphical sessions),
  • User-specific pad files are stored under ~/.pamusb/ (e.g., ~/.pamusb/device.pad),
  • The authentication policy relies on successful comparison between a user-side pad and a system-side pad on the USB device.

In such deployments, local users who can modify their own home directory files can influence how the USB check behaves at authentication time.

Exploit preconditions

  • Attack surface: Local authentication paths that rely on pam_usb (e.g., TTY, SSH with PAM, display manager, sudo).
  • Required access: An existing local account on the target system and the ability to modify or delete files in that account's home directory (especially ~/.pamusb/device.pad).
  • Trigger point: Invoking any PAM-controlled action that uses pam_usb for authentication after the user-side pad has been deleted or made unreadable.
  • Why exploitation is possible: The pusb_pad_compare() function only checks read access to the user-side pad and does not enforce presence/readability of the USB-resident pad in all flows. In some code paths, a failure to read the user pad is treated as non-fatal, allowing the authentication process to proceed as if the USB requirement were satisfied.

Why this happens

The underlying issue is an improper authentication design and error handling flaw.

The pusb_pad_compare() function is expected to compare a user-side pad (~/.pamusb/device.pad) with a pad stored on the USB device to verify that the correct hardware token is present. However, the implementation:

  • Only enforces readability of the user-side pad file, and
  • Allows certain failures (such as the user pad being missing or unreadable) to be interpreted as non-fatal by higher-level logic.

This maps to CWE-287: Improper Authentication, because a critical authentication factor (the USB device) is not reliably validated, and users can authenticate without satisfying the intended hardware check. It also relates to CWE-908: Use of Uninitialized Resource, in the sense that the system assumes authentication state without a properly verified pad resource.

Potential impact

  • Local users may bypass the configured USB hardware token requirement by deleting or corrupting ~/.pamusb/device.pad.
  • Accounts that were intended to require a physical USB device can be accessed with password-only authentication, reducing effective security.
  • Multi-factor or step-up authentication schemes relying on pam_usb may be downgraded silently to single-factor authentication.
  • Security policies that assume possession-based verification could be undermined, increasing risk of account compromise if credentials are guessed, phished, or reused.

General mitigation guidance

Effective mitigation focuses on hardening the authentication design and treating hardware-token verification failures as strictly fatal:

  • Ensure authentication modules always treat missing or unreadable pad files—whether user-side or device-side—as hard failures, not soft errors.
  • Design authentication flows so that all configured factors (e.g., password + USB token) must succeed; avoid "best-effort" fallbacks unless explicitly and securely justified.
  • Centralize pad verification logic and explicitly validate both the user-side pad and the USB-resident pad before granting access.
  • Limit opportunities for users to weaken their authentication configuration, for example by:
  • Avoiding reliance on modifiable user-home files as the sole source of critical verification material, or
  • Storing critical verification data in locations with stricter permissions or administrative control.
  • Apply least privilege principles in PAM configurations: ensure that disabling one factor (such as pam_usb) cannot silently fall back to weaker checks without administrative intent.

How teams detect issues like this

Detection efforts can focus on both configuration analysis and code-level review:

  • Code review signals:
  • Authentication functions that treat file-read failures, missing pads, or other verification errors as non-fatal.
  • Conditional logic where unsuccessful verification paths still yield a "success" or neutral result that higher layers may misinterpret.
  • Dependence on user-controlled files ($HOME-relative pads) as authoritative authentication factors without integrity checks.
  • Static analysis patterns:
  • Rules targeting authentication/authorization code where error return values from verification helpers are ignored, masked, or converted into permissive states.
  • Identification of calls to pad-compare or token-check functions whose results are not strictly enforced or are combined with permissive fallback logic.
  • Configuration and runtime monitoring:
  • PAM configuration reviews to confirm pam_usb is not configured in a way that allows optional or "sufficient" behavior where it should be "required."
  • Audit logs or authentication logs that show successful logins via pam_usb when the USB device is not present, which can indicate bypass conditions.
  • Automated tooling (such as SAST or configuration linters) can be tuned to flag authentication modules that rely on user-modifiable files without robust failure handling.

Sources

SourceLink
github.comgithub.com/mcdope/pam_usb/security/advisories/GHSA-vx6f-rrqr-j87c

Frequently asked

questions

Typically, exploitation requires a valid local account and the ability to modify that account's home directory. However, if remote access (e.g., SSH) is protected by PAM and pam_usb is intended to enforce USB-based authentication, a remote attacker who has already obtained the user's password and can manipulate their home directory (via another compromise) could leverage this to bypass the USB requirement.

The attacker must have local-user-level access to the target account, or equivalent ability to alter that account's ~/.pamusb/device.pad file. They do not need administrative privileges to trigger the bypass once they can control or delete the pad file and supply any other required authentication factors (such as the password).

The strongest fix is to enforce strict, fail-closed verification of all authentication factors: ensure that both the user-side pad and the USB device pad must be present, readable, and successfully compared for authentication to succeed. Any failure to access or validate these resources should cause an immediate authentication failure, rather than a fallback to weaker checks.

Future designs should explicitly model authentication factors and ensure that each factor's failure is treated as a hard stop unless there is a carefully considered and auditable fallback policy. Developers should avoid relying solely on user-modifiable artifacts as authoritative evidence of possession, implement robust error handling that fails closed, and subject authentication logic to focused security review and automated checks that flag permissive handling of verification failures.

Find out what's already
exploitable in your codebase.