Detect Unsecured Credentials in Google Chronicle
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/
YARA-L Detection Query
rule t1552_unsecured_credentials_access {
meta:
author = "Argus Detection Engineering"
description = "Detects T1552 Unsecured Credentials access via credential harvesting tool execution, sensitive file access, registry credential path queries, and scripted credential searches"
severity = "HIGH"
priority = "HIGH"
mitre_attack_tactic = "Credential Access"
mitre_attack_technique = "T1552"
mitre_attack_url = "https://attack.mitre.org/techniques/T1552/"
platform = "Windows"
rule_version = "1.0"
events:
(
// Branch 1: Known credential harvesting tools
$e.metadata.event_type = "PROCESS_LAUNCH" and
(
re.regex($e.principal.process.file.full_path, `(?i)(lazagne|netpass\.exe|passwordfox|webbrowserpassview|vaultpassview|credentialfileview|mailpassview|mimikatz|wce\.exe|pwdump|fgdump|gsecdump)`) or
re.regex($e.target.process.command_line, `(?i)(lazagne|nirsoft|netpass|mimikatz)`)
)
) or
(
// Branch 2: Credential file access (file create/read events)
$e.metadata.event_type = "FILE_OPEN" and
re.regex($e.target.file.full_path, `(?i)(\.pem$|\.pfx$|\.p12$|id_rsa|id_dsa|id_ecdsa|id_ed25519|unattend\.xml|sysprep\.xml|vnc\.ini|filezilla|winscp\.ini|putty|\.bash_history|\.aws[/\\]credentials|web\.config|password|passwd|credentials|creds|secret|apikey|api_key|\.ssh[/\\])`) and
not re.regex($e.principal.process.file.full_path, `(?i)(svchost\.exe|SearchIndexer\.exe|MsMpEng\.exe|OneDrive\.exe)`)
) or
(
// Branch 3: Registry credential path queries
$e.metadata.event_type = "REGISTRY_OPEN_KEY" and
re.regex($e.target.registry.registry_key, `(?i)(WinVNC3[/\\]Password|TightVNC[/\\]Server|RealVNC[/\\]WinVNC4|SNMP[/\\]Parameters[/\\]ValidCommunities|Winlogon[/\\](Default|AltDefault)Password|PuTTY[/\\]Sessions|OpenSSH)`) and
not re.regex($e.principal.process.file.full_path, `(?i)(svchost\.exe|lsass\.exe|services\.exe)`)
) or
(
// Branch 4: Scripted credential searches via shell/PowerShell
$e.metadata.event_type = "PROCESS_LAUNCH" and
re.regex($e.principal.process.file.full_path, `(?i)(powershell\.exe|pwsh\.exe|cmd\.exe|bash|\bsh\b)`) and
re.regex($e.target.process.command_line, `(?i)(Get-Content|findstr|Select-String|grep|\btype\b|\bcat\b)`) and
re.regex($e.target.process.command_line, `(?i)(password|passwd|credentials|secret|apikey|api_key|connectionstring|pwd|passw)`)
)
condition:
$e
} Chronicle YARA-L 2.0 rule detecting T1552 Unsecured Credentials access using UDM event model. Covers four detection branches: credential harvesting tool execution (PROCESS_LAUNCH with known tool names), sensitive credential file access (FILE_OPEN with credential-related paths), registry credential path queries (REGISTRY_OPEN_KEY for VNC/PuTTY/Winlogon paths), and scripted shell-based credential searches. Excludes known legitimate processes to reduce false positives.
Data Sources
Required Tables
False Positives & Tuning
- Endpoint detection response (EDR) solutions with built-in credential access detection may generate PROCESS_LAUNCH events for their own scanning modules that match tool name patterns
- SSH key rotation scripts executed by configuration management platforms (SaltStack, Ansible Tower) will match file access patterns when reading or replacing id_rsa and id_ecdsa key files
- Application secrets scanning tools integrated into developer workstations (git-secrets, truffleHog) trigger scripted credential search detection when performing pre-commit hooks that grep for secret patterns
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.