-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NetBSD Security Advisory 2009-004 ================================= Topic: NetBSD OpenPAM passwd(1) changing weakness Version: NetBSD-current: affected before June 14, 2009 NetBSD 5.0: affected NetBSD 4.0.1: affected NetBSD 4.0: affected Severity: Change root password as normal user Fixed: NetBSD-current: June 14, 2009 NetBSD-5-0 branch: June 18, 2009 (5.0.1 will include the fix) NetBSD-5 branch: June 18, 2009 (5.1 will include the fix) NetBSD-4-0 branch: June 18, 2009 (4.0.2 will include the fix) NetBSD-4 branch: June 18, 2009 (4.1 will include the fix) Please note that NetBSD releases prior to 4.0 are no longer supported. It is recommended that all users upgrade to a supported release. Abstract ======== A verification weakness in the pam_unix module allows an authenticated attacker with knowledge of the current root password to reset it. Technical Details ================= The pam_unix authentication module provided by NetBSD does not verify the user invoking a password change properly. This allows an authenticated, unprivileged user to change the root password, given the old root password. Authentication as root is typically limited to members of a special group called "wheel" in order to limit the impact of a leaked root password. For this reason, the ability of changing the root password is traditionally limited to users who have already authenticated as root. Please note that this only affects systems using normal UNIX password authentication. Solutions and Workarounds ========================= In order to verify if you are affected by the problem, look for a line in /etc/pam.d/system stating password required pam_unix.so no_warn try_first_pass If such a line exists, invoke the command passwd root as a regular user. If the command issues the error "Unable to change auth token: permission denied", the system is not affected. A temporary workaround is to add the line password prerequisite pam_group.so no_warn group=wheel fail_safe before the pam_unix line to /etc/pam.d/system. This allows only members of the wheel group to change passwords until the issue can be addressed. Note however that this can increase the time user accounts are compromised in case of a security incident. For all NetBSD versions, you need to obtain the fixed NetBSD sources and rebuild and install the new PAM libraries. The fixed source may be obtained from the NetBSD CVS repository. The following instructions briefly summarize how to upgrade your PAM libraries by updating your source tree and rebuilding and installing a new version of them. * NetBSD-current: Systems running NetBSD-current dated from before 2009-06-15 should be upgraded to NetBSD-current dated 2009-06-16 or later. The following directories need to be updated from the netbsd-current CVS branch (aka HEAD): lib/libpam/modules/pam_unix To update from CVS, re-build, and re-install pam_unix: # cd src # cvs update -d -P lib/libpam/modules/pam_unix # cd lib/libpam/modules/pam_unix # make USETOOLS=no cleandir dependall # make USETOOLS=no install * NetBSD 5.*: Systems running NetBSD 5.* sources dated from before 2009-06-17 should be upgraded from NetBSD 5.* sources dated 2009-06-18 or later. The following directories need to be updated from the netbsd-5 or netbsd-5-0 CVS branch: lib/libpam/modules/pam_unix To update from CVS, re-build, and re-install pam_unix: # cd src # cvs update -d -P -r lib/libpam/modules/pam_unix # cd lib/libpam/modules/pam_unix # make USETOOLS=no cleandir dependall # make USETOOLS=no install * NetBSD 4.*: Systems running NetBSD 4.* sources dated from before 2009-05-17 should be upgraded from NetBSD 4.* sources dated 2009-05-18 or later. The following directories need to be updated from the netbsd-4 or netbsd-4-0 CVS branch: lib/libpam/modules/pam_unix To update from CVS, re-build, and re-install pam_unix: # cd src # cvs update -d -P -r lib/libpam/modules/pam_unix # cd lib/libpam/modules/pam_unix # make USETOOLS=no cleandir dependall # make USETOOLS=no install Thanks To ========= Thomas Getzke for discovering the vulnerability, Hubert Feyrer for reporting the vulnerability and testing the patches, and Tonnerre Lombard for providing the fix. Revision History ================ 2009-06-22 Initial release 2009-06-25 Corrected the month of the 5.0 update instructions More Information ================ Advisories may be updated as new information becomes available. The most recent version of this advisory (PGP signed) can be found at ftp://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2009-004.txt.asc Information about NetBSD and NetBSD security can be found at http://www.NetBSD.org/ and http://www.NetBSD.org/Security/. Copyright 2009, The NetBSD Foundation, Inc. All Rights Reserved. Redistribution permitted only in full, unmodified form. $NetBSD: NetBSD-SA2009-004.txt,v 1.2 2009/06/25 00:26:15 tonnerre Exp $ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (NetBSD) iQCVAwUBSkLD4z5Ru2/4N2IFAQIYvQQAtUo/EGkcYIg4lFzP3YcexHnUnX0aTTiv gLIQO1/D0JcEHAW4cZ7rakIPrdYwh5nzbrFSQ4G9/8Sztumvx7NQucVcN5ImDkH1 Agh3mLu7GRsfdHx+3UtcA8xbzOrCHfP7Ue8i/CkdngSiGRpPS5lvuU2Cw5KdlkAx cibvSb6LOAQ= =xz0K -----END PGP SIGNATURE-----