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.

Raw source High Frequency Copy Of Files In Network Share · SPL
Esc
Published by splunk/security_content ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
name: High Frequency Copy Of Files In Network Share
id: 40925f12-4709-11ec-bb43-acde48001122
version: 11
creation_date: '2021-11-17'
modification_date: '2026-08-05'
author: Teoderick Contreras, Splunk
status: production
type: Anomaly
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.
data_source:
    - Windows Event Log Security 5145
search: |-
    `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`
how_to_implement: |-
    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.
references:
    - https://attack.mitre.org/techniques/T1537/
    - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-5145#table-of-file-access-codes
drilldown_searches:
    - name: View the detection results for - "$src_user$"
      search: '%original_detection_search% | search  src_user = "$src_user$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$src_user$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$src_user$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
      earliest_offset: 7d
      latest_offset: "0"
intermediate_findings:
    entities:
        - field: src_user
          type: user
          score: 20
          message: High frequency copy of file [$valRelativeTargetName$] into a network share from [$src_ip$] by [$src_user$]
threat_objects:
    - field: src_ip
      type: ip_address
analytic_story:
    - Information Sabotage
    - Insider Threat
    - Hellcat Ransomware
asset_type: Endpoint
mitre_attack_id:
    - T1537
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: endpoint
security_domain: endpoint
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1537/high_frequency_copy_of_files_in_network_share/windows-xml.log
          source: XmlWinEventLog:Security
          sourcetype: XmlWinEventLog
      test_type: unit

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.