Detection rules › Splunk
SMB Write Access on Administrative Share (Windows Event Log)
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
| Tactic | Techniques |
|---|---|
| Lateral Movement | T1021.002 Remote Services: SMB/Windows Admin Shares |
References
Event coverage
| Provider | Event | Title |
|---|---|---|
| Security-Auditing | Event ID 5140 | A network share object was accessed. |
| Security-Auditing | Event ID 5145 | A network share object was checked to see whether client can be granted desired access. |
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.
| Field | Kind | Excluded values |
|---|---|---|
user | match | ".*\$$" |
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.
| Field | Kind | Values |
|---|---|---|
EventCode | eq |
|
access_mask | match |
|
share_name | match |
|
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.
| Stage | Term |
|---|---|
| 1 | TERM |
| 1 | "<EventID>5145<" |
| 1 | TERM |
| 1 | "<EventID>5140<" |
| 1 | "0x2" |
| 1 | "$" |
| 1 | "SYSVOL" |
| 1 | "NETLOGON" |