Skip to content

Commit 9d323dc

Browse files
authored
Tighten security regarding token generation
replace md5(uniqid(mt_rand(), true)); with $token = bin2hex(file_get_contents('/dev/urandom', false, null, 0, 16));
1 parent 15850cb commit 9d323dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

web/login/index.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ function authenticate_user($user, $password, $twofa = ''){
292292
}
293293

294294
// Generate CSRF token
295-
$_SESSION['token'] = md5(uniqid(mt_rand(), true));
295+
$token = bin2hex(file_get_contents('/dev/urandom', false, null, 0, 16));
296+
$_SESSION['token'] = $token;
296297

297298
require_once('../templates/header.html');
298299
if (!empty($_SESSION['login']['password'])) {

0 commit comments

Comments
 (0)