Windows Gather Enum User MUICache - Metasploit
This page contains detailed information about how to use the post/windows/gather/enum_muicache metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Windows Gather Enum User MUICache
Module: post/windows/gather/enum_muicache
Source code: modules/post/windows/gather/enum_muicache.rb
Disclosure date: -
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -
This module gathers information about the files and file paths that logged on users have executed on the system. It also will check if the file still exists on the system. This information is gathered by using information stored under the MUICache registry key. If the user is logged in when the module is executed it will collect the MUICache entries by accessing the registry directly. If the user is not logged in the module will download users registry hive NTUSER.DAT/UsrClass.dat from the system and the MUICache contents are parsed from the downloaded hive.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
There are two ways to execute this post module.
From the Meterpreter prompt
The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:
meterpreter > run post/windows/gather/enum_muicache
From the msf prompt
The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.
msf > use post/windows/gather/enum_muicache
msf post(enum_muicache) > show options
... show and set options ...
msf post(enum_muicache) > set SESSION session-id
msf post(enum_muicache) > exploit
If you wish to run the post against all sessions from framework, here is how:
1 - Create the following resource script:
framework.sessions.each_pair do |sid, session|
run_single("use post/windows/gather/enum_muicache")
run_single("set SESSION #{sid}")
run_single("run")
end
2 - At the msf prompt, execute the above resource script:
msf > resource path-to-resource-script
Required Options
- SESSION: The session to run this module on.
Go back to menu.
Msfconsole Usage
Here is how the windows/gather/enum_muicache post exploitation module looks in the msfconsole:
msf6 > use post/windows/gather/enum_muicache
msf6 post(windows/gather/enum_muicache) > show info
Name: Windows Gather Enum User MUICache
Module: post/windows/gather/enum_muicache
Platform: Windows
Arch:
Rank: Normal
Provided by:
TJ Glad <[email protected]>
Compatible session types:
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Description:
This module gathers information about the files and file paths that
logged on users have executed on the system. It also will check if
the file still exists on the system. This information is gathered by
using information stored under the MUICache registry key. If the
user is logged in when the module is executed it will collect the
MUICache entries by accessing the registry directly. If the user is
not logged in the module will download users registry hive
NTUSER.DAT/UsrClass.dat from the system and the MUICache contents
are parsed from the downloaded hive.
Module Options
This is a complete list of options available in the windows/gather/enum_muicache post exploitation module:
msf6 post(windows/gather/enum_muicache) > show options
Module options (post/windows/gather/enum_muicache):
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Advanced Options
Here is a complete list of advanced options supported by the windows/gather/enum_muicache post exploitation module:
msf6 post(windows/gather/enum_muicache) > show advanced
Module advanced options (post/windows/gather/enum_muicache):
Name Current Setting Required Description
---- --------------- -------- -----------
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Post Actions
This is a list of all post exploitation actions which the windows/gather/enum_muicache module can do:
msf6 post(windows/gather/enum_muicache) > show actions
Post actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the windows/gather/enum_muicache post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(windows/gather/enum_muicache) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Error Messages
This module may fail with the following error messages:
- Unable to access ProfileList registry key. Unable to continue.
- Unable to read ProfileImagePath from the registry. Unable to continue.
- User <USER>: Can't access registry. Maybe the user is not logged in? Trying NTUSER.DAT/USRCLASS.DAT...
- Couldn't locate/download <USER>'s registry hive. Unable to proceed.
- Unable to download NTUSER.DAT/USRCLASS.DAT file
- Error parsing hive. Unable to continue.
- Unsupported OS or not enough privileges. Unable to continue.
- Was not able to find any user accounts. Unable to continue.
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
Unable to access ProfileList registry key. Unable to continue.
Here is a relevant code snippet related to the "Unable to access ProfileList registry key. Unable to continue." error message:
41: user_sids = []
42:
43: username_reg_path = "HKLM\\Software\\Microsoft\\Windows\ NT\\CurrentVersion\\ProfileList"
44: profile_subkeys = registry_enumkeys(username_reg_path)
45: if profile_subkeys.blank?
46: print_error("Unable to access ProfileList registry key. Unable to continue.")
47: return nil
48: end
49:
50: profile_subkeys.each do |user_sid|
51: unless user_sid.length > 10
Unable to read ProfileImagePath from the registry. Unable to continue.
Here is a relevant code snippet related to the "Unable to read ProfileImagePath from the registry. Unable to continue." error message:
52: next
53: end
54:
55: user_home_path = registry_getvaldata("#{username_reg_path}\\#{user_sid}", "ProfileImagePath")
56: if user_home_path.blank?
57: print_error("Unable to read ProfileImagePath from the registry. Unable to continue.")
58: return nil
59: end
60: full_path = user_home_path.strip
61: user_names << full_path.split("\\").last
62: user_homedir_paths << full_path
User <USER>: Can't access registry. Maybe the user is not logged in? Trying NTUSER.DAT/USRCLASS.DAT...
Here is a relevant code snippet related to the "User <USER>: Can't access registry. Maybe the user is not logged in? Trying NTUSER.DAT/USRCLASS.DAT..." error message:
92: subkeys = registry_enumvals(reg_key)
93: if subkeys.blank?
94: # If the registry_enumvals returns us nothing then we'll know
95: # that the user is most likely not logged in and we'll need to
96: # download and process users hive locally.
97: print_warning("User #{user}: Can't access registry. Maybe the user is not logged in? Trying NTUSER.DAT/USRCLASS.DAT...")
98: result = process_hive(sys_path, user, muicache, hive_file)
99: unless result.nil?
100: result.each { |r|
101: results << r unless r.nil?
102: }
Couldn't locate/download <USER>'s registry hive. Unable to proceed.
Here is a relevant code snippet related to the "Couldn't locate/download <USER>'s registry hive. Unable to proceed." error message:
140: user_home_path = expand_path(sys_path)
141: hive_path = user_home_path + hive_file
142: ntuser_status = file_exist?(hive_path)
143:
144: unless ntuser_status == true
145: print_warning("Couldn't locate/download #{user}'s registry hive. Unable to proceed.")
146: return nil
147: end
148:
149: print_status("Downloading #{user}'s NTUSER.DAT/USRCLASS.DAT file...")
150: local_hive_copy = Rex::Quickfile.new("jtrtmp")
Unable to download NTUSER.DAT/USRCLASS.DAT file
Here is a relevant code snippet related to the "Unable to download NTUSER.DAT/USRCLASS.DAT file" error message:
150: local_hive_copy = Rex::Quickfile.new("jtrtmp")
151: local_hive_copy.close
152: begin
153: session.fs.file.download_file(local_hive_copy.path, hive_path)
154: rescue ::Rex::Post::Meterpreter::RequestError
155: print_error("Unable to download NTUSER.DAT/USRCLASS.DAT file")
156: local_hive_copy.unlink rescue nil
157: return nil
158: end
159: results = hive_parser(local_hive_copy.path, muicache, user)
160: local_hive_copy.unlink rescue nil # Windows often complains about unlinking tempfiles
Error parsing hive. Unable to continue.
Here is a relevant code snippet related to the "Error parsing hive. Unable to continue." error message:
165: # This function is responsible for parsing the downloaded hive and
166: # extracting the contents of the MUICache registry key.
167: def hive_parser(local_hive_copy, muicache, user)
168: results = []
169: print_status("Parsing registry content...")
170: err_msg = "Error parsing hive. Unable to continue."
171: hive = Rex::Registry::Hive.new(local_hive_copy)
172: if hive.nil?
173: print_error(err_msg)
174: return nil
175: end
Unsupported OS or not enough privileges. Unable to continue.
Here is a relevant code snippet related to the "Unsupported OS or not enough privileges. Unable to continue." error message:
220: elsif sys_info =~ /Windows 7/ && is_admin?
221: print_good("Remote system supported: #{sys_info}")
222: muicache = "_Classes\\Local\ Settings\\Software\\Microsoft\\Windows\\Shell\\MUICache"
223: hive_file = "\\AppData\\Local\\Microsoft\\Windows\\UsrClass.dat"
224: else
225: print_error("Unsupported OS or not enough privileges. Unable to continue.")
226: return nil
227: end
228:
229: table = Rex::Text::Table.new(
230: 'Header' => 'MUICache Information',
Was not able to find any user accounts. Unable to continue.
Here is a relevant code snippet related to the "Was not able to find any user accounts. Unable to continue." error message:
239:
240: print_status("Phase 1: Searching user names...")
241: sys_users, sys_paths, sys_sids = find_user_names
242:
243: if sys_users.blank?
244: print_error("Was not able to find any user accounts. Unable to continue.")
245: return nil
246: else
247: print_good("Users found: #{sys_users.join(", ")}")
248: end
249:
Go back to menu.
Related Pull Requests
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #7200 Merged Pull Request: Rex::Ui::Text cleanup
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #3417 Merged Pull Request: Fixup release
- #2858 Merged Pull Request: Post Module: Enumerate MUICache registry key entries
Go back to menu.
See Also
Check also the following modules related to this module:
- post/windows/gather/enum_ad_bitlocker
- post/windows/gather/enum_ad_computers
- post/windows/gather/enum_ad_groups
- post/windows/gather/enum_ad_managedby_groups
- post/windows/gather/enum_ad_service_principal_names
- post/windows/gather/enum_ad_to_wordlist
- post/windows/gather/enum_ad_user_comments
- post/windows/gather/enum_ad_users
- post/windows/gather/enum_applications
- post/windows/gather/enum_artifacts
- post/windows/gather/enum_av
- post/windows/gather/enum_av_excluded
- post/windows/gather/enum_chocolatey_applications
- post/windows/gather/enum_chrome
- post/windows/gather/enum_computers
- post/windows/gather/enum_db
- post/windows/gather/enum_devices
- post/windows/gather/enum_dirperms
- post/windows/gather/enum_domain
- post/windows/gather/enum_domain_group_users
- post/windows/gather/enum_domains
- post/windows/gather/enum_domain_tokens
- post/windows/gather/enum_domain_users
- post/windows/gather/enum_emet
- post/windows/gather/enum_files
- post/windows/gather/enum_hostfile
- post/windows/gather/enum_hyperv_vms
- post/windows/gather/enum_ie
- post/windows/gather/enum_logged_on_users
- post/windows/gather/enum_ms_product_keys
- post/windows/gather/enum_onedrive
- post/windows/gather/enum_patches
- post/windows/gather/enum_powershell_env
- post/windows/gather/enum_prefetch
- post/windows/gather/enum_proxy
- post/windows/gather/enum_putty_saved_sessions
- post/windows/gather/enum_services
- post/windows/gather/enum_shares
- post/windows/gather/enum_snmp
- post/windows/gather/enum_termserv
- post/windows/gather/enum_tokens
- post/windows/gather/enum_tomcat
- post/windows/gather/enum_trusted_locations
- post/windows/gather/enum_unattend
Authors
- TJ Glad <tjglad[at]cmail.nu>
Version
This page has been produced using Metasploit Framework version 6.1.41-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.