Skip to content

Commit 6444720

Browse files
authored
Merge pull request hestiacp#2016 from hestiacp/fix/replace-uniqueid
Tighten security regarding token generation
2 parents 15850cb + 9d323dc commit 6444720

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)