Credential Acquisition via Registry Hive Dumping

Identifies attempts to export a registry hive which may contain credentials using the Windows reg.exe tool.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/11/23"
  3integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel"]
  4maturity = "production"
  5updated_date = "2024/10/15"
  6min_stack_version = "8.14.0"
  7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
  8
  9[rule]
 10author = ["Elastic"]
 11description = "Identifies attempts to export a registry hive which may contain credentials using the Windows reg.exe tool."
 12from = "now-9m"
 13index = [
 14    "winlogbeat-*",
 15    "logs-endpoint.events.process-*",
 16    "logs-windows.forwarded*",
 17    "logs-windows.sysmon_operational-*",
 18    "endgame-*",
 19    "logs-system.security*",
 20    "logs-m365_defender.event-*",
 21    "logs-sentinel_one_cloud_funnel.*",
 22]
 23language = "eql"
 24license = "Elastic License v2"
 25name = "Credential Acquisition via Registry Hive Dumping"
 26note = """## Triage and analysis
 27
 28### Investigating Credential Acquisition via Registry Hive Dumping
 29
 30Dumping registry hives is a common way to access credential information as some hives store credential material.
 31
 32For example, the SAM hive stores locally cached credentials (SAM Secrets), and the SECURITY hive stores domain cached credentials (LSA secrets).
 33
 34Dumping these hives in combination with the SYSTEM hive enables the attacker to decrypt these secrets.
 35
 36This rule identifies the usage of `reg.exe` to dump SECURITY and/or SAM hives, which potentially indicates the compromise of the credentials stored in the host.
 37
 38#### Possible investigation steps
 39
 40- Investigate the script execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 41- Identify the user account that performed the action and whether it should perform this kind of action.
 42- Contact the account owner and confirm whether they are aware of this activity.
 43- Investigate other alerts associated with the user/host during the past 48 hours.
 44- Investigate if the credential material was exfiltrated or processed locally by other tools.
 45- Investigate potentially compromised accounts. Analysts can do this by searching for login events (e.g., 4624) to the target host.
 46
 47### False positive analysis
 48
 49- Administrators can export registry hives for backup purposes using command line tools like `reg.exe`. Check whether the user is legitamitely performing this kind of activity.
 50
 51### Related rules
 52
 53- Registry Hive File Creation via SMB - a4c7473a-5cb4-4bc1-9d06-e4a75adbc494
 54
 55### Response and remediation
 56
 57- Initiate the incident response process based on the outcome of the triage.
 58- Isolate the involved hosts to prevent further post-compromise behavior.
 59- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
 60- Reimage the host operating system and restore compromised files to clean versions.
 61- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 62- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 63- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
 64"""
 65references = [
 66    "https://medium.com/threatpunter/detecting-attempts-to-steal-passwords-from-the-registry-7512674487f8",
 67    "https://www.elastic.co/security-labs/detect-credential-access",
 68]
 69risk_score = 73
 70rule_id = "a7e7bfa3-088e-4f13-b29e-3986e0e756b8"
 71severity = "high"
 72tags = [
 73    "Domain: Endpoint",
 74    "OS: Windows",
 75    "Use Case: Threat Detection",
 76    "Tactic: Credential Access",
 77    "Resources: Investigation Guide",
 78    "Data Source: Elastic Endgame",
 79    "Data Source: Elastic Defend",
 80    "Data Source: System",
 81    "Data Source: Microsoft Defender for Endpoint",
 82    "Data Source: SentinelOne",
 83    "Data Source: Sysmon",
 84]
 85timestamp_override = "event.ingested"
 86type = "eql"
 87
 88query = '''
 89process where host.os.type == "windows" and event.type == "start" and
 90 (?process.pe.original_file_name == "reg.exe" or process.name : "reg.exe") and
 91 process.args : ("save", "export") and
 92 process.args : ("hklm\\sam", "hklm\\security")
 93'''
 94
 95
 96[[rule.threat]]
 97framework = "MITRE ATT&CK"
 98[[rule.threat.technique]]
 99id = "T1003"
100name = "OS Credential Dumping"
101reference = "https://attack.mitre.org/techniques/T1003/"
102[[rule.threat.technique.subtechnique]]
103id = "T1003.002"
104name = "Security Account Manager"
105reference = "https://attack.mitre.org/techniques/T1003/002/"
106
107[[rule.threat.technique.subtechnique]]
108id = "T1003.004"
109name = "LSA Secrets"
110reference = "https://attack.mitre.org/techniques/T1003/004/"
111
112
113
114[rule.threat.tactic]
115id = "TA0006"
116name = "Credential Access"
117reference = "https://attack.mitre.org/tactics/TA0006/"

Triage and analysis

Investigating Credential Acquisition via Registry Hive Dumping

Dumping registry hives is a common way to access credential information as some hives store credential material.

For example, the SAM hive stores locally cached credentials (SAM Secrets), and the SECURITY hive stores domain cached credentials (LSA secrets).

Dumping these hives in combination with the SYSTEM hive enables the attacker to decrypt these secrets.

This rule identifies the usage of reg.exe to dump SECURITY and/or SAM hives, which potentially indicates the compromise of the credentials stored in the host.

Possible investigation steps

  • Investigate the script execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Identify the user account that performed the action and whether it should perform this kind of action.
  • Contact the account owner and confirm whether they are aware of this activity.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Investigate if the credential material was exfiltrated or processed locally by other tools.
  • Investigate potentially compromised accounts. Analysts can do this by searching for login events (e.g., 4624) to the target host.

False positive analysis

  • Administrators can export registry hives for backup purposes using command line tools like reg.exe. Check whether the user is legitamitely performing this kind of activity.
  • Registry Hive File Creation via SMB - a4c7473a-5cb4-4bc1-9d06-e4a75adbc494

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved hosts to prevent further post-compromise behavior.
  • Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
  • Reimage the host operating system and restore compromised files to clean versions.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

References

Related rules

to-top