CVE-2023-4977 (published 2023-09-15T01:15Z)

 Code Injection in GitHub repository librenms/librenms prior to 23.9.0.

CVSS v3 base score: 5.4, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-94
cwe_name: Improper Control of Generation of Code ('Code Injection')
description: The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
extended_description: 
            When a product allows a user's input to contain code syntax, it might be possible for an attacker to craft the code in such a way that it will alter the intended control flow of the product. Such an alteration could lead to arbitrary code execution.
            Injection problems encompass a wide variety of issues -- all mitigated in very different ways. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
         
         

Fix information:
repo_url: https://github.com/librenms/librenms
commit_details: repo_url: https://github.com/librenms/librenms
author: Tony Murray
author_date: 2023-09-13 23:35:49-05:00
msg: Fix injection in search pages ipv4, etc (#15311)

Reported by: https://huntr.dev/users/hainguyen0207
repository: repo_url: https://github.com/librenms/librenms
repo_name: librenms/librenms
description: Community-based GPL-licensed network monitoring system
repo_language: PHP
owner: librenms
file_changes: filename: search.inc.php
change_type: ModificationType.MODIFY
diff: @@ -46,5 +46,5 @@ print_optionbar_end();
 if (file_exists("includes/html/pages/search/$search_type.inc.php")) {
     include "includes/html/pages/search/$search_type.inc.php";
 } else {
-    echo report_this("Unknown search type $search_type");
+    echo report_this('Unknown search type ' . htmlspecialchars($search_type));
 }

programming_language: PHP
filename: ipv4.inc.php
change_type: ModificationType.MODIFY
diff: @@ -85,8 +85,8 @@ if ($_POST['interface'] == 'Vlan%') {
             id: "address-search",
             search_type: "ipv4",
             device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
-            interface: '<?php echo $_POST['interface']; ?>',
-            address: '<?php echo $_POST['address']; ?>'
+            interface: '<?php echo htmlspecialchars($_POST['interface']); ?>',
+            address: '<?php echo htmlspecialchars($_POST['address']); ?>'
         };
     },
     url: "ajax_table.php",

programming_language: PHP