Detection: BITSAdmin Download File

Description

The following analytic detects BITSAdmin /Transfer or /AddFile commands containing an HTTP or HTTPS URL and a suspicious transfer characteristic such as a literal IPv4 or bracketed IPv6 URL host, a file-sharing or hosted-content domain, an executable or script destination in a commonly abused staging directory, or a renamed BITSAdmin executable identified by its original file name. Explicit /Upload and /Upload-Reply commands are excluded. /AddFile can belong to either a download or upload job, confirm the job type before assigning direction. Investigate process ancestry, the remote resource, destination artifacts and later execution. A matching command is an attempted transfer, not proof of a completed download or malicious intent.

  1
  2| tstats `security_content_summariesonly`
  3  count min(_time) as firstTime
  4        max(_time) as lastTime
  5
  6FROM datamodel=Endpoint.Processes WHERE
  7
  8`process_bitsadmin`
  9Processes.process IN (
 10    "*/addfile*",
 11    "*/transfer*"
 12)
 13
 14BY Processes.action Processes.dest Processes.original_file_name
 15   Processes.parent_process Processes.parent_process_exec Processes.parent_process_guid
 16   Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path
 17   Processes.process Processes.process_exec Processes.process_guid
 18   Processes.process_hash Processes.process_id Processes.process_integrity_level
 19   Processes.process_name Processes.process_path Processes.user
 20   Processes.user_id Processes.vendor_product
 21
 22
 23| `drop_dm_object_name(Processes)`
 24
 25
 26| where match(process, "(?i)(?:^
 27|\\s)/(?:transfer
 28|addfile)\\s")
 29        AND
 30        NOT match(process, "(?i)(?:^
 31|\\s)/upload(?:-reply)?(?:\\s
 32|$)")
 33
 34
 35| rex max_match=0 field=process "(?i)https?://(?:[^/\\s@]+@)?(?<bits_remote_host>\\[[0-9a-f:]+\\]
 36|[^/:\\s\"\\x27]+)"
 37
 38| rex max_match=0 field=process "(?i)https?://[^\\s\"]+\"?\\s+(?<bits_local_path>\"[^\"]+\"
 39|\\S+)"
 40
 41
 42| eval bits_direct_ip=if(mvfind(bits_remote_host, "(?i)^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$
 43|^\\[[0-9a-f]*:[0-9a-f:]+\\]$")>=0, 1, 0),
 44       bits_file_hosting=if(mvfind(bits_remote_host, "(?i)(^
 45|\\.)(?:github\\.com
 46|githubusercontent\\.com
 47|discordapp\\.com
 48|discordapp\\.net
 49|dropboxusercontent\\.com
 50|gofile\\.io
 51|mega\\.nz
 52|mediafire\\.com
 53|pastebin\\.com
 54|paste\\.ee
 55|transfer\\.sh
 56|temp\\.sh
 57|anonfiles\\.com
 58|storage\\.googleapis\\.com
 59|trycloudflare\\.com
 60|workers\\.dev
 61|pages\\.dev
 62|onrender\\.com
 63|supabase\\.co
 64|ddns\\.net
 65|ngrok-free\\.app)$")>=0, 1, 0)
 66
 67
 68| where isnotnull(bits_remote_host)
 69        AND
 70        (
 71            bits_direct_ip=1
 72            OR
 73            bits_file_hosting=1
 74            OR
 75            (lower(process_name)!="bitsadmin.exe" AND lower(original_file_name)="bitsadmin.exe")
 76            OR
 77            mvcount(
 78                mvfilter(
 79                    match(bits_local_path, "(?i)(?:\\\\(?:AppData\\\\(?:Local
 80|Roaming)
 81|Users\\\\Public
 82|ProgramData
 83|PerfLogs
 84|Temp
 85|Windows\\\\(?:Temp
 86|Tasks
 87|debug)
 88|\\$Recycle\\.Bin
 89|inetpub\\\\wwwroot)\\\\
 90|\\\\Start Menu\\\\Programs\\\\Startup\\\\
 91|%(?:temp
 92|tmp
 93|appdata
 94|localappdata
 95|programdata
 96|public)%\\\\)")
 97                    AND
 98                    match(bits_local_path, "(?i)\\.(?:exe
 99|dll
100|com
101|pif
102|scr
103|cpl
104|msi
105|msp
106|ps1
107|psm1
108|bat
109|cmd
110|vbs
111|vbe
112|js
113|jse
114|wsf
115|wsh
116|sct
117|hta
118|chm
119|xll
120|aspx?
121|ashx
122|asmx
123|jsp
124|jspx
125|war)\"?$")
126                )
127            )>0
128        )
129
130
131| `security_content_ctime(firstTime)`
132
133| `security_content_ctime(lastTime)`
134
135| `bitsadmin_download_file_filter`

Data Source

Name Platform Sourcetype Source
Windows Event Log Security 4688 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Security'
CrowdStrike ProcessRollup2 Other 'crowdstrike:events:sensor' 'crowdstrike'
Sysmon EventID 1 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'

Macros Used

Name Value
security_content_summariesonly summariesonly=summariesonly_config allow_old_summaries=oldsummaries_config fillnull_value=fillnull_config``
bitsadmin_download_file_filter search *
bitsadmin_download_file_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

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) Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Intermediate Finding (Risk Event) Yes
TTP detections generate a Finding (Notable) and may generate Intermediate Findings (Risk Events) for associated entities.

Implementation

The detection is based on data that originates from Endpoint Detection and Response (EDR) agents. These agents are designed to provide security-related telemetry from the endpoints where the agent is installed. To implement this search, you must ingest logs that contain the process GUID, process name, and parent process. Additionally, you must ingest complete command-line executions. These logs must be processed using the appropriate Splunk Technology Add-ons that are specific to the EDR product. The logs must also be mapped to the Processes node of the Endpoint data model. Use the Splunk Common Information Model (CIM) to normalize the field names and speed up the data modeling process.

Known False Positives

Software deployment, package installation and authorized tests can transfer content from literal IPs or public hosting and stage executable files.

Associated Analytic Story

Finding

Title Entity Field Entity Type Risk Score
An instance of [$parent_process_name$] spawning [$process_name$] was identified on endpoint [$dest$] by user [$user$] attempting a suspicious BITS file transfer with command line [$process$]. user user 50

Intermediate Findings

Message Entity Field Entity Type Risk Score
An instance of [$parent_process_name$] spawning [$process_name$] was identified on endpoint [$dest$] by user [$user$] attempting a suspicious BITS file transfer with command line [$process$]. dest system 50

Threat Objects

Field Type
parent_process_name parent_process_name
process_name process_name

References

Atomic Tests

Learn more about Atomic Red Team tests here.

Atomic Test ID Atomic Test Name Supported Platform
a1921cd3-9a2d-47d5-a891-f1d0f2a7a31b Windows - BITSAdmin BITS Download Windows

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation ✅ Passing N/A N/A N/A
Unit ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational 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: 19