1
0

Replace token generation with hash and uniqid with secure random numbers from random_bytes

This commit is contained in:
Hanno Böck
2021-02-01 10:57:42 +01:00
committed by onli
parent 80be37ca8d
commit 931e621549
4 changed files with 5 additions and 5 deletions

View File

@ -842,7 +842,7 @@ function serendipity_insertComment($id, $commentInfo, $type = 'NORMAL', $source
$subscribe = 'false';
}
$dbhash = md5(uniqid(rand(), true));
$dbhash = bin2hex(random_bytes(16));
if ($status == 'confirm') {
$dbstatus = 'confirm' . $dbhash;
@ -1230,7 +1230,7 @@ function serendipity_generateCToken($cid) {
global $serendipity;
$ctoken = md5(uniqid(rand(),1));
$ctoken = bin2hex(random_bytes(16));
//Delete any comment tokens older than 1 week.
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options