T1552.002: Credentials in Registry

Adversaries may search the Registry on compromised systems for insecurely stored credentials. The Windows Registry stores configuration information that can be used by the system or other programs. Adversaries may query the Registry looking for credentials and passwords that have been stored for use by other programs or services. Sometimes these credentials are used for automatic logons.

Example commands to find Registry keys related to password information:

  • Local Machine Hive: reg query HKLM /f password /t REG_SZ /s
  • Current User Hive: reg query HKCU /f password /t REG_SZ /s

Positive Technologies products that cover the technique

MaxPatrol SIEM knowledge base

mitre_attck_cred_access: PT-CR-300: Search_Stored_Credentials: A user started a utility or script to retrieve passwords mitre_attck_cred_access: PT-CR-657: Reading_Registry_Objects: A request from a process to the registry objects containing user credentials is detected

Detection

IDDS0009Data source and componentProcess: Process CreationDescription

Monitor newly executed processes for applications that can be used to query the Registry, such as Reg, and collect command parameters that may indicate credentials are being searched. Correlate activity with related suspicious behavior that may indicate an active intrusion to reduce false positives.

Note: Pseudocode Event IDs are for Sysmon (Event ID 1 - process create) and Windows Security Log (Event ID 4688 - a new process has been created). The Analytic looks for command-line instances of searching the Windows Registry for insecurely stored credentials. This can be accomplished using the query functionality of the Reg system utility, by looking for keys and values that contain strings such as “password”. In addition, adversaries may use toolkits such as PowerSploit in order to dump credentials from various applications such as IIS. Accordingly, this analytic looks for invocations of reg.exe in this capacity as well as that of several PowerSploit modules with similar functionality.

Analytic 1 - Credentials in Files & Registry

(source="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode="1") OR (source="WinEventLog:Security" EventCode="4688")
CommandLine="reg query HKLM /f password /t REG_SZ /s*" OR CommandLine="reg* query HKCU /f password /t REG_SZ /s" OR CommandLine="Get-UnattendedInstallFile" OR CommandLine="*Get-Webconfig" OR CommandLine="Get-ApplicationHost" OR CommandLine="Get-SiteListPassword" OR CommandLine="Get-CachedGPPPassword" OR CommandLine="Get-RegistryAutoLogon"

IDDS0024Data source and componentWindows Registry: Windows Registry Key AccessDescription

Monitor for unexpected windows registry key being accessed that may search the Registry on compromised systems for insecurely stored credentials.

IDDS0017Data source and componentCommand: Command ExecutionDescription

Monitor executed commands and arguments that may search the Registry on compromised systems for insecurely stored credentials.

Mitigation

IDM1027NamePassword PoliciesDescription

Do not store credentials within the Registry.

IDM1026NamePrivileged Account ManagementDescription

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.

IDM1047NameAuditDescription

Proactively search for credentials within the Registry and attempt to remediate the risk.