CVE-2023-46236 (published 2023-10-31T15:15Z)

FOG is a free open-source cloning/imaging/rescue suite/inventory management system. Prior to version 1.5.10, a server-side-request-forgery (SSRF) vulnerability allowed an unauthenticated user to trigger a GET request as the server to an arbitrary endpoint and URL scheme. This also allows remote access to files visible to the Apache user group. Other impacts vary based on server configuration. Version 1.5.10 contains a patch.

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

Weakness information:
cwe_id: CWE-918
cwe_name: Server-Side Request Forgery (SSRF)
description: The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
extended_description: By providing URLs to unexpected hosts or ports, attackers can make it appear that the server is sending the request, possibly bypassing access controls such as firewalls that prevent the attackers from accessing the URLs directly. The server can be used as a proxy to conduct port scanning of hosts in internal networks, use other URLs such as that can access documents on the system (using file://), or use other protocols such as gopher:// or tftp://, which may provide greater control over the contents of requests.
         

Fix information:
repo_url: https://github.com/FOGProject/fogproject
commit_details: repo_url: https://github.com/FOGProject/fogproject
author: Corban Amouzou
author_date: 2023-01-28 14:52:14-08:00
msg: [getversion/kernelvers] Prevent unauthenticated clients from making arbitrary requests, thanks @0x41c
repository: repo_url: https://github.com/FOGProject/fogproject
repo_name: FOGProject/fogproject
description: An open source computer cloning & management system
repo_language: PHP
owner: FOGProject
file_changes: filename: getversion.php
change_type: ModificationType.MODIFY
diff: @@ -28,20 +28,30 @@
  * @link     https://fogproject.org
  */
 require '../commons/base.inc.php';
-$clientUpdate = (bool)FOGCore::getSetting('FOG_CLIENT_AUTOUPDATE');
+$clientUpdate = (bool) FOGCore::getSetting('FOG_CLIENT_AUTOUPDATE');
 if (isset($_REQUEST['client'])) {
     $ver = (
-        $clientUpdate ?
+        $clientUpdate ? 
         '9.9.99' :
         '0.0.0'
     );
 } elseif (isset($_REQUEST['clientver'])) {
     $ver = (
-        $clientUpdate ?
+        $clientUpdate ? 
         FOG_CLIENT_VERSION :
         '0.0.0'
     );
 } elseif (isset($_REQUEST['url'])) {
+
+    // Prevent an unauthenticated user from making arbitrary requests.
+    $unauthorized = !$currentUser->isValid() || empty($_SERVER['HTTP_X_REQUESTED_WITH'])
+        || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest';
+
+    if ($unauthorized) {
+        echo _('Unauthorized');
+        exit;
+    }
+
     $url = $_REQUEST['url'];
     $res = $FOGURLRequests
         ->process($_REQUEST['url']);
@@ -50,4 +60,4 @@ if (isset($_REQUEST['client'])) {
     $ver = FOG_VERSION;
 }
 echo $ver;
-exit;
+exit;
\ No newline at end of file

programming_language: PHP
filename: kernelvers.php
change_type: ModificationType.MODIFY
diff: @@ -24,16 +24,28 @@ session_write_close();
 ignore_user_abort(true);
 set_time_limit(0);
 header('Content-Type: text/event-stream');
-$url = filter_input(INPUT_POST, 'url');
-if ($url) {
+
+if (isset($_POST['url'])) {
+
+    // Prevent an unauthenticated user from making arbitrary requests.
+    $unauthorized = !$currentUser->isValid() || empty($_SERVER['HTTP_X_REQUESTED_WITH'])
+        || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest';
+
+    if ($unauthorized) {
+        echo _('Unauthorized');
+        exit;
+    }
+
     $res = $FOGURLRequests
-        ->process($url);
-    foreach ((array)$res as &$response) {
+        ->process(filter_input(INPUT_POST, 'url'));
+    foreach ((array) $res as &$response) {
         echo $response;
         unset($response);
     }
+    
     exit;
 }
+
 $kernelvers = function ($kernel) {
     $currpath = sprintf(
         '%s%sservice%sipxe%s%s',
@@ -57,9 +69,9 @@ printf(
 );
 printf(
     "bzImage Version: %s\n",
-    $kernelvers('bzImage')
+        $kernelvers('bzImage')
 );
 printf(
     "bzImage32 Version: %s",
-    $kernelvers('bzImage32')
-);
+        $kernelvers('bzImage32')
+);
\ No newline at end of file

programming_language: PHP