Detect Unsecured Credentials in Elastic Security
Adversaries may search compromised systems to find and obtain insecurely stored credentials. These credentials can be stored and/or misplaced in many locations on a system, including plaintext files, operating system or application-specific repositories, shell history files, private key files, cloud instance metadata APIs, container environment variables, and group policy preference files. Tools like LaZagne, NirSoft utilities, and custom scripts are commonly used to automate credential harvesting across multiple storage locations simultaneously.
MITRE ATT&CK
- Tactic
- Credential Access
- Technique
- T1552 Unsecured Credentials
- Canonical reference
- https://attack.mitre.org/techniques/T1552/
Elastic Detection Query
sequence by host.name with maxspan=5m
[
any where
(
(event.category == "process" and event.type == "start" and
(
process.name : ("lazagne.exe", "netpass.exe", "passwordfox.exe", "webbrowserpassview.exe",
"vaultpassview.exe", "credentialfileview.exe", "mailpassview.exe",
"mimikatz.exe", "wce.exe", "pwdump*.exe", "fgdump.exe", "gsecdump.exe")
or process.command_line : ("*lazagne*", "*nirsoft*", "*netpass*", "*mimikatz*")
)
)
or
(event.category == "file" and event.type in ("access", "creation") and
(
file.path : ("*password*", "*passwd*", "*credentials*", "*creds*", "*secret*",
"*apikey*", "*api_key*", "*.aws*credentials*", "*unattend.xml",
"*sysprep.xml", "*id_rsa*", "*id_dsa*", "*id_ecdsa*", "*id_ed25519*",
"*.pem", "*.pfx", "*.p12", "*vnc.ini", "*filezilla*", "*winscp.ini",
"*putty*", "*.bash_history", "*.ssh*", "*web.config")
and not process.name : ("svchost.exe", "SearchIndexer.exe", "MsMpEng.exe", "OneDrive.exe")
)
)
or
(event.category == "registry" and
registry.path : ("*WinVNC3*Password*", "*TightVNC*Server*", "*RealVNC*WinVNC4*",
"*SNMP*ValidCommunities*", "*Winlogon*DefaultPassword*",
"*PuTTY*Sessions*", "*OpenSSH*")
and not process.name : ("svchost.exe", "lsass.exe", "services.exe")
)
or
(event.category == "process" and event.type == "start" and
process.name : ("powershell.exe", "pwsh.exe", "cmd.exe", "bash", "sh") and
process.command_line : ("*Get-Content*", "*findstr*", "*Select-String*", "*grep*", "* type *", "*cat *") and
process.command_line : ("*password*", "*passwd*", "*credentials*", "*secret*", "*apikey*", "*api_key*", "*connectionstring*", "*passw*")
)
)
] Detects T1552 Unsecured Credentials access via four branches: execution of known credential harvesting tools (LaZagne, Mimikatz, NirSoft), access to credential-bearing files (SSH keys, PEM/PFX, config files), registry queries to credential storage paths (VNC, PuTTY, Winlogon), and scripted credential searches via PowerShell or shell commands. Uses ECS fields across process, file, and registry event categories.
Data Sources
Required Tables
False Positives & Tuning
- Security administrators running legitimate credential auditing tools such as CyberArk discovery scanners or privileged access management agents that access SSH key paths
- Backup agents (Veeam, Acronis) reading configuration files containing connection strings or API keys as part of scheduled backup jobs
- Developer tooling (Git credential helpers, AWS CLI configuration checks, IDE plugins) accessing .aws/credentials or .ssh config files during normal software development workflows
- IT compliance tools performing configuration baseline checks that read Winlogon registry keys or enumerate PuTTY session configurations
Other platforms for T1552
Testing Methodology
Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1LaZagne All-Sources Credential Harvest Simulation
Expected signal: Sysmon Event ID 1: Process Create for lazagne.exe with CommandLine 'all -oN'. Sysmon Event ID 11: Multiple file access events across browser profile directories, %APPDATA% credential stores, and credential files. Sysmon Event ID 13: Registry queries to PuTTY, VNC, and Winlogon password locations. File creation event for lazagne_test_output.txt.
- Test 2Scripted Credential File Search via PowerShell Select-String
Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing both 'Select-String' and 'password'. PowerShell ScriptBlock Log Event ID 4104 capturing the full pipeline. Sysmon Event ID 11 for cred_search_results.txt creation. Multiple file access events as Select-String reads candidate files.
- Test 3Registry Credential Extraction — PuTTY and Winlogon
Expected signal: Sysmon Event ID 1: Process Create for reg.exe with CommandLine querying PuTTY sessions path. If Sysmon is configured to monitor registry access, Event ID 13 showing TargetObject paths. Security Event ID 4663 (if object access auditing enabled) for registry key read operations.
- Test 4Private Key Enumeration and Staging
Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine referencing '.pem', '.pfx', 'id_rsa'. Sysmon Event ID 11: File creation for key_staging directory. Multiple file access events as Get-ChildItem reads candidate key files. PowerShell ScriptBlock Log Event ID 4104 with full enumeration script.
- Test 5NirSoft WebBrowserPassView Credential Extraction
Expected signal: Sysmon Event ID 1: Process Create for WebBrowserPassView.exe. Sysmon Event ID 11: File access to Chrome Login Data SQLite file at %LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data, Firefox logins.json, Edge Login Data. File creation event for browser_creds_test.html output. If DPAPI decryption is used, potential Event ID 4693 (DPAPI decryption) in Security log.
References (9)
- https://attack.mitre.org/techniques/T1552/
- https://github.com/AlessandroZ/LaZagne
- https://www.nirsoft.net/password_recovery_tools.html
- https://labs.portcullis.co.uk/download/eu-18-Wadhwa-Brown-Where-2-worlds-collide-Bringing-Mimikatz-et-al-to-UNIX.pdf
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicefileevents-table
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceregistryevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1552/T1552.md
- https://www.cybereason.com/blog/astaroth-malware-uses-legitimate-os-and-antivirus-processes-to-steal-passwords-and-personal-data
- https://www.huntress.com/blog/nppspy-how-unsecured-windows-credential-provider-allowed-adversaries-to-access-credentials
Unlock Pro Content
Get the full detection package for T1552 including response playbook, investigation guide, and atomic red team tests.