Unsecured Credentials: 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: [1]

  • Local Machine Hive: reg query HKLM /f password /t REG_SZ /s
  • Current User Hive: reg query HKCU /f password /t REG_SZ /s
ID: T1552.002
Sub-technique of:  T1552
Platforms: Windows
System Requirements: Ability to query some Registry locations depends on the adversary's level of access. User permissions are usually limited to access of user-related Registry keys.
Contributors: Sudhanshu Chauhan, @Sudhanshu_C
Version: 1.1
Created: 04 February 2020
Last Modified: 15 October 2024

Procedure Examples

ID Name Description
S0331 Agent Tesla

Agent Tesla has the ability to extract credentials from the Registry.[2]

G0050 APT32

APT32 used Outlook Credential Dumper to harvest credentials stored in Windows registry.[3][4]

S1022 IceApple

IceApple can harvest credentials from local and remote host registries.[5]

S0194 PowerSploit

PowerSploit has several modules that search the Windows Registry for stored credentials: Get-UnattendedInstallFile, Get-Webconfig, Get-ApplicationHost, Get-SiteListPassword, Get-CachedGPPPassword, and Get-RegistryAutoLogon.[1]

G1039 RedCurl

RedCurl used LaZagne to obtain passwords in the Registry.[6][7]

S0075 Reg

Reg may be used to find credentials in the Windows Registry.[1]

S0266 TrickBot

TrickBot has retrieved PuTTY credentials by querying the Software\SimonTatham\Putty\Sessions registry key [8]

S0476 Valak

Valak can use the clientgrabber module to steal e-mail credentials from the Registry.[9]

Mitigations

ID Mitigation Description
M1047 Audit

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

M1027 Password Policies

Do not store credentials within the Registry.

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.

Detection

ID Data Source Data Component Detects
DS0017 Command Command Execution

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

Analytic 1 - Commands indicating credential searches in the registry.

(index=security sourcetype="powershell" EventCode=4104 ScriptBlockText="reg query /f password /t REG_SZ /s*")

DS0009 Process Process Creation

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" ORCommandLine="reg query HKCU /f password /t REG_SZ /s" ORCommandLine="Get-UnattendedInstallFile" ORCommandLine="Get-Webconfig" ORCommandLine="Get-ApplicationHost" ORCommandLine="Get-SiteListPassword" ORCommandLine="Get-CachedGPPPassword" ORCommandLine="Get-RegistryAutoLogon*"

Analytic 2 - New processes with parameters indicating credential searches.

(index=security sourcetype="WinEventLog:Security" EventCode=4688 CommandLine="reg query /f password /t REG_SZ /s") OR(index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 CommandLine="reg query /f password /t REG_SZ /s")

DS0024 Windows Registry Windows Registry Key Access

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

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

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

References