Detection: Windows Alternate Data Stream Created Over Local Share

Description

The following analytic detects the creation of an NTFS alternate data stream (ADS) accessed over a local administrative share targeting the loopback address (127.0.0.1). It leverages Windows Security Event Logs with EventCode 5145 to identify this activity. Legitimate local processes access files directly rather than through a local SMB share. This behavior is a hallmark of the ShieldBreak exploit, which abuses a symbolic link swap through a loopback share to redirect a privileged, Defender-driven write into an alternate data stream on a system-owned file, ultimately landing attacker content in C:\Windows\System32. If confirmed malicious, this activity indicates an in-progress local privilege escalation attempt and should be investigated immediately.

 1`wineventlog_security`
 2EventCode=5145
 3IpAddress="127.0.0.1"
 4ObjectType="File"
 5
 6| regex RelativeTargetName="(?i)\:\w+$"
 7
 8| fillnull
 9
10| rename IpAddress as dest_ip
11
12| stats count min(_time) as firstTime
13              max(_time) as lastTime
14  by dest dest_ip
15     ShareName ShareLocalPath RelativeTargetName
16     AccessMask src_user
17
18| `security_content_ctime(firstTime)`
19
20| `security_content_ctime(lastTime)`
21
22| `windows_alternate_data_stream_created_over_local_share_filter`

Data Source

Name Platform Sourcetype Source
Windows Event Log Security 5145 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Security'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_alternate_data_stream_created_over_local_share_filter search *
windows_alternate_data_stream_created_over_local_share_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1021.002 SMB/Windows Admin Shares Lateral Movement
T1564.004 NTFS File Attributes Stealth
Exploitation
DE.AE
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Finding (Notable) No
Creates Intermediate Finding (Risk Event) Yes
Anomaly detections generate Intermediate Findings (Risk Events). They do not generate a Finding (Notable) directly.

Implementation

To successfully implement this search, you need to be ingesting Windows Security Event Logs with EventCode 5145 enabled. The Windows TA is also required. Enable Object Access auditing (success/failure) for File Share in group policy so that RelativeTargetName and IpAddress are populated.

Known False Positives

Backup, replication, or file-sync software may occasionally write alternate data streams over administrative shares. Loopback (127.0.0.1) access to a local share is rare for legitimate software, tune by ShareName or src_user as needed for your environment.

Associated Analytic Story

Intermediate Findings

Message Entity Field Entity Type Risk Score
An alternate data stream $RelativeTargetName$ was created over a loopback local share on $dest$ dest system 20

Threat Objects

Field Type
src_user user
RelativeTargetName file_path
dest system

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset XmlWinEventLog:Security XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Security XmlWinEventLog

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub |

Version: 1