Windows Gather Installed Application Within Chocolatey Enumeration - Metasploit
This page contains detailed information about how to use the post/windows/gather/enum_chocolatey_applications metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Windows Gather Installed Application Within Chocolatey Enumeration
Module: post/windows/gather/enum_chocolatey_applications
Source code: modules/post/windows/gather/enum_chocolatey_applications.rb
Disclosure date: -
Last modification time: 2022-04-01 10:56:11 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -
This module will enumerate all installed applications on a Windows system with chocolatey installed
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.
Reliability:
- repeatable-session: The module is expected to get a shell every time it runs.
Stability:
- crash-safe: Module should not crash the service.
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_chocolatey_applications
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_chocolatey_applications
msf post(enum_chocolatey_applications) > show options
... show and set options ...
msf post(enum_chocolatey_applications) > set SESSION session-id
msf post(enum_chocolatey_applications) > 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_chocolatey_applications")
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
Knowledge Base
Vulnerable Application
This module will enumerate all installed applications on a Windows system that are installed with Chocolatey.
Verification Steps
- Start msfconsole
- Get meterpreter or shell session
- Do:
use post/windows/gather/enum_chocolatey_applications
- Do:
set SESSION <session id>
- Do:
run
Options
ChocoPath
This is here for the incredibly rare cases where chocolatey is not on the system path. It allows you to set the path of the chocolatey executable ahead of time. Unless this is changed, it assumes to use chocolatey from the path.
Scenarios
Windows 10 Pro (21H2 Build 19044.1586).
msf6 exploit(multi/handler) > [*] Meterpreter session 12 opened (192.168.56.1:4444 -> 192.168.56.112:49906 ) at 2022-03-27 15:57:39 -0400
msf6 exploit(multi/handler) > use post/windows/gather/enum_chocolatey_applications
msf6 post(windows/gather/enum_chocolatey_applications) > set SESSION 12
SESSION => 12
msf6 post(windows/gather/enum_chocolatey_applications) > run
[*] Enumerating applications installed on DESKTOP-LB04G7R
[*] Targets Chocolatey version: 1.0.0
[*] Getting chocolatey applications.
[+] Successfully grabbed all items
Installed Chocolatey Applications
=================================
Name Version
---- -------
GoogleChrome 99.0.4844.82
SQLite 3.38.1
chocolatey 1.0.0
chocolatey-core.extension 1.3.5.1
notepadplusplus 8.3.3
notepadplusplus.install 8.3.3
sublimetext3 3.2.2
[+] Results stored in: /home/rad10/.msf4/loot/20220327160034_default_192.168.56.112_host.application_704988.txt
[*] Post module execution completed
Go back to menu.
Msfconsole Usage
Here is how the windows/gather/enum_chocolatey_applications post exploitation module looks in the msfconsole:
msf6 > use post/windows/gather/enum_chocolatey_applications
msf6 post(windows/gather/enum_chocolatey_applications) > show info
Name: Windows Gather Installed Application Within Chocolatey Enumeration
Module: post/windows/gather/enum_chocolatey_applications
Platform: Windows
Arch:
Rank: Normal
Provided by:
Nick Cottrell <[email protected]>
Module stability:
crash-safe
Module reliability:
repeatable-session
Compatible session types:
Meterpreter
Shell
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on
Description:
This module will enumerate all installed applications on a Windows
system with chocolatey installed
Module Options
This is a complete list of options available in the windows/gather/enum_chocolatey_applications post exploitation module:
msf6 post(windows/gather/enum_chocolatey_applications) > show options
Module options (post/windows/gather/enum_chocolatey_applications):
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_chocolatey_applications post exploitation module:
msf6 post(windows/gather/enum_chocolatey_applications) > show advanced
Module advanced options (post/windows/gather/enum_chocolatey_applications):
Name Current Setting Required Description
---- --------------- -------- -----------
ChocoPath choco.exe no The path to the chocolatey executable if it's not on default path
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_chocolatey_applications module can do:
msf6 post(windows/gather/enum_chocolatey_applications) > show actions
Post actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the windows/gather/enum_chocolatey_applications post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(windows/gather/enum_chocolatey_applications) > 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:
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.
Chocolatey path not found
Here is a relevant code snippet related to the "Chocolatey path not found" error message:
46: end
47:
48: def run
49: # checking that session is meterpreter and session has powershell
50: choco_path = chocopath
51: fail_with(Failure::NotFound, 'Chocolatey path not found') unless choco_path
52:
53: print_status("Enumerating applications installed on #{sysinfo['Computer']}") if session.type == 'meterpreter'
54:
55: # getting chocolatey version
56: choco_version = cmd_exec(choco_path, '-v')
Failed to get chocolatey version. Result was unexpected: <CHOCO_VERSION>
Here is a relevant code snippet related to the "Failed to get chocolatey version. Result was unexpected: <CHOCO_VERSION>" error message:
65: cmd_exec(choco_path, 'list -lo')
66: elsif choco_version.match(/^(?:[2-9]|\d{2,})\.\d+\.\d+$/)
67: # its version 2 or above, no need for local
68: cmd_exec(choco_path, 'list')
69: else
70: fail_with(Failure::UnexpectedReply, "Failed to get chocolatey version. Result was unexpected: #{choco_version}")
71: end
72: print_good('Successfully grabbed all items')
73:
74: # making table to better organize applications and their versions
75: table = Rex::Text::Table.new(
Go back to menu.
Related Pull Requests
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_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_muicache
- 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
- Nick Cottrell <ncottrellweb[at]gmail.com>
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.