Credentials in Registry
Adversaries may search the Windows Registry on compromised systems for insecurely stored credentials. The Registry stores configuration data used by programs for automatic logons, saved passwords, and service credentials. Common registry credential locations include: Windows AutoLogon (HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword), PuTTY saved sessions (SOFTWARE\SimonTatham\Putty\Sessions), Outlook profiles (HKCU\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles), VNC passwords (SOFTWARE\{TightVNC,RealVNC,UltraVNC}), and SNMP community strings. TrickBot, APT32, IceApple, Valak, and StrelaStealer have all abused registry credential storage.
// Detect registry credential access and search
let CredentialRegistryKeys = dynamic([
"Winlogon", "DefaultPassword", "AutoAdminLogon",
"SimonTatham", "Putty", "PuTTY",
"Outlook\\Profiles", "IMAP Password", "POP3 Password",
"VNC", "RealVNC", "TightVNC", "UltraVNC",
"WinVNC", "password", "Password"
]);
DeviceRegistryEvents
| where Timestamp > ago(24h)
| where ActionType in ("RegistryKeyQueried", "RegistryValueQueried")
| where RegistryKey has_any (CredentialRegistryKeys)
| extend IsAutoLogon = RegistryKey has "Winlogon" and (RegistryValueName has "Password" or RegistryValueName has "AutoAdminLogon")
| extend IsPutty = RegistryKey has_any ("SimonTatham", "PuTTY", "Putty")
| extend IsOutlook = RegistryKey has "Outlook" and RegistryKey has "Profiles"
| extend IsVNC = RegistryKey has_any ("VNC", "RealVNC", "TightVNC", "UltraVNC")
| project Timestamp, DeviceName, InitiatingProcessAccountName, RegistryKey, RegistryValueName,
InitiatingProcessFileName, InitiatingProcessCommandLine,
IsAutoLogon, IsPutty, IsOutlook, IsVNC
| union (
// Detect reg.exe bulk registry search for passwords
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("reg.exe", "powershell.exe", "pwsh.exe")
| where ProcessCommandLine has_any (
"query HKLM /f password", "query HKCU /f password",
"query HKLM /f passwd", "query HKCU /f passwd",
"Get-ItemProperty", "Get-RegistryAutoLogon", "Find-GPOPassword"
)
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName
)
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- AutoLogon configuration tools legitimately reading/writing DefaultPassword for kiosk or service account auto-logon setup
- PuTTY and SSH client applications accessing their own saved session credentials for connection
- Microsoft Outlook and email clients accessing their own profile credential storage
- IT inventory and compliance tools that audit registry settings including credential storage configuration
- Security assessment tools explicitly authorized to check for insecure credential storage in the registry
References (6)
- https://attack.mitre.org/techniques/T1552/002/
- https://pentestlab.blog/2017/04/19/stored-credentials/
- https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/network-access-do-not-allow-storage-of-passwords-and-credentials-for-network-authentication
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1552.002/T1552.002.md
- https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Get-GPPPassword.ps1
- https://www.trendmicro.com/en_us/research/19/b/trickbot-adds-new-features-targets-energy-enterprises.html
Unlock Pro Content
Get the full detection package for T1552.002 including response playbook, investigation guide, and atomic red team tests.