High Frequency Copy Of Files In Network Share
Description
The following analytic detects a high frequency of file copying or moving within network shares, which may indicate potential data sabotage or exfiltration attempts. It leverages Windows Security Event Logs (EventCode 5145) to monitor access to specific file types and network shares. This activity is significant as it can reveal insider threats attempting to transfer classified or internal files, potentially leading to data breaches or evidence tampering. If confirmed malicious, this behavior could result in unauthorized data access, data loss, or compromised sensitive information.
Query · spl
`wineventlog_security`
EventCode=5145
RelativeTargetName IN (
"*.7z", "*.bmp", "*.db", "*.doc", "*.docx",
"*.gif", "*.gz", "*.jpg", "*.key", "*.log",
"*.pdf", "*.png", "*.ppt", "*.pptx", "*.rar",
"*.rtf", "*.tar", "*.txt", "*.xls", "*.xlsx", "*.zip"
)
ObjectType=File
ShareName IN (
"\\\\*\\Admin$",
"\\\\*\\C$",
"\\\\*\\IPC$"
)
| eval AccessMask_ = tonumber(AccessMask, 16)
```
We Select only write-related operations:
0x2 = WriteData (create/write file)
0x4 = AppendData (append to file)
```
| where (bit_and(AccessMask_, 2) != 0) OR (bit_and(AccessMask_, 4) != 0)
| bucket _time span=5m
```
Count write events per host, user and source IP within each time window
```
| stats
values(RelativeTargetName) AS valRelativeTargetName
values(ShareName) AS valShareName
values(ObjectType) AS valObjectType
values(AccessMask) AS valAccessMask
values(src_port) AS valSrcPort
values(SourceAddress) AS valSrcAddress
count AS numFileWriteEvents
BY dest _time EventCode src_user src_ip
```
Build a historical baseline for each destination host and user
using the average and standard deviation of previous buckets
```
| eventstats
avg(numFileWriteEvents) AS avgFileWriteEvents
stdev(numFileWriteEvents) AS stdFileWriteEvents
count AS numSlots
BY dest EventCode src_user
| eval upperThreshold=avgFileWriteEvents + (stdFileWriteEvents * 3)
| eval isOutlier=if(
numFileWriteEvents > 20
AND (
numSlots < 5
OR numFileWriteEvents >= upperThreshold
),
1,
0
)
| where isOutlier=1
| `high_frequency_copy_of_files_in_network_share_filter`
Implementation guide
To successfully implement this search, you need to be ingesting Windows Security Event Logs with 5145 EventCode enabled. The Windows TA is also required. Also enable the object Audit access success/failure in your group policy.
Known false positives
- This behavior may be seen in normal transfer of files within a network if network shares are commonly used for sharing documents.
Analyst notes
Known false positives: This behavior may be seen in normal transfer of files within a network if network shares are commonly used for sharing documents.