Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-24031 Overview
CVE-2025-24031 affects PAM-PKCS#11, a Linux Pluggable Authentication Module (PAM) that enables X.509 certificate-based user login. The pam_pkcs11 module segfaults when a user cancels a PIN prompt with ctrl-c or ctrl-d. When no PIN is entered, pam_get_pwd never initializes the password buffer pointer, and the subsequent cleanse call dereferences uninitialized memory. The flaw is tracked under [CWE-476] (NULL Pointer Dereference) and impacts versions 0.6.12 and prior. The most likely consequence is loss of availability for any daemon that invokes PAM authentication through the vulnerable module.
Critical Impact
Local users can crash PAM-dependent daemons such as sudo by cancelling the PIN prompt, resulting in availability loss. No patch is available as of publication.
Affected Products
- OpenSC PAM-PKCS#11 versions 0.6.12 and prior
- Linux systems using pam_pkcs11 for X.509 certificate-based authentication
- Daemons invoking PAM via the vulnerable module (for example, sudo, login, su)
Discovery Timeline
- 2025-02-10 - CVE-2025-24031 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-24031
Vulnerability Analysis
PAM-PKCS#11 presents a PIN prompt to the user during X.509 certificate-based authentication. The helper function pam_get_pwd reads the PIN into a buffer and returns the pointer to the caller. When the user cancels input with ctrl-c or ctrl-d, the function returns without allocating or initializing the password buffer pointer.
The caller then invokes a cleanse routine on the pointer to zero out sensitive memory. Because the pointer was never initialized, the dereference accesses an arbitrary address. On the reporter's system, the uninitialized value frequently equals 3, which triggers a segmentation fault inside the host process.
The downstream effect is a crash of any daemon that routes authentication through PAM when pam_pkcs11 is configured. Interactive utilities such as sudo terminate instead of returning an authentication failure, producing an availability impact for local users.
Root Cause
The root cause is an uninitialized pointer used in a cleanup path. pam_get_pwd does not set the output password pointer to NULL or allocate a buffer before early-return paths. The caller unconditionally treats the pointer as valid and passes it to a memory-cleansing function, producing a null or wild pointer dereference classified as [CWE-476]. Relevant source locations are referenced at pam_pkcs11.c line 211 and pam_pkcs11.c line 797.
Attack Vector
Exploitation requires local interactive access to a PIN prompt generated by pam_pkcs11. The attacker presses ctrl-c or ctrl-d when prompted, causing the calling process to crash. No authentication, elevated privileges, or special tooling are required. See the GitHub Security Advisory GHSA-wvr3-c9x3-9mff for additional context.
The vulnerability is a null or uninitialized pointer dereference triggered by user input cancellation during PAM PIN entry. No exploitation code is required; the reproducer is simply cancelling the PIN prompt during a sudo or login session on a system configured with pam_pkcs11.
Detection Methods for CVE-2025-24031
Indicators of Compromise
- Segmentation fault entries for sudo, login, su, or other PAM consumers in /var/log/syslog, /var/log/messages, or the systemd journal.
- Core dump files for PAM-consuming daemons referencing the pam_pkcs11.so module.
- Repeated authentication session terminations without a corresponding PAM_AUTH_ERR return code in audit logs.
Detection Strategies
- Query package inventory for pam_pkcs11 versions 0.6.12 and earlier across Linux hosts.
- Monitor auditd and systemd for SIGSEGV signals delivered to processes that have pam_pkcs11.so loaded.
- Correlate sudo crash events with PAM session start events to identify abuse of the PIN cancellation flow.
Monitoring Recommendations
- Forward kernel and auth logs to a centralized log platform and alert on segfaults in authentication binaries.
- Track frequency of PAM session failures per user to flag repeated cancellation attempts.
- Review systemd core-dump captures (coredumpctl list) for recurring pam_pkcs11 stack frames.
How to Mitigate CVE-2025-24031
Immediate Actions Required
- Inventory all Linux hosts for pam_pkcs11 version 0.6.12 or earlier.
- Where smart card authentication is not required, remove pam_pkcs11.so from PAM stacks in /etc/pam.d/.
- Restrict interactive local access to trusted users on systems that must retain the module.
Patch Information
As of publication, no upstream patch is available from the OpenSC project. Monitor the GitHub Security Advisory GHSA-wvr3-c9x3-9mff and the OpenSC pam_pkcs11 repository for a fixed release. Apply distribution updates as soon as maintainers publish backported fixes.
Workarounds
- Comment out or remove pam_pkcs11.so lines from affected PAM configuration files until a patch is released.
- Replace the module with an alternative smart card PAM stack such as pam_sss where feasible.
- Set the module control flag to optional where removal is not possible, reducing crash impact on authentication chains.
# Example: disable pam_pkcs11 in /etc/pam.d/sudo
# auth sufficient pam_pkcs11.so
auth required pam_unix.so
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

