Detection rules › YARA-L
MITRE ATT&CK T1003.003 WMIC Ntds.dit CISA Report
Detects extraction of ntds.dit file using vssadmin.exe or ntdsutil.exe with wmic as identified in CISA Living off the Land pdf
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
References
Telemetry coverage
Rule body
// Copyright 2023 Google LLC. Licensed under Apache-2.0.
rule wmic_ntds_dit_T1003_003_cisa_report {
meta:
author = "Google Cloud Security"
description = "Detects extraction of ntds.dit file using vssadmin.exe or ntdsutil.exe with wmic as identified in CISA Living off the Land pdf"
rule_id = "mr_b1719d37-6689-485d-b80c-b509fdaa1af8"
rule_name = "MITRE ATT&CK T1003.003 WMIC Ntds.dit CISA Report"
type = "alert"
platform = "Windows"
data_source = "microsoft sysmon, windows event logs"
tactic = "TA0006"
technique = "T1003.003"
reference = "https://media.defense.gov/2023/May/24/2003229517/-1/-1/0/CSA_Living_off_the_Land.PDF"
severity = "High"
priority = "High"
events:
(
$process.metadata.event_type = "PROCESS_LAUNCH" and
(
// cisa report referenced cmd /c in their report throughout, can filter this in/out for tuning as needed
// other wmic switches like /user and /password, these have been excluded to focus on the commands being issued since local access does not require these
re.regex($process.target.process.command_line, `(|cmd.*/c).*wmic.*process.*call.*create.*ntdsutil.*create.*full`) nocase or
// for greater precision to align with the report, the following line can be used instead of the previous line to focus on specific folders referenced
//re.regex($process.target.process.command_line, `(|cmd.*/c).*wmic.*process.*call.*create.*ntdsutil.*create.*full.*windows\\temp\\(tmp|pro|msafee_logs)`) nocase or
re.regex($process.target.process.command_line, `(|cmd.*/c).*vssadmin.*create.*shadow`) nocase or
// To detect this without wmic being used but written to c:\windows\temp\ in general
re.regex($process.target.process.command_line, `(|cmd.*/c).*ntdsutil.*create.*full.*windows\\temp\\`) nocase
)
)
or
(
// This does not detect one of the utilities responsible for executing ntdsutil or vssadmin, but does detect .dit file being created in monitored folders
$process.metadata.event_type = "FILE_CREATION" and
re.regex($process.target.file.full_path, `\.dit$`) nocase
)
or
(
//Identify application event log actions associated with the creation of the ntds.dit file and with ntds database
$process.metadata.product_name = "ESENT" and
$process.metadata.vendor_name = "Microsoft" and
(
$process.metadata.product_event_type = "216" or
$process.metadata.product_event_type = "325" or
$process.metadata.product_event_type = "326" or
$process.metadata.product_event_type = "327"
)
)
$process.principal.hostname = $hostname
match:
$hostname over 5m
outcome:
$risk_score = 85
$event_count = count_distinct($process.metadata.id)
// added to populate alert graph with additional context
// Commented out principal.hostname because it is already represented in graph as match variable. If match changes, can uncomment to add to results
//$principal_hostname = array_distinct($process.principal.hostname)
$principal_process_pid = array_distinct($process.principal.process.pid)
$principal_process_command_line = array_distinct($process.principal.process.command_line)
$principal_process_file_sha256 = array_distinct($process.principal.process.file.sha256)
$principal_process_file_full_path = array_distinct($process.principal.process.file.full_path)
$principal_process_product_specific_process_id = array_distinct($process.principal.process.product_specific_process_id)
$principal_process_parent_process_product_specific_process_id = array_distinct($process.principal.process.parent_process.product_specific_process_id)
$target_process_pid = array_distinct($process.target.process.pid)
$target_process_command_line = array_distinct($process.target.process.command_line)
$target_process_file_sha256 = array_distinct($process.target.process.file.sha256)
$target_process_file_full_path = array_distinct($process.target.process.file.full_path)
$target_process_product_specific_process_id = array_distinct($process.target.process.product_specific_process_id)
$principal_user_userid = array_distinct($process.principal.user.userid)
condition:
$process
}
YARA-L rule structure
Condition
Fires when at least one $process event in the 5m window.
Events
$process
target.process.command_line matches "(|cmd.*/c).*wmic.*process.*call.*create.*ntdsutil.*create.*full"target.process.command_line matches "(|cmd.*/c).*vssadmin.*create.*shadow"target.process.command_line matches "(|cmd.*/c).*ntdsutil.*create.*full.*windows\\temp\\"target.file.full_path matches "\.dit$"metadata.product_event_typeis one of:216325326327
Match and correlation
Outcome
Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.
| Field | Expression |
|---|---|
risk_score | 85 |
event_count | count_distinct($process.metadata.id) |
principal_process_pid | array_distinct($process.principal.process.pid) |
principal_process_command_line | array_distinct($process.principal.process.command_line) |
principal_process_file_sha256 | array_distinct($process.principal.process.file.sha256) |
principal_process_file_full_path | array_distinct($process.principal.process.file.full_path) |
principal_process_product_specific_process_id | array_distinct($process.principal.process.product_specific_process_id) |
principal_process_parent_process_product_specific_process_id | array_distinct($process.principal.process.parent_process.product_specific_process_id) |
target_process_pid | array_distinct($process.target.process.pid) |
target_process_command_line | array_distinct($process.target.process.command_line) |
target_process_file_sha256 | array_distinct($process.target.process.file.sha256) |
target_process_file_full_path | array_distinct($process.target.process.file.full_path) |
target_process_product_specific_process_id | array_distinct($process.target.process.product_specific_process_id) |
principal_user_userid | array_distinct($process.principal.user.userid) |