Unsecured Credentials

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 (e.g. Bash History), operating system or application-specific repositories (e.g. Credentials in Registry), or other specialized files/artifacts (e.g. Private Keys).[1]

ID: T1552
Platforms: Containers, IaaS, Identity Provider, Linux, Network, Office Suite, SaaS, Windows, macOS
Contributors: Austin Clark, @c2defense
Version: 1.4
Created: 04 February 2020
Last Modified: 14 October 2024

Procedure Examples

ID Name Description
S0373 Astaroth

Astaroth uses an external software known as NetPass to recover passwords. [2]

S1111 DarkGate

DarkGate uses NirSoft tools to steal user credentials from the infected machine.[3] NirSoft tools are executed via process hollowing in a newly-created instance of vbc.exe or regasm.exe.

S1131 NPPSPY

NPPSPY captures credentials by recording them through an alternative network listener registered to the mpnotify.exe process, allowing for cleartext recording of logon information.[4]

S1091 Pacu

Pacu can search for sensitive data: for example, in Code Build environment variables, EC2 user data, and Cloud Formation templates.[5]

G1017 Volt Typhoon

Volt Typhoon has obtained credentials insecurely stored on targeted network appliances.[6]

Mitigations

ID Mitigation Description
M1015 Active Directory Configuration

Remove vulnerable Group Policy Preferences.[7]

M1047 Audit

Preemptively search for files containing passwords or other credentials and take actions to reduce the exposure risk when found.

M1041 Encrypt Sensitive Information

When possible, store keys on separate cryptographic hardware instead of on the local system.

M1037 Filter Network Traffic

Limit access to the Instance Metadata API. A properly configured Web Application Firewall (WAF) may help prevent external adversaries from exploiting Server-side Request Forgery (SSRF) attacks that allow access to the Cloud Instance Metadata API.[8]

M1035 Limit Access to Resource Over Network

Limit network access to sensitive services, such as the Instance Metadata API.

M1028 Operating System Configuration

There are multiple methods of preventing a user's command history from being flushed to their .bash_history file, including use of the following commands:set +o history and set -o history to start logging again;unset HISTFILE being added to a user's .bash_rc file; andln -s /dev/null ~/.bash_history to write commands to /dev/nullinstead.

M1027 Password Policies

Use strong passphrases for private keys to make cracking difficult. Do not store credentials within the Registry. Establish an organizational policy that prohibits password storage in files.

M1026 Privileged Account Management

If it is necessary that software must store credentials in the Registry, then ensure the associated accounts have limited permissions so they cannot be abused if obtained by an adversary.

M1022 Restrict File and Directory Permissions

Restrict file shares to specific directories with access only to necessary users.

M1051 Update Software

Apply patch KB2962486 which prevents credentials from being stored in GPPs.[9][10]

M1017 User Training

Ensure that developers and system administrators are aware of the risk associated with having plaintext passwords in software configuration files that may be left on endpoint systems or servers.

Detection

ID Data Source Data Component Detects
DS0015 Application Log Application Log Content

Monitor application logs for activity that may highlight malicious attempts to access application data, especially abnormal search activity targeting passwords and other artifacts related to credentials.[11]

Analytic 1 - Abnormal search activity targeting passwords and other credential artifacts.

(index=third_party sourcetype IN ("mailserver_logs", "webapp_logs", "appliance_logs") ("search" OR "query" OR "find" OR "grep") ("password" OR "credential" OR "key" OR "secret" OR "token"))

DS0017 Command Command Execution

While detecting adversaries accessing credentials may be difficult without knowing they exist in the environment, it may be possible to detect adversary use of credentials they have obtained. Monitor the command-line arguments of executing processes for suspicious words or regular expressions that may indicate searching for a password (for example: password, pwd, login, secure, or credentials). See Valid Accounts for more information.

Analytic 1 - Suspicious commands or regular expressions indicating credential search.

(index=security sourcetype="Powershell" EventCode=4104) OR(index=os sourcetype="linux_secure" action="execve") OR(index=os sourcetype="macos_secure" event_type="execve") | where match(CommandLine, "(?i)(password|credential|secret|key|token|login|passwd|passphrase)")

DS0022 File File Access

Monitor for suspicious file access activity, specifically indications that a process is reading multiple files in a short amount of time and/or using command-line arguments indicative of searching for credential material (ex: regex patterns). These may be indicators of automated/scripted credential access behavior. Monitoring when the user's .bash_history is read can help alert to suspicious activity. While users do typically rely on their history of commands, they often access this history through other utilities like "history" instead of commands like cat ~/.bash_history.

Analytic 1 - Multiple file reads in a short period or searching for credential material.

(index=security sourcetype="WinEventLog:Security" EventCode=4663 ObjectName="password" OR ObjectName="credential") OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 TargetObject="password" OR TargetObject="credential") OR(index=os sourcetype="linux_audit" action="open" filepath IN ("password", "credential", "passwd", "shadow", ".pem", ".key")) OR(index=os sourcetype="macos_secure" event_type="open" file_path IN ("password", "credential", "passwd", "shadow", ".pem", ".key"))

DS0009 Process Process Creation

Monitor newly executed processes that may search compromised systems to find and obtain insecurely stored credentials.

Analytic 1 - New processes with parameters indicating credential searches.

(index=security sourcetype="WinEventLog:Security" EventCode=4688 CommandLine="password" OR CommandLine="credential") OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 CommandLine="password" OR CommandLine="credential") OR(index=os sourcetype="linux_audit" action="execve" CommandLine="password" OR CommandLine="credential") OR(index=os sourcetype="macos_secure" event_type="execve" CommandLine="password" OR CommandLine="credential")

DS0002 User Account User Account Authentication

Monitor for an attempt by a user to gain access to a network or computing resource, often by providing credentials that may search compromised systems to find and obtain insecurely stored credentials.

Analytic 1 - Failed or unusual logon attempts using compromised credentials.

(index=security sourcetype="WinEventLog:Security" EventCode IN (4625, 4648)) OR(index=os sourcetype="linux_secure" message="Failed password" OR message="Invalid user") OR(index=os sourcetype="macos_secure" event_type="authentication_failure" OR message="Failed to authenticate user")

DS0024 Windows Registry Windows Registry Key Access

Monitor for unexpected windows registry key being accessed that may search compromised systems to find and obtain insecurely stored credentials.

Analytic 1 - Unauthorized access to registry keys associated with credentials.

index=security sourcetype="WinEventLog:Microsoft-Windows-Security-Auditing" EventCode=4663 ObjectType="Registry" (ObjectName="password" OR ObjectName="credential") | eval AccessAttempt=case( AccessMask="0x1", "Read", AccessMask="0x2", "Write", AccessMask="0x3", "Read/Write", AccessMask="0x4", "Delete", true(), "Unknown")

References