Nagios XI < 5.6.6 RCE - Nessus

High   Plugin ID: 154935

This page contains detailed information about the Nagios XI < 5.6.6 RCE Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 154935
Name: Nagios XI < 5.6.6 RCE
Filename: nagiosxi_5_6_6.nasl
Vulnerability Published: 2019-09-05
This Plugin Published: 2021-11-05
Last Modification Time: 2022-01-20
Plugin Version: 1.5
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: nagios_enterprise_detect.nasl
Required KB Items [?]: installed_sw/nagios_xi

Vulnerability Information


Severity: High
Vulnerability Published: 2019-09-05
Patch Published: 2019-08-20
CVE [?]: CVE-2019-15949
CPE [?]: cpe:/a:nagios:nagios_xi

Synopsis

The remote host has a web application affected by a remote code execution vulnerability.

Description

Nagios XI before 5.6.6 allows remote command execution as root. The exploit requires access to the server as the nagios user, or access as the admin user via the web interface. The getprofile.sh script, invoked by downloading a system profile (profile.php?cmd=download), is executed as root via a passwordless sudo entry; the script executes check_plugin, which is owned by the nagios user. A user logged into Nagios XI with permissions to modify plugins, or the nagios user on the server, can modify the check_plugin executable and insert malicious commands to execute as root.

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version number.

Solution

Upgrade to Nagios XI 5.6.6 or later.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the Nagios XI < 5.6.6 RCE vulnerability:

  1. Metasploit: exploit/linux/http/nagios_xi_plugins_check_plugin_authenticated_rce
    [Nagios XI Prior to 5.6.6 getprofile.sh Authenticated Remote Command Execution]
  2. Metasploit: auxiliary/scanner/http/nagios_xi_scanner
    [Nagios XI Scanner]
  3. Exploit-DB: exploits/linux/remote/48191.rb
    [EDB-48191: Nagios XI - Authenticated Remote Command Execution (Metasploit)]
  4. GitHub: https://github.com/AfvanMoopen/tryhackme-
    [CVE-2019-15949]
  5. GitHub: https://github.com/catsecorg/CatSec-TryHackMe-WriteUps
    [CVE-2019-15949]
  6. GitHub: https://github.com/jakgibb/nagiosxi-root-rce-exploit
    [CVE-2019-15949]

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 Score Source [?]: CVE-2019-15949
CVSS V2 Vector: AV:N/AC:L/Au:S/C:C/I:C/A:C/E:H/RL:OF/RC:C
CVSS Base Score:9.0 (High)
Impact Subscore:10.0
Exploitability Subscore:8.0
CVSS Temporal Score:7.8 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.8 (High)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:H/RL:O/RC:C
CVSS Base Score:8.8 (High)
Impact Subscore:5.9
Exploitability Subscore:2.8
CVSS Temporal Score:8.4 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.4 (High)

Go back to menu.

Plugin Source


This is the nagiosxi_5_6_6.nasl nessus plugin source code. This script is Copyright (C) 2021-2022 Tenable Network Security, Inc.

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

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

if (description)
{
  script_id(154935);
  script_version("1.5");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/01/20");

  script_cve_id("CVE-2019-15949");
  script_xref(name:"CISA-KNOWN-EXPLOITED", value:"2022/05/03");

  script_name(english:"Nagios XI < 5.6.6 RCE");

  script_set_attribute(attribute:"synopsis", value:
"The remote host has a web application affected by a remote code execution vulnerability.");
  script_set_attribute(attribute:"description", value:
"Nagios XI before 5.6.6 allows remote command execution as root. The exploit requires access to the server as the nagios
user, or access as the admin user via the web interface. The getprofile.sh script, invoked by downloading a system 
profile (profile.php?cmd=download), is executed as root via a passwordless sudo entry; the script executes 
check_plugin, which is owned by the nagios user. A user logged into Nagios XI with permissions to modify plugins, or 
the nagios user on the server, can modify the check_plugin executable and insert malicious commands to execute as root.

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version
number.");
  script_set_attribute(attribute:"see_also", value:"https://www.nagios.com/downloads/nagios-xi/change-log/");
  script_set_attribute(attribute:"see_also", value:"https://www.nagios.com/products/security/");
  script_set_attribute(attribute:"solution", value:
"Upgrade to Nagios XI 5.6.6 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:H/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:H/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2019-15949");

  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:'Nagios XI Prior to 5.6.6 getprofile.sh Authenticated Remote Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2019/09/05");
  script_set_attribute(attribute:"patch_publication_date", value:"2019/08/20");
  script_set_attribute(attribute:"plugin_publication_date", value:"2021/11/05");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:nagios:nagios_xi");
  script_end_attributes();

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

  script_copyright(english:"This script is Copyright (C) 2021-2022 Tenable Network Security, Inc.");

  script_dependencies("nagios_enterprise_detect.nasl");
  script_require_keys("installed_sw/nagios_xi");
  script_require_ports("Services/www", 80);

  exit(0);
}

include('http_func.inc');
include('vcf_extras.inc');

var app = 'nagios_xi';

# Get the ports that web servers have been found on.
var port = get_http_port(default:80, embedded:TRUE);

var app_info = vcf::nagiosxi::get_app_info(port:port);

var constraints = [
    {'fixed_version': '5.6.6'}
];

vcf::nagiosxi::check_version_and_report(app_info:app_info, constraints:constraints, severity:SECURITY_HOLE, default_fix:'5.6.6');

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

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

Go back to menu.

How to Run


Here is how to run the Nagios XI < 5.6.6 RCE 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 Nagios XI < 5.6.6 RCE plugin ID 154935.
  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 nagiosxi_5_6_6.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


See also: Similar and related Nessus plugins:
  • 157377 - Nagios XI 5.7.5 Command Injection
  • 150056 - Nagios XI < 5.7 Code Injection
  • 153612 - Nagios XI < 5.8.5 Multiple Vulnerabilities
  • 63563 - Nagios Core history.cgi Multiple Parameter Buffer Overflow
  • 66361 - Nagios NRPE nrpe.c Arbitrary Command Execution
  • 73757 - Nagios NRPE Command Argument Processing Enabled
  • 49773 - Default Password (nagiosxi) for 'root' Account

Version


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

Go back to menu.