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 |
References
Telemetry coverage
Rule body
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
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user | regex_match | ".*$$" | excludes:user |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
EventCode | eq |
| field:"EventID" kind:eq |
access_mask | regex_match |
| field:"access_mask" kind:regex_match |
share_name | regex_match |
| field:"share_name" kind:regex_match |
Search terms
These SPL tokens match against raw event text.
| Stage | Term |
|---|---|
| 1 | "<EventID>5145<" |
| 1 | "<EventID>5140<" |
| 1 | "0x2" |
| 1 | "$" |
| 1 | "SYSVOL" |
| 1 | "NETLOGON" |