Explorar o código

Fix for "Broken or Risky Cryptographic Algorithm"

Anton Reutov %!s(int64=4) %!d(string=hai) anos
pai
achega
2fc0dc34fe
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      web/inc/main.php

+ 3 - 2
web/inc/main.php

@@ -58,9 +58,10 @@ if ((!isset($_SESSION['user'])) && (!defined('NO_AUTH_REQUIRED'))) {
     exit;
 }
 
+// Generate CSRF Token
 if (isset($_SESSION['user'])) {
-    if(!isset($_SESSION['token'])){
-        $token = uniqid(mt_rand(), true);
+        if (!isset($_SESSION['token'])){
+        $token = bin2hex(file_get_contents('/dev/urandom', false, null, 0, 16));
         $_SESSION['token'] = $token;
     }
 }