Detection rules › YARA-L

YARA-L rules: 2q

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 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 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 is one of:
    • 216
    • 325
    • 326
    • 327

Match and Correlation

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

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

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)

O365 Entra ID Application Creation

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

Application creation is a legitimate activity but doesn't occur frequently. Alerts when a new application is created in Entra ID (formerly Azure AD).

Telemetry Coverage

PlatformRecord / event type
Microsoft 365Add application.

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

// Copyright 2023 Google LLC. Licensed under Apache-2.0.

rule o365_entra_id_application_creation {

  meta:
    author = "Google Cloud Security"
    description = "Application creation is a legitimate activity but doesn't occur frequently. Alerts when a new application is created in Entra ID (formerly Azure AD)."
    rule_id = "mr_c8daf9ab-2b39-46cc-bda9-7fd1ebb13a81"
    rule_name = "O365 Entra ID Application Creation"
    type = "alert"
    platform = "azure"
    data_source = "o365"
    severity = "Low"
    priority = "Medium"

  events:
    $app.metadata.event_type = "USER_RESOURCE_CREATION"
    $app.metadata.product_name = "Office 365"
    $app.metadata.vendor_name = "Microsoft"
    $app.metadata.product_event_type = "Add application."
    $app.security_result.action = "ALLOW"
    //These events should have a userid associated with them but in case they don't we will match on the app name being created instead
    strings.coalesce($app.principal.user.userid, $app.target.resource.name) = $user_or_resource

  match:
    $user_or_resource over 5m

  outcome:
    $risk_score = 35
    $event_count = count_distinct($app.metadata.id)
    $target_application = array_distinct($app.target.application)
    $security_summary = array_distinct($app.security_result.summary)
    $user_agent = array_distinct($app.network.http.user_agent)
    //added to populate alert graph with additional context
    $principal_user_userid = array_distinct($app.principal.user.userid)
    $target_resource_name = array_distinct($app.target.resource.name)

  condition:
    $app
}

YARA-L Rule Structure

Condition

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

Events

$app USER_RESOURCE_CREATION

  • metadata.product_event_type = "Add application."
  • security_result.action = "ALLOW"

Match and Correlation

Match key
$user_or_resource
Within
5m

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
risk_score35
event_countcount_distinct($app.metadata.id)
target_applicationarray_distinct($app.target.application)
security_summaryarray_distinct($app.security_result.summary)
user_agentarray_distinct($app.network.http.user_agent)
principal_user_useridarray_distinct($app.principal.user.userid)
target_resource_namearray_distinct($app.target.resource.name)

sap multiple password changes

#
Severity
medium
Time window
3h
Match by
source_user
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects multiple password changes (BU2) by a single actor or targeting a single user across systems.

MITRE ATT&CK Coverage

TacticTechniques
Privilege Escalation

Rule Body

// Copyright 2026 Google LLC. Licensed under Apache-2.0.

rule sap_multiple_password_changes {

  meta:
    author = "Google Cloud Security"
    description = "Detects multiple password changes (BU2) by a single actor or targeting a single user across systems."
    severity = "Medium"
    tactic = "TA0004"
    technique = "T1098"

  events:
    $e.metadata.product_name = "SAP security audit"

    $e.additional.fields["msg_1"] = "BU2"

    $source_user = $e.principal.user.userid
    $target_user = $e.additional.fields["param2_1"]
    $client = $e.target.resource.attribute.labels["slgmand_1"]

  match:
    $source_user over 3h

  outcome:
    $total_changes = count($e.metadata.product_log_id)
    $distinct_targets = count_distinct($target_user)
    $distinct_clients = count_distinct($client)
    $admin_email = array_distinct($e.principal.user.email_addresses)
    $target_users = array_distinct($target_user)
    $terminal_ips = array_distinct($e.principal.ip)

  condition:
    #e >= 3 or #target_user >= 3
}

YARA-L Rule Structure

Condition

Fires when $e occurs at least 3 times in the 3h window or $target_user occurs at least 3 times in the 3h window.

Events

$e

  • additional.fields["msg_1"] = "BU2"

Match and Correlation

Match key
$source_user
Within
3h

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
total_changescount($e.metadata.product_log_id)
distinct_targetscount_distinct($target_user)
distinct_clientscount_distinct($client)
admin_emailarray_distinct($e.principal.user.email_addresses)
target_usersarray_distinct($target_user)
terminal_ipsarray_distinct($e.principal.ip)

Back to all YARA-L rules