/

CVE-2026-44712

Severity:

HIGH RISK

(8.2)

OS Command Injection in pam_usb Hardware Authentication

CVE-2026-44712

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78, CWE-88

Impact:

Privilege Escalation to Root / Remote Code Execution

Severity:

HIGH RISK

(8.2)

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 hardware authentication tool using removable media, improperly passes attacker-controlled values (filesystem UUID and userName from XML) into shell commands.

An attacker who can provide a crafted USB device or manipulate pam_usb configuration can trigger root-level remote code execution when administrative utilities like pamusb-conf --reset-pads or pamusb-agent are run.

Affected context

This vulnerability affects systems using pam_usb for authentication or device management where:

  • Administrators run pamusb-conf to add devices or reset pads, and
  • USB devices with controllable or spoofed filesystem UUIDs are used, or
  • pam_usb XML configuration files can be influenced by untrusted parties.

The issue is most relevant when pam_usb utilities are executed with elevated privileges (e.g., via sudo), and when shell commands are constructed from configuration values without proper sanitization.

Exploit preconditions

  • Attack surface:
  • pamusb-conf --reset-pads and pamusb-conf --add-device handling crafted filesystem UUIDs
  • pamusb-agent consuming userName from XML configuration
  • Required access:
  • Ability to connect or provide a USB device whose filesystem UUID can be controlled or spoofed, and/or
  • Ability to modify pam_usb XML configuration files (direct write access, supply-chain compromise, or misconfigured permissions)
  • An administrator or user must run the affected pam_usb commands
  • Trigger point:
  • Execution of pamusb-conf --reset-pads after a malicious UUID has been registered
  • Execution of pamusb-conf --add-device with a USB device that exposes a malicious UUID
  • Execution of pamusb-agent when userName in the XML config contains injected shell metacharacters
  • Why exploitation is possible:
  • The code constructs shell commands using untrusted values (UUID, userName) and passes them to os.system() / implicit shell invocation.
  • Shell metacharacters and command substitutions in these fields are interpreted by the shell, allowing arbitrary command execution with the privileges of the running process (often root).

Why this happens

The underlying flaw is a classic OS Command Injection pattern, aligned with:

  • CWE-78: Improper Neutralization of Special Elements used in an OS Command
  • CWE-88: Improper Neutralization of Argument Delimiters in a Command

In pam_usb:

  • The filesystem UUID, which may be attacker-controlled on some USB controllers, is incorporated into commands invoked via os.system() without neutralizing shell metacharacters or using a safe, argument-based process execution API.
  • The userName field from the XML configuration is similarly passed to a shell command in pamusb-agent.

Because these APIs interpret the provided strings via a shell, any embedded command substitution, pipes, or redirections are executed. The bug stems from treating user-supplied configuration and device metadata as trusted input when constructing command lines, rather than isolating them as typed parameters.

Potential impact

  • Execution of arbitrary OS commands as root when pamusb-conf is run with elevated privileges
  • Full system compromise via privilege escalation from a less-privileged user to root
  • Planting backdoors, modifying authentication configuration, or disabling security controls
  • Data exfiltration or destruction by running arbitrary shell commands
  • Use of compromised systems as a pivot point for lateral movement within the network

General mitigation guidance

Risk reduction focuses on eliminating shell interpretation of untrusted values and constraining configuration trust:

  • Replace os.system() and similar shell-based APIs with process execution functions that accept argument lists (e.g., exec-style calls) and avoid implicit shell parsing.
  • Ensure that filesystem UUIDs and XML configuration fields are treated as data, not code, by:
  • Strictly validating values against whitelists (e.g., allowed character sets and formats for UUIDs and usernames).
  • Rejecting or sanitizing any input containing shell metacharacters, command substitution syntax, or unexpected delimiters.
  • Separate privilege domains:
  • Run pam_usb utilities and agents with the minimum privileges necessary.
  • Avoid running configuration helper tools as root unless strictly required, and restrict who can invoke them.
  • Harden configuration handling:
  • Protect XML configuration files with strict filesystem permissions.
  • Avoid generating or modifying pam_usb configs from untrusted sources or scripts without validation.
  • Operationally, favor design patterns where sensitive system-level commands are not constructed from user-controlled input, but instead are parameterized or use APIs that abstract away system calls.

How teams detect issues like this

Detection efforts can concentrate on identifying dangerous command construction patterns and suspicious usage:

  • Static analysis:
  • Rules that flag uses of os.system(), popen(), or similar APIs where arguments are derived from device metadata or configuration files without validation.
  • Pattern-matching for concatenation of shell strings with variables representing usernames, UUIDs, or other external identifiers.
  • Code review:
  • Manual inspection of any code paths that:
  • Build shell commands from configuration or device attributes.
  • Invoke shells to perform tasks that could be accomplished with direct system APIs.
  • Verification that all externally sourced parameters are validated and escaped before being passed to OS-level commands.
  • Runtime and policy-based controls:
  • Application-level logging of rare or unexpected command invocations from pam_usb utilities.
  • Mandatory security reviews or CI checks for changes touching authentication tooling and command execution logic.
  • Automated tools:
  • Use SAST tools configured with rules for OS command injection and argument delimiter misuse.
  • Integrate these tools into CI pipelines to block merges introducing new shell-based invocations with untrusted inputs.

Sources

SourceLink
github.comgithub.com/mcdope/pam_usb/security/advisories/GHSA-jgv5-w6rm-7wxg

Frequently asked

questions

It can be, depending on deployment. Direct exploitation requires the ability to supply a crafted USB device or manipulate pam_usb configuration. In environments where an attacker can influence these sources remotely (for example, by provisioning devices or altering configs through another vulnerability), the issue can effectively be exploited from a distance.

The attacker must either:

  • Provide or control a USB device with a manipulated filesystem UUID that is enrolled or used by pam_usb, and rely on an administrator running pamusb-conf; or
  • Modify pam_usb XML configuration to inject a malicious userName value, then have pamusb-agent executed.

In many real-world setups, successful exploitation leads to code execution with root privileges.

The robust fix is to eliminate shell interpretation of untrusted input entirely:

  • Replace os.system() with APIs that take argument arrays and do not invoke a shell.
  • Apply strict input validation (format and character whitelisting) for all device- and configuration-derived values, such as UUIDs and usernames.
  • Ensure no configuration field is directly interpolated into shell commands.

Prevention relies on secure coding practices and process controls:

  • Adopt a policy that forbids building shell command strings from untrusted data.
  • Use secure wrapper APIs for system operations rather than invoking shells directly.
  • Incorporate static analysis and security-focused code review into the development lifecycle, especially for authentication components.
  • Define and enforce clear trust boundaries for configuration and device metadata, treating them as untrusted unless proven otherwise.
Find out what's already
exploitable in your codebase.