Detection rules › Splunk

SMB Write Access on Administrative Share (Windows Event Log)

Group by
_time, host
Source
github.com/anvilogic-forge/armory

SMB is a Windows file and printer sharing protocol. Threat actors may use SMB to connect to shared drives when moving laterally. An administrative share is a network share created by default on Windows systems for administrative purposes, allowing privileged users remote access to system resources, typically hidden from regular network users (denoted by $). Domain controllers may have administrative shares NETLOGON or SYSVOL. This use case detects SMB access attempts targeting Administrative shares with write access masks (0x2) from non-system accounts.

MITRE ATT&CK coverage

References

Event coverage

Rule body yaml

id: '24475.45119'
title: SMB Write Access on Administrative Share
description: SMB is a Windows file and printer sharing protocol. Threat actors may
  use SMB to connect to shared drives when moving laterally. An administrative share
  is a network share created by default on Windows systems for administrative purposes,
  allowing privileged users remote access to system resources, typically hidden from
  regular network users (denoted by $). Domain controllers may have administrative
  shares NETLOGON or SYSVOL. This use case detects SMB access attempts targeting Administrative
  shares with write access masks (0x2) from non-system accounts.
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=5145) OR
  "<EventID>5145<" OR TERM(EventCode=5140) OR "<EventID>5140<") "0x2" ("$" OR "SYSVOL"
  OR "NETLOGON") | rex "<Data Name=''ShareName''>(?<share_name>[^<]+)</Data>"| rex
  "<Data Name=''AccessMask''>(?<access_mask>[^<]+)"| where match(share_name, "(?i)(.*\$$)|NETLOGON|SYSVOL")
  and match(access_mask, "(?i)0x2") and not match(user, ".*\$$") | table _time, host,
  user process, process_*, parent_process_name, parent_process_path, share_name |
  bin span=1s | stats values(*) as * by _time, host '
techniques:
- lateral-movement:remote services:smb/windows admin shares
technique_id:
- T1021.002
data_category:
- Windows event logs
references:
- https://securitydatasets.com/notebooks/atomic/windows/lateral_movement/SDWIN-200806015757.html?highlight=create%20file

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=5145) OR "<EventID>5145<" OR TERM(EventCode=5140) OR "<EventID>5140<") "0x2" ("$" OR "SYSVOL" OR "NETLOGON")

Stage 2: rex

| rex "<Data Name='ShareName'>(?<share_name>[^<]+)</Data>"

Stage 3: rex

| rex "<Data Name='AccessMask'>(?<access_mask>[^<]+)"

Stage 4: where

| where match(share_name, "(?i)(.*\$$)|NETLOGON|SYSVOL") and match(access_mask, "(?i)0x2") and not match(user, ".*\$$")

Stage 5: table

| table _time, host, user process, process_*, parent_process_name, parent_process_path, share_name

Stage 6: bucket

| bin span=1s

Stage 7: stats

| stats values(*) as * by _time, host

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
usermatch".*\$$"

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventCodeeq
  • 5140 corpus 8 (splunk 8)
  • 5145 corpus 18 (splunk 16, kusto 2)
access_maskmatch
  • "(?i)0x2"
share_namematch
  • "(?i)(.*\$$)|NETLOGON|SYSVOL"

Search terms

Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.

StageTerm
1TERM
1"<EventID>5145<"
1TERM
1"<EventID>5140<"
1"0x2"
1"$"
1"SYSVOL"
1"NETLOGON"