Rapid7 Vulnerability & Exploit Database

Nagios XI Prior to 5.6.6 getprofile.sh Authenticated Remote Command Execution

Back to Search

Nagios XI Prior to 5.6.6 getprofile.sh Authenticated Remote Command Execution

Disclosed
07/29/2019
Created
04/14/2021

Description

This module exploits a vulnerability in the getprofile.sh script of Nagios XI prior to 5.6.6 in order to upload a malicious check_ping plugin and thereby execute arbitrary commands. For Nagios XI 5.2.0-5.4.13, the commands are run as the nagios user. For versions 5.5.0-5.6.5 the commands are run as root. Note that versions prior to 5.2.0 will still be marked as being vulnerable however this module does not presently support exploiting these targets. The module uploads a malicious check_ping plugin to the Nagios XI server via /admin/monitoringplugins.php and then executes this plugin by issuing a HTTP GET request to download a system profile from the server. For all supported targets except Linux (cmd), the module uses a command stager to write the exploit to the target via the malicious plugin. This may not work if Nagios XI is running in a restricted Unix environment, so in that case the target must be set to Linux (cmd). The module then writes the payload to the malicious plugin while avoiding commands that may not be supported. Valid credentials for a user with administrative privileges are required. This module was successfully tested on Nagios XI 5.3.0 and Nagios 5.6.5, both running on CentOS 7. For vulnerable versions before 5.5.0, it may take a significant amount of time for the payload to get back (up to 5 minutes). If exploitation fails against an older system, it is recommended to increase the WfsDelay setting (default is 300 seconds). See the documentation for more information.

Author(s)

  • Jak Gibb
  • Erik Wynter

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/linux/http/nagios_xi_plugins_check_plugin_authenticated_rce
msf exploit(nagios_xi_plugins_check_plugin_authenticated_rce) > show targets
    ...targets...
msf exploit(nagios_xi_plugins_check_plugin_authenticated_rce) > set TARGET < target-id >
msf exploit(nagios_xi_plugins_check_plugin_authenticated_rce) > show options
    ...show and set options...
msf exploit(nagios_xi_plugins_check_plugin_authenticated_rce) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;