BITSAdmin Download File

 Original Source: [splunk source]
Name:BITSAdmin Download File
id:80630ff4-8e4c-11eb-aab5-acde48001122
version:19
date:None
author:Michael Haag, Sittikorn S, Nasreddine Bencherchali, Splunk
status:production
type:TTP
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.
Data_source:
  • -Sysmon EventID 1
  • -Windows Event Log Security 4688
  • -CrowdStrike ProcessRollup2
search:| 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`


how_to_implement: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.
References:
  -https://github.com/redcanaryco/atomic-red-team/blob/8eb52117b748d378325f7719554a896e37bccec7/atomics/T1105/T1105.md#atomic-test-9---windows---bitsadmin-bits-download
  -https://github.com/redcanaryco/atomic-red-team/blob/bc705cb7aaa5f26f2d96585fac8e4c7052df0ff9/atomics/T1197/T1197.md
  -https://docs.microsoft.com/en-us/windows/win32/bits/bitsadmin-tool
  -https://thedfirreport.com/2021/03/29/sodinokibi-aka-revil-ransomware/
  -https://github.com/redcanaryco/atomic-red-team/blob/388942adbd9641f4dfdcf079d7efe9a75ec0ac43/atomics/T1105/T1105.yaml#L236
  -https://cert-agid.gov.it/news/campagna-sload-v-2-9-3-veicolata-via-pec/
drilldown_searches:
 name:'View the detection results for - "$user$" and "$dest$"'
 search:'%original_detection_search% | search user = "$user$" dest = "$dest$"'
 earliest_offset:'$info_min_time$'
 latest_offset:'$info_max_time$'
 name:'View risk events for the last 7 days for - "$user$" and "$dest$"'
 search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$user$", "$dest$") | 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'
analytic_story:['Ingress Tool Transfer', 'BITS Jobs', 'DarkSide Ransomware', 'Living Off The Land', 'Flax Typhoon', 'Gozi Malware', 'Scattered Spider', 'APT37 Rustonotto and FadeStealer', 'GhostRedirector IIS Module and Rungan Backdoor', 'Hellcat Ransomware']

asset_type:Endpoint

mitre_attack_id:['T1197', 'T1105']

product:['Splunk Enterprise', 'Splunk Enterprise Security', 'Splunk Cloud']

category:endpoint

security_domain:endpoint

tags:

tests:
 name:'True Positive Test - Sysmon'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1197/atomic_red_team/windows-sysmon.log
  source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
  sourcetype: XmlWinEventLog
 test_type:'unit'
 name:'True Positive Test - CrowdStrike'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1197/atomic_red_team/crowdstrike_falcon.log
  source: crowdstrike
  sourcetype: crowdstrike:events:sensor
 test_type:'unit'
manual_test:None