Skip to content

Commit f6bf6dc

Browse files
authored
[5.3] Use time safe compare method in phpass library (#45477)
1 parent 045b2bc commit f6bf6dc

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

administrator/manifests/libraries/phpass.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<authorEmail>[email protected]</authorEmail>
99
<authorUrl>https://www.openwall.com/phpass/</authorUrl>
1010
<license>PD / GWC</license>
11-
<version>0.3</version>
11+
<version>0.5.1</version>
1212
<packagerurl>https://www.openwall.com/phpass/</packagerurl>
1313

1414
<files folder="phpass">

libraries/phpass/PasswordHash.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Portable PHP password hashing framework.
44
#
5-
# Version 0.5 / genuine.
5+
# Version 0.5.1 / Joomla Project.
66
#
77
# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
88
# the public domain. Revised in subsequent years, still public domain.
@@ -216,11 +216,7 @@ function CheckPassword($password, $stored_hash)
216216
if ($hash[0] === '*')
217217
$hash = crypt($password, $stored_hash);
218218

219-
# This is not constant-time. In order to keep the code simple,
220-
# for timing safety we currently rely on the salts being
221-
# unpredictable, which they are at least in the non-fallback
222-
# cases (that is, when we use /dev/urandom and bcrypt).
223-
return $hash === $stored_hash;
219+
return hash_equals($hash, $stored_hash);
224220
}
225221
}
226222

0 commit comments

Comments
 (0)