Techniques
Sample rules
BITSAdmin Download File
- source: splunk
- technicques:
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.
Detection logic
| tstats `security_content_summariesonly`
count min(_time) as firstTime
max(_time) as lastTime
FROM datamodel=Endpoint.Processes WHERE
`process_bitsadmin`
Processes.process IN (
"*/addfile*",
"*/transfer*"
)
BY Processes.action Processes.dest Processes.original_file_name
Processes.parent_process Processes.parent_process_exec Processes.parent_process_guid
Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path
Processes.process Processes.process_exec Processes.process_guid
Processes.process_hash Processes.process_id Processes.process_integrity_level
Processes.process_name Processes.process_path Processes.user
Processes.user_id Processes.vendor_product
| `drop_dm_object_name(Processes)`
| where match(process, "(?i)(?:^
|\\s)/(?:transfer
|addfile)\\s")
AND
NOT match(process, "(?i)(?:^
|\\s)/upload(?:-reply)?(?:\\s
|$)")
| rex max_match=0 field=process "(?i)https?://(?:[^/\\s@]+@)?(?<bits_remote_host>\\[[0-9a-f:]+\\]
|[^/:\\s\"\\x27]+)"
| rex max_match=0 field=process "(?i)https?://[^\\s\"]+\"?\\s+(?<bits_local_path>\"[^\"]+\"
|\\S+)"
| eval bits_direct_ip=if(mvfind(bits_remote_host, "(?i)^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$
|^\\[[0-9a-f]*:[0-9a-f:]+\\]$")>=0, 1, 0),
bits_file_hosting=if(mvfind(bits_remote_host, "(?i)(^
|\\.)(?:github\\.com
|githubusercontent\\.com
|discordapp\\.com
|discordapp\\.net
|dropboxusercontent\\.com
|gofile\\.io
|mega\\.nz
|mediafire\\.com
|pastebin\\.com
|paste\\.ee
|transfer\\.sh
|temp\\.sh
|anonfiles\\.com
|storage\\.googleapis\\.com
|trycloudflare\\.com
|workers\\.dev
|pages\\.dev
|onrender\\.com
|supabase\\.co
|ddns\\.net
|ngrok-free\\.app)$")>=0, 1, 0)
| where isnotnull(bits_remote_host)
AND
(
bits_direct_ip=1
OR
bits_file_hosting=1
OR
(lower(process_name)!="bitsadmin.exe" AND lower(original_file_name)="bitsadmin.exe")
OR
mvcount(
mvfilter(
match(bits_local_path, "(?i)(?:\\\\(?:AppData\\\\(?:Local
|Roaming)
|Users\\\\Public
|ProgramData
|PerfLogs
|Temp
|Windows\\\\(?:Temp
|Tasks
|debug)
|\\$Recycle\\.Bin
|inetpub\\\\wwwroot)\\\\
|\\\\Start Menu\\\\Programs\\\\Startup\\\\
|%(?:temp
|tmp
|appdata
|localappdata
|programdata
|public)%\\\\)")
AND
match(bits_local_path, "(?i)\\.(?:exe
|dll
|com
|pif
|scr
|cpl
|msi
|msp
|ps1
|psm1
|bat
|cmd
|vbs
|vbe
|js
|jse
|wsf
|wsh
|sct
|hta
|chm
|xll
|aspx?
|ashx
|asmx
|jsp
|jspx
|war)\"?$")
)
)>0
)
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `bitsadmin_download_file_filter`