Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.7

Bug #3784 Substrings of user names match password record
Submitted: 2005-03-12 02:06 UTC
From: pear_php at ibink dot com Assigned: mike
Status: Closed Package: File_Passwd
PHP Version: 4.3.8 OS: All
Roadmaps: (Not assigned)    
Subscription  


 [2005-03-12 02:06 UTC] pear_php at ibink dot com
Description: ------------ strstr is used when looking for the password record of a particular user rather than a check that makes sure the user name is an exact match. As a result, you can be authenticated with a substring of your actual user name. In addition, if a users name is a substring of another user farther up in the password file, the will never be able to log in. Reproduce code: --------------- Case 1: 1) Add user 'billybob' to a password file 2) Authenticate 'billy' using the password for 'billybob' Case 2: 1) Add user 'billy' to the same password file use in case 1 but with a different password. 2) Try to log in as 'billy' The bug is in the _auth($file, $id) function inside /File/Passwd/Common.php.... while ($line = fgets($fh)) { ! if (strstr($line, $id)) { File_Passwd_Common::_close($fh); return trim($line); } } Should be: while ($line = fgets($fh)) { ! if (preg_match("/^$id:/", $line)) { File_Passwd_Common::_close($fh); return trim($line); } } Expected result: ---------------- Case 1: * You should not be able to log in as 'billy' Case 2: * You should be able to log in as 'billy' Actual result: -------------- use of strstr hides 'billy' record and allows for false logins.

Comments

 [2005-03-15 08:47 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!