Windows Privilege Escalation: Stored Credentials and Missing Patches

6 min read188 courses on OnlySecurity

A foothold on a Windows host is usually a standard user account. Local privilege escalation is the step from there to administrator or SYSTEM, which most next steps need. Two causes account for much of it: credentials left where a standard user can read them, and patches never installed. Test only networks and systems you own or are authorised to assess.

Where this sits in an engagement

Escalation comes after initial access and before lateral movement, and the findings are usually configuration gaps, not clever exploits. A local administrator password reused across machines turns one finding into a network-wide one, which is why the Network and Active Directory Ultimate Course treats the single host and the domain together. Copying files between hosts is covered in file transfers.

Stored credentials: where to look

MITRE tracks the file-based cases as T1552.001, Credentials In Files and the Group Policy case as T1552.006.

  1. Unattended install files. Microsoft’s answer file documentation says Windows Setup caches answer files in %WINDIR%\Panther, lists %WINDIR%\Panther\Unattend, %WINDIR%\System32\Sysprep and the system drive’s root among its search locations, and warns against domain passwords in them. Setup clears sensitive data from the cached copy after each pass, but an embedded or leftover file may keep it. Windows SIM can hide local account passwords only, and Microsoft says that is not encryption: its example value is Base64 of the password plus the setting name.
  2. Group Policy Preferences. Older preference items could store a password in a cpassword attribute in SYSVOL XML. MS14-025 (CVE-2014-1812, May 2014) says any authenticated domain user can retrieve and decrypt it; the 32-byte AES key is in Microsoft’s MS-GPPREF specification. The update removed the password option from drive maps, local users and groups, scheduled tasks, services and data sources, but leaves existing GPOs in place, so old files still need finding.
  3. Saved credentials. cmdkey /list lists stored user names and credentials, and Microsoft notes passwords are not displayed. An entry for an account tells you what it could be used for: runas /savecred runs a program as another account using credentials the current user saved earlier.
  4. Winlogon automatic logon. Microsoft documents AutoAdminLogon, DefaultUserName and DefaultPassword under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, warning that the password sits there in plain text and Authenticated Users can read the key remotely. The Sysinternals Autologon tool stores it as an LSA secret, which an administrator can still decrypt.
  5. PowerShell history. PSReadLine saves typed commands per host, ConsoleHost_history.txt for the console, by default under $Env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\. It skips lines containing words such as password, token or secret, and writes everything else.

For each hit, report the location, the account and what it reaches, not the secret itself.

Missing patches

systeminfo prints the OS version and installed hotfixes; Get-HotFix reads the Win32_QuickFixEngineering WMI class, which returns only updates supplied by Component Based Servicing. Compare the result with Microsoft’s Security Update Guide. Arris Huijgen’s WES-NG automates this from a saved systeminfo output on your own machine, so only systeminfo runs on the target. Its README warns that Microsoft’s data is often incomplete and false positives occur, and offers --muc-lookup to check candidates against the Update Catalog. Treat the output as questions, not findings.

A historic example: MS16-032 (March 2016, rated Important) fixes CVE-2016-0099, a Secondary Logon elevation of privilege reported by James Forshaw of Google Project Zero. Its KB article is 3143141, but the package a host lists is 3139914 on Windows Vista, 7 and 8.1 and Server 2008 to 2012 R2, while Windows 10 got it in cumulative updates, and every later one includes it. The finding names the missing package, with the bulletin as evidence.

Why kernel exploits come last

A public kernel or driver exploit is the riskiest way to prove a missing patch (MITRE: T1068). A kernel-mode crash takes the whole operating system down, and a client’s production host is not a lab. Prefer version evidence; exploit only where the rules of engagement allow, on a system the client agrees can be disturbed, ideally a clone. Otherwise report the missing update and stop.

Enumeration helpers

  1. PrivescCheck (itm4n): its base checks cover unattend files, Winlogon and cached GPP files; PowerShell history needs -Extended, the credential vault -Risky. Access checks run as the current user, so running it as an administrator skips many.
  2. winPEAS, the Windows script in PEASS-ng. Its README expects Defender to delete the unobfuscated build, so expect endpoint protection to notice it.

For the Linux kernel side, see Linux kernel privilege escalation.

Commands

Checked against PrivescCheck 2026.10.28-1, PEASS-ng 20261126-5589f45b, and wes.py 1.06 from the WES-NG master branch at commit 53f94fb (the repository has no release tags). Run these on lab systems you own.

cmdkey /list
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName
dir /s /b %WINDIR%\Panther\*.xml
dir /b %WINDIR%\System32\Sysprep\*.xml
dir /b %SYSTEMDRIVE%\*unattend.xml
findstr /s /i cpassword \\corp.lab.example\SYSVOL\corp.lab.example\Policies\*.xml
powershell -c "(Get-PSReadLineOption).HistorySavePath"
systeminfo > systeminfo.txt
powershell -c "Get-HotFix"
python3 wes.py --update
python3 wes.py systeminfo.txt --exploits-only
powershell -ep bypass -c ". .\PrivescCheck.ps1; Invoke-PrivescCheck -Report TXT,HTML"
  1. reg query ... /v reads one named value, so these lines do not print DefaultPassword; query it only on a lab host.
  2. The findstr line reads a lab domain’s SYSVOL and works as any domain user.
  3. wes.py --update downloads current definitions; --exploits-only (-e) shows only entries with known exploits.
  4. -Extended adds the extended checks and -Risky the ones likely to trigger EDR, so leave -Risky off unless the client agrees.

Detection and defence

Credentials. Windows LAPS rotates and backs up each device’s local administrator password, so one host’s password no longer opens the rest (Windows LAPS overview). It is built into Windows 11 23H2 and later, and earlier supported versions from the 11 April 2023 update; the legacy Microsoft LAPS product is deprecated from Windows 11 23H2 and stores passwords in Active Directory only in clear text. Find existing cpassword entries with the Get-SettingsWithCPassword.ps1 script in Microsoft’s KB 2962486 and remove them in Group Policy Management. Delete answer files from images, shares and caches. Clear saved credentials with cmdkey /delete and replace automatic logon with a design keeping no password. Credential Guard protects NTLM hashes, Kerberos TGTs and domain credentials in Credential Manager. From Windows 11 22H2 and Windows Server 2025 it is on by default on domain-joined machines that are not domain controllers and meet its licence and hardware needs; on Windows 11 that means Enterprise or Education, not Pro (Credential Guard overview). It does not protect generic credentials (known issues), local accounts in the SAM or a password in a file.

Spotting it. Enable Audit File System for Success (Advanced Audit Policy Configuration, Object Access). It logs only files whose system access control list (SACL) matches the access (Audit File System), so put a read SACL on files you must keep, such as answer files you cannot remove, not on whole SYSVOL folders, where Group Policy traffic makes the volume high. Reads appear as event 4663, “An attempt was made to access an object”. MITRE’s DET0307 pairs credential file access with a following process start (Sysmon event 1) or logon (events 4624 and 4648); DET0381 pairs SYSVOL XML enumeration (Detailed File Share event 5145) with a process that decodes the passwords. The Windows Security Logging with Sysmon and Event Logs course covers what to collect.

Patches. Patch on a fixed cadence and check for missing updates yourself the same way. MITRE’s T1068 mitigations add exploit protection and blocking known vulnerable drivers, validating block rules in audit mode first.

Where to go next

The Windows Security Logging with Sysmon and Event Logs course shows what escalation and credential access look like in the logs. For the wider workflow from first scan to report, see Penetration Testing Field Notes.

This article replaces the KSEC ARK notes first published in 2015.

More from this author