Use hash_equals when comparing to pwhash from cookie

This should prevent a timing attack against this parameter to
disclose the stored passsword hash.

Signed-off-by: Aidan Woods <aidantwoods@gmail.com>
This commit is contained in:
Aidan Woods
2020-12-06 12:44:14 +00:00
parent 98059251a1
commit 85c7a3b437

View File

@@ -42,7 +42,7 @@
// Check for and authorize from persistent cookie
if (isset($_COOKIE["persistentlogin"]))
{
if ($pwhash === $_COOKIE["persistentlogin"])
if (hash_equals($pwhash, $_COOKIE["persistentlogin"]))
{
$auth = true;
// Refresh cookie with new expiry