Summary
In pam_usb, an IPv6 pattern-matching bug can cause the deny_remote feature to miss active remote tmux clients using compressed IPv6 addresses. When this happens, authentication may proceed even though the policy is intended to deny it.
Affected context
The issue affects pam_usb configurations that enable deny_remote and use its tmux remote-client check. The check relies on output from /usr/bin/w -i; compressed IPv6 addresses do not match the pattern used to identify remote clients, so the check can report that no remote clients are present.
Exploit preconditions
- Attack surface: PAM authentication flows protected by pam_usb with
deny_remoteenabled - Required access: The relevant user must have an active remote tmux client using an IPv6 address in compressed notation; access to the authentication flow is also required
- Trigger point: pam_usb checks for remote tmux clients during authentication
- Why exploitation is possible: The IPv6 detection pattern does not recognize compressed addresses, causing the check to miss the remote client
Why this happens
The remote-client check uses an overly restrictive regular expression that expects a specific expanded IPv6 format. Compressed IPv6 notation does not match it, so the check incorrectly treats a remote session as absent. This is an access-control enforcement weakness (CWE-285) and a failure of a security protection mechanism (CWE-693): the policy check does not reliably identify the condition it is meant to restrict.
Potential impact
- The
deny_remotepolicy may not block authentication when a remote tmux client is connected - Authentication controls that depend on this check could be bypassed under the stated conditions
- Administrators may have a false sense that remote-session restrictions are being enforced
General mitigation guidance
Defensive patterns include making security checks recognize all valid representations of the data they inspect, including compressed and expanded IPv6 forms. Prefer robust address parsing over narrow text matching, and fail closed when remote-session status cannot be determined reliably. Keep authentication policy checks independent of user-controlled formatting where possible, and limit the privileges available to PAM-integrated processes.
How teams detect issues like this
- Review code for security decisions based on regular expressions over command output, especially address parsing
- Test remote-client detection with loopback, link-local, and global IPv6 addresses in compressed and expanded forms
- Use static analysis or code review checks to flag brittle parsing in access-control paths
- Enforce policies requiring security checks to handle parse failures safely and consistently

