Public mode

No access to your tenant or devices. Every item links to its source. What this means

Some sources, documents or advisories need attention: 270/272 feeds/APIs · 469/469 docs · 8/9 advisories · checked 11:30 UTC Customize Public modeDiscuss ChangeIntel on Discord

`PamHandle::get_user` can cause an authentication bypass

Exact source revision recorded 26 Oct 2026 14:35:44 UTC. It does not establish the source's current position. Latest evidence.

osv · RUSTSEC-2025-0173

Published

In affected versions, `PamHandle::get_user` can return `Err(PAM_SUCCESS)` after it gets the username successfully. PAM modules that return this "error" code from `sm_authenticate` or `sm_acct_mgmt` early-return a success code to PAM without doing any further verification. This means a user could log in when they shouldn't be able to (e.g., if the module is `sufficient`). The `pam_try!` macro of this crate early-returns the code in this exact way: ```rust fn sm_authenticate(pamh: &mut PamHandle, args: Vec<&CStr>, flags: PamFlag) -> PamResultCode { let user = pam_try!(pamh.get_user(None)); // Can return PAM_SUCCESS here. // If it does, the module does not get to this line. } ``` The root cause is an [incorrect FFI declaration][ffi-decl] for [`pam_get_user(3)`][pam-get-user]. This C function writes a pointer to the username through its `user` argument (of type `const char **user`). This crate's binding declared this argument as a shared reference (`&*mut c_char`). Writing through a shared reference is [undefined behavior][ub-immutable]. Thus, the compiler can assume that the local pointer, whose address is passed as `user`, is still null after the call. After the call, the affected code [returns `Ok`][null-check] only if the return code is `PAM_SUCCESS` *and* this pointer is not null. Otherwise, it returns the return code as an error. If the compiler assumes that the pointer is null, `get_user` returns an error even when the return code is `PAM_SUCCESS`. Release builds have been [observed to do this][observed-irl]. Debug builds usually work correctly, so tests in debug mode can miss the problem. Version 0.1.2 changes the declaration to `&mut *const c_char`. The fix is in commit [401c961](https://github.com/lvkv/pam-rs/commit/401c961800c4dde356464b6a7d455af844a3954a). If a module cannot upgrade, do not return the error code from `get_user`. Return a failure code instead, for example `pam_try!(pamh.get_user(None), PamResultCode::PAM_AUTH_ERR)`. This makes the module deny access instead of allowing it, but the undefined behavior remains. [pam-get-user]: https://github.com/linux-pam/linux-pam/blob/28fce1fd55b003fec90f34e5bc785e9439b216f2/libpam/include/security/pam_modules.h#L30-L31 [ffi-decl]: https://github.com/lvkv/pam-rs/blob/3d9318b5b812d9142595928deec23e5843a60995/pam/src/module.rs#L49-L53 [ub-immutable]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html#r-undefined.immutable [null-check]: https://github.com/lvkv/pam-rs/blob/3d9318b5b812d9142595928deec23e5843a60995/pam/src/module.rs#L196-L202 [observed-irl]: https://github.com/lvkv/pam-rs/issues/16#issuecomment-3693665220

Source published
2 Jun 2025 12:00:00 UTC
Source modified
26 Oct 2026 14:00:04 UTC
Observed here
26 Oct 2026 14:35:44 UTC
Source terms
OSV · upstream source license applies

Original source record · Cite this exact observation · Complete original publisher JSON

This view projects the publisher's source fields for reading; the original JSON retains additional fields and CVE enrichment containers. Attribution: osv · OSV · upstream source license applies. Source text is retained; field grouping and change labels are provided by ChangeIntel.

ChangeIntel

An IT change radar: releases, security, known issues, retirements, documentation changes, and service status from public sources. Every item links to supporting evidence; dates and statuses can change after they are read.

Sources read 28 Oct 11:30 UTC · 270 of 272 readable · 268 fully read · documentation 469/469 current