From c2fb21c5703ed5cb042d7bd677379258816cddc4 Mon Sep 17 00:00:00 2001 From: Josh North Date: Tue, 1 Jun 2021 10:52:51 -0400 Subject: [PATCH] Vulnerability mitigation - revert secure cookies by default --- changelang.php | 6 +- changesite.php | 6 +- css/tempusdominus-bootstrap-4.min.css | 2 +- inc/header.inc.php | 4 +- index.php | 10 +-- js/tempusdominus-bootstrap-4.min.js | 2 +- login.php | 4 +- logout.php | 2 +- profile.php | 2 +- reports.php | 14 +-- signin.php | 4 +- signin_1.php | 4 +- signin_2.php | 4 +- signin_3.php | 4 +- signin_4.php | 4 +- signin_display.php | 4 +- signout.php | 4 +- src/Misc/Csrf.php | 6 +- users.php | 119 ++++++++++++++------------ 19 files changed, 106 insertions(+), 99 deletions(-) diff --git a/changelang.php b/changelang.php index 8aa906c..7a84404 100755 --- a/changelang.php +++ b/changelang.php @@ -19,8 +19,8 @@ $app_disp_lang = filter_input(INPUT_POST, 'app_disp_lang', FILTER_SANITIZE_STRING); // GET SANITARY LANG CHOICE setcookie ( 'app_disp_lang', $app_disp_lang, [ 'expires' => time() + 60*60*24*90, - 'secure' => true, - 'httponly' => true, - 'samesite' => 'Strict', + 'secure' => false, + 'httponly' => false, + 'samesite' => 'Lax', ]); header('Location: index.php'); // GO HOME UNTIL WE ADD REFERER LOGIC diff --git a/changesite.php b/changesite.php index f1d622e..dbad809 100755 --- a/changesite.php +++ b/changesite.php @@ -19,8 +19,8 @@ $site = filter_input(INPUT_POST, 'site', FILTER_SANITIZE_STRING); // GET SANITARY SITE CHOICE setcookie ( 'app_site', $site, [ 'expires' => time() + 60*60*24*90, - 'secure' => true, - 'httponly' => true, - 'samesite' => 'Strict', + 'secure' => false, + 'httponly' => false, + 'samesite' => 'Lax', ]); header('Location: index.php'); // GO HOME UNTIL WE ADD REFERER LOGIC diff --git a/css/tempusdominus-bootstrap-4.min.css b/css/tempusdominus-bootstrap-4.min.css index af0c6e2..ab0ef20 100755 --- a/css/tempusdominus-bootstrap-4.min.css +++ b/css/tempusdominus-bootstrap-4.min.css @@ -202,5 +202,5 @@ height: 27px; line-height: 27px; } -.input-group [data-toggle="datetimepicker"] { +.input-group [data-bs-toggle="datetimepicker"] { cursor: pointer; } diff --git a/inc/header.inc.php b/inc/header.inc.php index 44183e1..a251211 100644 --- a/inc/header.inc.php +++ b/inc/header.inc.php @@ -82,7 +82,7 @@ $timenow = $timeplus->format('Y-m-d H:i:s'); header("X-Frame-Options: SAMEORIGIN"); header("X-Content-Type-Options: nosniff"); - header("Content-Security-Policy: script-src 'self'; script-src-elem 'self'; script-src-attr 'self'; style-src 'self'; style-src-elem 'self'; style-src-attr 'self'; img-src 'self'; connect-src 'self'; frame-src 'self'; font-src 'self'; media-src 'self'; object-src 'self'; manifest-src 'self'; worker-src 'self'; prefetch-src 'self'; form-action 'self'; frame-ancestors 'self'; default-src 'self'", false); + //header("Content-Security-Policy: script-src 'self' 'unsafe-inline'; script-src-elem 'self'; script-src-attr 'self'; style-src 'self'; style-src-elem 'self'; style-src-attr 'self'; img-src 'self'; connect-src 'self'; frame-src 'self'; font-src 'self'; media-src 'self'; object-src 'self'; manifest-src 'self'; worker-src 'self'; prefetch-src 'self'; form-action 'self'; frame-ancestors 'self'; default-src 'self'", false); if (!empty($_GET['a'])) { echo '
' . print_r($_POST, true) . '
'; echo 'Verification has been : ' . (Csrf::verifyToken('home') ? 'successful' : 'unsuccessful'); @@ -159,7 +159,7 @@