Windows Enumeration
After getting execution on a Windows host (a shell, a user session), the first job isn’t to escalate: it’s to understand where you are. Who you are, what privileges you have, what runs on the machine, what network you reach, and whether the host is domain-joined. Orderly enumeration avoids blind shots and almost always reveals the escalation path before touching any exploit. The invariant being leveraged: Windows is talkative, and nearly all the information an attacker needs is available without privileges.
flowchart LR
S["shell on the host"] --> Q1["who am I and what can I?<br/>whoami /all"]
Q1 --> Q2["what's locally exploitable?<br/>services, patches, creds"]
Q2 --> Q3["am I in a domain?<br/>what do I reach?"]
Q3 -->|yes| AD["AD enumeration"]
Q3 -->|no| PE["local privesc"]
Threat model
Section titled “Threat model”- Who attacks: someone with low-privilege access (a service account’s shell, a compromised user) who wants to turn it into local SYSTEM or a pivot into the domain.
- What it breaks: the information asymmetry. Windows reveals its configuration (privileges, services, paths, saved credentials) to any user; the attacker just has to ask.
- What it gains: the concrete vector for local escalation and the decision to pivot to the domain. Enumeration exploits nothing, but it selects the exploit.
- What the defender sees: bursts of recon commands (
whoami,net,systeminfo,nltest) that, correlated, give away an intruder in the post-exploitation phase.
Anatomy
Section titled “Anatomy”Order matters
Section titled “Order matters”Answer, in this order: who am I and what can I? → what’s locally exploitable? → am I in a domain and what do I reach?. Skipping the first step leads to burning noisy exploits needlessly.
The three privileges that change everything
Section titled “The three privileges that change everything”whoami /priv is the first stop. Three privileges are near-direct escalation (see
tokens):
- SeImpersonatePrivilege → Potato family → SYSTEM. Typical in IIS/MSSQL service accounts.
- SeBackupPrivilege → read SAM/SYSTEM or NTDS.dit bypassing ACLs.
- SeDebugPrivilege → dump LSASS, inject into privileged processes.
Red Team
Section titled “Red Team”User context and privileges
Section titled “User context and privileges”whoami /all # user, groups and PRIVILEGES (the most important)whoami /priv # SeImpersonate, SeBackup, SeDebug... = direct pathsnet user %USERNAME% # user's local groupsnet localgroup administratorsSystem and patches
Section titled “System and patches”systeminfo # version, build, hotfixes (for kernel exploits)wmic qfe get HotFixID # installed patches[System.Environment]::OSVersion.Version # from PowerShellCross build + hotfixes with wesng/Watson to map known kernel exploits. It’s the last resort, not the first (see privesc).
Software, services and processes
Section titled “Software, services and processes”tasklist /v # processes and the user running themsc query # serviceswmic service get name,pathname,startmode,startname # paths and service accountnetstat -ano # ports and PIDs (internal services)Look for services running as SYSTEM with weak binaries or paths (unquoted paths, writable permissions — see privesc).
Network and connectivity
Section titled “Network and connectivity”ipconfig /allroute printarp -a # hosts seen on the LANnslookup -type=srv _ldap._tcp.dc._msdcs.corp.local # locate DCsDomain-joined?
Section titled “Domain-joined?”systeminfo | findstr /i domainnltest /dsgetdc:corp.localecho %LOGONSERVER% # DC that authenticatedIf there’s a domain, enumeration jumps to AD (AD enumeration).
Credentials on the host (quick wins)
Section titled “Credentials on the host (quick wins)”# deployment files and configs with secretsfindstr /si password *.xml *.ini *.txt *.configdir /s /b *unattend* *sysprep* web.config# saved credentialscmdkey /listreg query HKLM /f password /t REG_SZ /s# autologon in the registryreg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"Investigator workflow
Section titled “Investigator workflow”whoami /allandwhoami /priv→ any dangerous privilege? (may be the whole escalation).- Services/processes as SYSTEM with weak paths or permissions.
- Credentials in configs, registry,
cmdkey, autologon. - Host in a domain? → locate DCs and jump to AD enum.
- If nothing obvious: winPEAS to sweep, and build+hotfixes for kernel as a last resort.
- winPEAS: the reference all-in-one enumerator (privesc + credentials + configs).
- Seatbelt (GhostPack): exhaustive host-oriented collection (C#).
- PowerUp (
Invoke-AllChecks): privesc vectors in PowerShell. - wesng / Watson: mapping patches to kernel exploits.
- Snaffler: sweeping shares for secrets.
Impact and chaining
Section titled “Impact and chaining”Enumeration selects the exploit: the local privesc vector and the
decision to pivot to the domain come from here. A whoami /priv with SeImpersonate can save you
everything else.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- Recon bursts (
whoami /all,net user/group,systeminfo,wmic,nltest) from a normal user account → post-exploitation pattern. - winPEAS/Seatbelt execution (known behavior; spikes of registry/FS reads).
- Massive registry reads looking for “password”.
Telemetry and sources
Section titled “Telemetry and sources”- Sysmon (event 1 process create, 10 process access, 11 file create) with command line.
- PowerShell auditing: Script Block Logging (4104), Module Logging (4103), transcription.
- Events 4688 (process create) with command line enabled.
Hardening
Section titled “Hardening”- Reduce the talkativeness: remove unnecessary tools, limit
wmic/cscript, apply App Control for Business (formerly WDAC) / AppLocker. - Remove cleartext credentials in configs, GPP, deployment scripts; use gMSA/LAPS.
- Least privilege: a normal user’s
whoami /privshould have nothing juicy. - EDR that alerts on recon chains and known enumerators.
Response
Section titled “Response”Isolate the host, identify the compromised account, rotate its credentials and review what was enumerated (shares, DCs, secrets) to anticipate the attacker’s next step.
CVEs and real cases
Section titled “CVEs and real cases”- Enumeration itself isn’t a CVE, but it enables the choice of kernel exploits like PrintNightmare (CVE-2021-34527 / CVE-2021-1675) or HiveNightmare/SeriousSAM (CVE-2021-36934).
- winPEAS/Seatbelt/PowerUp are standard in pentest reports and real-actor TTPs (MITRE T1082, T1087, T1057).
- Countless breaches started with cleartext credentials in
unattend.xmlor GPP (cpassword, MS14-025 — see GPP cpassword).
Test checklist
Section titled “Test checklist”-
whoami /allandwhoami /priv— dangerous privileges (SeImpersonate/Backup/Debug)? -
systeminfo+ hotfixes — unpatched build mappable to a kernel exploit? - Services/processes as SYSTEM with weak paths or permissions.
- Credentials in configs, registry,
cmdkey, autologon? - Domain-joined host? DCs located?
- Internal ports and non-exposed services (
netstat -ano). - Accessible shares with secrets (Snaffler).
- Does winPEAS flag any obvious vector?