Browse Source

Merge pull request #2016 from hestiacp/fix/replace-uniqueid

Tighten security regarding token generation
Jaap Marcus 4 years ago
parent
commit
6444720561
1 changed files with 2 additions and 1 deletions
  1. 2 1
      web/login/index.php

+ 2 - 1
web/login/index.php

@@ -292,7 +292,8 @@ if (empty($_SESSION['language'])) {
 }
 
 // Generate CSRF token
-$_SESSION['token'] = md5(uniqid(mt_rand(), true));
+$token = bin2hex(file_get_contents('/dev/urandom', false, null, 0, 16));
+$_SESSION['token'] = $token;
 
 require_once('../templates/header.html');
 if (!empty($_SESSION['login']['password'])) {