diff --git a/web/app/controllers/tinyfilemanager/tinyfilemanager.php b/web/app/controllers/tinyfilemanager/tinyfilemanager.php index f12507f..672f3cd 100644 --- a/web/app/controllers/tinyfilemanager/tinyfilemanager.php +++ b/web/app/controllers/tinyfilemanager/tinyfilemanager.php @@ -98,11 +98,6 @@ if (defined('FM_EMBED')) { restore_error_handler(); } -//Genrating CSRF Token -if (empty($_SESSION['token'])) { - $_SESSION['token'] = bin2hex(random_bytes(32)); -} - if (empty($auth_users)) { $use_auth = false; } @@ -124,7 +119,6 @@ defined('FM_SELF_URL') || define('FM_SELF_URL', HTML::url('?')); // logout if (isset($_GET['logout'])) { unset($_SESSION[FM_SESSION_ID]['logged']); - unset( $_SESSION['token']); fm_redirect(FM_SELF_URL); } @@ -175,11 +169,11 @@ if ($ip_ruleset != 'OFF') { if ($use_auth) { if (isset($_SESSION[FM_SESSION_ID]['logged'], $auth_users[$_SESSION[FM_SESSION_ID]['logged']])) { // Logged - } elseif (isset($_POST['fm_usr'], $_POST['fm_pwd'], $_POST['token'])) { + } elseif (isset($_POST['fm_usr'], $_POST['fm_pwd'], $_POST['_token'])) { // Logging In sleep(1); if(function_exists('password_verify')) { - if (isset($auth_users[$_POST['fm_usr']]) && isset($_POST['fm_pwd']) && password_verify($_POST['fm_pwd'], $auth_users[$_POST['fm_usr']]) && verifyToken($_POST['token'])) { + if (isset($auth_users[$_POST['fm_usr']]) && isset($_POST['fm_pwd']) && password_verify($_POST['fm_pwd'], $auth_users[$_POST['fm_usr']]) && crsf_check()) { $_SESSION[FM_SESSION_ID]['logged'] = $_POST['fm_usr']; fm_set_msg(lng('You are logged in')); fm_redirect(FM_ROOT_URL); @@ -230,7 +224,7 @@ if ($use_auth) {
- +
@@ -1284,7 +1259,7 @@ if (isset($_POST['copy']) && !FM_READONLY) {

  - +

@@ -1581,7 +1556,7 @@ if (isset($_GET['view'])) {

- +  
@@ -1591,12 +1566,12 @@ if (isset($_GET['view'])) { $zip_name = pathinfo($file_path, PATHINFO_FILENAME); ?>
- +
 
- + @@ -1832,7 +1807,7 @@ if (isset($_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) {

- +  

@@ -1860,7 +1835,7 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white - +
@@ -2069,19 +2044,6 @@ fm_show_footer(); // Functions -/** - * Verify CSRF TOKEN and remove after cerify - * @param string $token - * @return bool - */ -function verifyToken($token) -{ - if (hash_equals($_SESSION['token'], $token)) { - return true; - } - return false; -} - /** * Delete file or folder (recursively) * @param string $path @@ -3507,7 +3469,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal'; - +