Exploits / Vulnerability Discovered : 2020-02-03 |
Type : webapps |
Platform : php
This exploit / vulnerability Phplist 3.5.0 authentication bypass is for educational purposes only and if it is used you will do on your own risk!
GITHUB: https://github.com/phpList/phplist3/blob/master/public_html/lists/admin/phpListAdminAuthentication.php
-----
if(empty($login)||($password=="")){
return array(0, s('Please enter your credentials.'));
}
if ($admindata['disabled']) {
return array(0, s('your account has been disabled'));
}
if (//Password validation.
!empty($passwordDB) && $encryptedPass == $passwordDB // Vulnerable because loose comparison is used
)
return array($admindata['id'], 'OK');
else {
if (!empty($GLOBALS['admin_auth_module'])) {
Error(s('Admin authentication has changed, please update your admin module'),
'https://resources.phplist.com/documentation/errors/adminauthchange');
return;
}
return array(0, s('incorrect password'));
}
-------
Steps to reproduce:
1. Set the string 'TyNOQHUS' as password for username 'admin'. Its sha256 value is 0e66298694359207596086558843543959518835691168370379069085300385.
2. Now navigate to endpoint '/admin' and try to login with username 'admin' password 'TyNOQHUS'.
3. User Logged in with valid password.
4. Now logout from the application and try to login with username 'admin' password '34250003024812'.
5. User Logged in, without valid password.
6. Authentication bypassed because of PHP loose comparison.
FIX: This vulnerability can be fixed by using strict comparison (===) in place of loose comparison.
-----
if(empty($login)||($password=="")){
return array(0, s('Please enter your credentials.'));
}
if ($admindata['disabled']) {
return array(0, s('your account has been disabled'));
}
if (//Password validation.
!empty($passwordDB) && $encryptedPass === $passwordDB // Fixed by using strict comparison '==='.
)
return array($admindata['id'], 'OK');
else {
if (!empty($GLOBALS['admin_auth_module'])) {
Error(s('Admin authentication has changed, please update your admin module'),
'https://resources.phplist.com/documentation/errors/adminauthchange');
return;
}
return array(0, s('incorrect password'));