Fix cryptographically insecure CSRF tokens

This commit is contained in:
Arinerron 2017-04-05 16:16:01 -07:00 committed by GitHub
commit 2f5c7a10b7

View file

@ -126,7 +126,7 @@ if (empty($_SESSION['language'])) {
} }
// Generate CSRF token // Generate CSRF token
$_SESSION['token'] = md5(uniqid(mt_rand(), true)); $_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(16)); // generate 32-character cryptographically secure token
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$_SESSION['language'].'.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$_SESSION['language'].'.php');
require_once('../templates/header.html'); require_once('../templates/header.html');