CVE-2023-5793: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (CWE-79)
value: A vulnerability was found in flusity CMS and classified as problematic. This issue affects the function loadCustomBlocCreateForm of the file /core/tools/customblock.php of the component Dashboard. The manipulation of the argument customblock_place leads to cross site scripting. The attack may be initiated remotely. The exploit has been disclosed to the public and may be used. This product does not use versioning. This is why information about affected and unaffected releases are unavailable. The patch is named 81252bc764e1de2422e79e36194bba1289e7a0a5. It is recommended to apply a patch to fix this issue. The associated identifier of this vulnerability is VDB-243599.
CWE description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
CVSS v3 base score: 5.4
Published: 2023-10-26T18:15Z
Repository: https://github.com/flusity/flusity-CMS
Language: PHP
Files changed: core/tools/customblock.php
Commit date: 2023-10-24 11:49:38 +0300
Commit message: Update customblock.php

Cross-Site Scripting (XSS): 

Signed-off-by: Darius Jakaitis <105962203+flusity@users.noreply.github.com>
Diff: diff --git a/core/tools/customblock.php b/core/tools/customblock.php
index e87b053..33b1f65 100644
--- a/core/tools/customblock.php
+++ b/core/tools/customblock.php
@@ -188,16 +188,20 @@ function loadCustomBlockEditForm(customBlockId) {
     });
     });
 </script>
 <?php
 if (isset($_GET['edit_customblock_id'])) {
-    $edit_customblock_id = $_GET['edit_customblock_id'];
-    echo "<script>loadCustomBlockEditForm($edit_customblock_id);</script>";
+    $edit_customblock_id = filter_input(INPUT_GET, 'edit_customblock_id', FILTER_SANITIZE_NUMBER_INT);
+    $safe_edit_customblock_id = htmlspecialchars($edit_customblock_id, ENT_QUOTES, 'UTF-8');
+    echo "<script>loadCustomBlockEditForm($safe_edit_customblock_id);</script>";
 }
+
 if (isset($_GET['customblock_place'])) {
-    $customblock_place = $_GET['customblock_place'];
-    echo "<script>loadCustomBlocCreateForm('$customblock_place');</script>";
+    $customblock_place = filter_input(INPUT_GET, 'customblock_place', FILTER_SANITIZE_STRING);
+    $safe_customblock_place = htmlspecialchars($customblock_place, ENT_QUOTES, 'UTF-8');
+    echo "<script>loadCustomBlocCreateForm('$safe_customblock_place');</script>";
 }
+
 ?>
 <script src="js/admin-customblock-edit.js"></script>
 
-<?php require_once ROOT_PATH . 'core/template/admin-footer.php';?>
\ No newline at end of file
+<?php require_once ROOT_PATH . 'core/template/admin-footer.php';?>

Vulnerable code:     $edit_customblock_id = $_GET['edit_customblock_id'];
    echo "<script>loadCustomBlockEditForm($edit_customblock_id);</script>";
    $customblock_place = $_GET['customblock_place'];
    echo "<script>loadCustomBlocCreateForm('$customblock_place');</script>";
<?php require_once ROOT_PATH . 'core/template/admin-footer.php';?>
Fixed code:     $edit_customblock_id = filter_input(INPUT_GET, 'edit_customblock_id', FILTER_SANITIZE_NUMBER_INT);
    $safe_edit_customblock_id = htmlspecialchars($edit_customblock_id, ENT_QUOTES, 'UTF-8');
    echo "<script>loadCustomBlockEditForm($safe_edit_customblock_id);</script>";

    $customblock_place = filter_input(INPUT_GET, 'customblock_place', FILTER_SANITIZE_STRING);
    $safe_customblock_place = htmlspecialchars($customblock_place, ENT_QUOTES, 'UTF-8');
    echo "<script>loadCustomBlocCreateForm('$safe_customblock_place');</script>";

<?php require_once ROOT_PATH . 'core/template/admin-footer.php';?>