Detection rules › YARA-L

MITRE ATT&CK T1003.003 WMIC Ntds.dit CISA Report

Severity
high
Type
alert
Time window
5m
Match by
hostname
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

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

TacticTechniques
Credential AccessT1003.003 OS Credential Dumping: NTDS

References

Event coverage

Rule body yaral

/*
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

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
}

Detection logic

Fires when at least one $process event in the 5m window.

Events

$process PROCESS_LAUNCH (1, 11, 216, 325, 326, 327, 4688)

  • 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_type = "216" or "325" or "326" or "327"

Correlation

Match key
$hostname (principal.hostname)
Within
5m

Outcome

Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.

FieldExpression
risk_score85
event_countcount_distinct($process.metadata.id)
principal_process_pidarray_distinct($process.principal.process.pid)
principal_process_command_linearray_distinct($process.principal.process.command_line)
principal_process_file_sha256array_distinct($process.principal.process.file.sha256)
principal_process_file_full_patharray_distinct($process.principal.process.file.full_path)
principal_process_product_specific_process_idarray_distinct($process.principal.process.product_specific_process_id)
principal_process_parent_process_product_specific_process_idarray_distinct($process.principal.process.parent_process.product_specific_process_id)
target_process_pidarray_distinct($process.target.process.pid)
target_process_command_linearray_distinct($process.target.process.command_line)
target_process_file_sha256array_distinct($process.target.process.file.sha256)
target_process_file_full_patharray_distinct($process.target.process.file.full_path)
target_process_product_specific_process_idarray_distinct($process.target.process.product_specific_process_id)
principal_user_useridarray_distinct($process.principal.user.userid)