T1003.002 Microsoft Sentinel · KQL

Detect Security Account Manager in Microsoft Sentinel

Adversaries attempt to extract credential material from the Security Account Manager (SAM) database containing local account NTLM hashes. The SAM requires SYSTEM-level access. Methods include: registry export (reg save HKLM\sam; reg save HKLM\system), Volume Shadow Copy access, Mimikatz lsadump::sam, secretsdump.py, gsecdump, pwdump, and creddump7. Used by APT29, APT41, Daggerfly, GALLIUM, Wizard Spider, Ember Bear, Agrius, and ransomware operators universally. Combined with the SYSTEM hive, SAM allows offline hash extraction.

MITRE ATT&CK

Tactic
Credential Access
Technique
T1003 OS Credential Dumping
Sub-technique
T1003.002 Security Account Manager
Canonical reference
https://attack.mitre.org/techniques/T1003/002/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
let SAMRegistryDump = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "reg.exe"
| where ProcessCommandLine has_all ("save", "hklm\\sam") 
    or ProcessCommandLine has_all ("save", "hklm\\system")
    or ProcessCommandLine has_all ("save", "hklm\\security")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName;
let SAMShadowCopyAccess = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("esentutl.exe", "ntdsutil.exe")
| where ProcessCommandLine has_any ("sam", "ntds", "shadow")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName;
let MimikatzSAM = DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has_any ("lsadump::sam", "lsadump::cache", "sekurlsa::msv")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine;
let VSSForSAM = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "vssadmin.exe"
| where ProcessCommandLine has_any ("create shadow", "list shadows")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine;
union SAMRegistryDump, SAMShadowCopyAccess, MimikatzSAM, VSSForSAM
| sort by Timestamp desc
critical severity high confidence

Detects SAM database credential extraction via four vectors: (1) reg.exe saving HKLM\sam, HKLM\system, or HKLM\security hives, (2) esentutl/ntdsutil accessing SAM-related files, (3) Mimikatz lsadump::sam and related commands, and (4) vssadmin creating/listing shadow copies as precursor to SAM access.

Data Sources

Windows Registry: Registry Key AccessProcess: Process CreationCommand: Command Execution

Required Tables

DeviceProcessEvents

False Positives & Tuning

  • Authorized backup solutions using Volume Shadow Copy that may trigger vssadmin alerts
  • IT administrators performing registry backups as part of documented maintenance procedures
  • Incident response tools running forensic collection scripts that export SAM/SYSTEM hives
  • Antivirus or EDR agents performing system state backups
Download portable Sigma rule (.yml)

Other platforms for T1003.002


Testing Methodology

Validate this detection against 3 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.

  1. Test 1Export SAM and SYSTEM Registry Hives

    Expected signal: Sysmon Event ID 1: Process Create with Image=reg.exe, CommandLine containing 'save HKLM\sam'. Sysmon Event ID 11: FileCreate for atomic_sam.hiv and atomic_system.hiv. Security Event ID 4688 for reg.exe process creation.

  2. Test 2SAM Dump via Mimikatz lsadump::sam (Command Pattern)

    Expected signal: Sysmon Event ID 1: Process Create with CommandLine containing 'lsadump::sam'. Sysmon Event ID 10: ProcessAccess if Mimikatz attempts to access lsass.exe. Security Event ID 4688 for mimikatz.exe. Windows Defender may flag this as HackTool:Win32/Mimikatz.

  3. Test 3Create Volume Shadow Copy for SAM Access

    Expected signal: Sysmon Event ID 1: Process Create for vssadmin.exe with CommandLine 'create shadow /for=C:'. System Event Log: Event ID 8193/8194 for Volume Shadow Copy service events. Security Event ID 4688 for vssadmin.exe.

Unlock Pro Content

Get the full detection package for T1003.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections