Skip to content

Commit cb7168f

Browse files
authored
Fix cryptographically insecure CSRF token bug
1 parent 2f5c7a1 commit cb7168f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

web/inc/main.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@
5959
exit;
6060
}
6161

62+
// Generate CSRF token
6263
if (isset($_SESSION['user'])) {
6364
if(!isset($_SESSION['token'])){
64-
$token = uniqid(mt_rand(), true);
65-
$_SESSION['token'] = $token;
65+
$_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(16));
6666
}
6767
}
6868

0 commit comments

Comments
 (0)