Detecting Windows BITS abuse
Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through Component Object Model (COM). BITS is commonly used by updaters, messengers, and other applications which prefer to operate in the background (using available idle bandwidth) without interrupting other networked applications. File transfer tasks are implemented as BITS jobs, which contain a queue of one or more file operations. The interface to create and manage BITS jobs is accessible through PowerShell and the BITSAdmin tool.
Attackers may abuse BITS to download, execute, and clean up after running malicious code. BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and are often permitted by host firewalls. BITS-enabled execution may also enable persistence by creating long-standing jobs, since the default maximum lifetime is 90 days and extendable, or invoking an arbitrary program when a job completes or errors, including after system reboots.
These searches allow you to detect and investigate unusual activities that might indicate BITS abuse.
Required data
- Endpoint data with information on process that includes the name of the process responsible for the changes from your endpoints. Use this data to populate the Processes node of the Endpoint data model in the Common Information Model (CIM). For information on installing and using the CIM, see the Common Information Model documentation.
How to use Splunk software for this use case
- ► BITS job persistence
-
This search identifies Microsoft Background Intelligent Transfer Service utility bitsadmin.exe scheduling a BITS job to persist on an endpoint. The search includes the parameters used to create, resume or add a file to a BITS job, which are typically seen combined in single line or ran in sequence.
If you identify potentially suspicious results from this search, review the BITS job created and capture any files written to disk. It is possible for BITS to be used to upload files and this might require further network data analysis to identify. Any further filtering should be done based on command-line arguments (legitimate applications) or parent process.
| tstats summariesonly=false allow_old_summaries=true count, min(_time) AS firstTime, max(_time) AS lastTime FROM datamodel=Endpoint.Processes WHERE (("Processes.process_name"=bitsadmin.exe OR "Processes.original_file_name"=bitsadmin.exe) ("Processes.process"=*create* OR "Processes.process"=*addfile* OR "Processes.process"=*setnotifyflags* OR "Processes.process"=*setnotifycmdline* OR "Processes.process"=*setminretrydelay* OR "Processes.process"=*setcustomheaders* OR "Processes.process"=*resume*)) BY "Processes.dest", "Processes.user", "Processes.original_file_name", "Processes.parent_process", "Processes.process_name", "Processes.process", "Processes.process_id", "Processes.parent_process_id" | rename "Processes.*" AS "*" | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime(firstTime) | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime(lastTime)
- ► BITSAdmin download file
-
This search identifies Microsoft Background Intelligent Transfer Service utility bitsadmin.exe using the
transfer
parameter to download a remote object.If you identify potentially suspicious results from this search, look for
download
orupload
on the command line. Capture any files downloaded and review the reputation of the IP or domain used. Usually, once executed, a follow-on command will be used to execute the dropped file. Related network connection or file modification events will not spawn or create from bitsadmin.exe, but the artifacts will appear in a parallel process of svchost.exe with a command-line similar to svchost.exe-k netsvcs -s BITS
. It's important to review all parallel and child processes to capture any behaviors and artifacts.False positives from this search should be limited. However, you might need to filter based on parent process name or network connection.
| tstats summariesonly=false allow_old_summaries=true count, min(_time) AS firstTime, max(_time) AS lastTime FROM datamodel=Endpoint.Processes WHERE (("Processes.process_name"=bitsadmin.exe OR "Processes.original_file_name"=bitsadmin.exe) "Processes.process"=*transfer*) BY "Processes.dest", "Processes.user", "Processes.parent_process", "Processes.original_file_name", "Processes.process_name", "Processes.process", "Processes.process_id", "Processes.parent_process_id" | rename "Processes.*" AS "*" | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime(firstTime) | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime(lastTime)
- ► PowerShell Start-BITSTransfer
-
Start-BitsTransfer is the PowerShell variation of BitsAdmin.exe, which has similar functionality. This technique variation is not commonly used by attackers, but has been seen to be abused. Lesser known uses include the ability to set the
-TransferType
toUpload
for the exfiltration of files. In an instance whereUpload
is used, it is possible files will be archived.If you identify potentially suspicious results from this search, review parallel processes and process lineage, as well as capturing any files on disk for review. You'll need to review the reputation of the remote domain or IP in order to decide if you're seeing malicious actions.
| tstats summariesonly=false allow_old_summaries=true count, min(_time) AS firstTime, max(_time) AS lastTime FROM datamodel=Endpoint.Processes WHERE (("Processes.process_name"=pwsh.exe OR "Processes.process_name"=sqlps.exe OR "Processes.process_name"=sqltoolsps.exe OR "Processes.process_name"=powershell.exe OR "Processes.process_name"=powershell_ise.exe OR "Processes.original_file_name"=pwsh.dll OR "Processes.original_file_name"=PowerShell.EXE OR "Processes.original_file_name"=powershell_ise.EXE) "Processes.process"=*start-bitstransfer*) BY "Processes.dest", "Processes.user", "Processes.parent_process", "Processes.process_name", "Processes.process", "Processes.process_id", "Processes.original_file_name", "Processes.parent_process_id" | rename "Processes.*" AS "*" | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime(firstTime) | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime(lastTime)
- Next steps
The content in this article comes from Splunk Enterprise Security (ES). As a Splunk premium security solution, ES solves a wide range of security analytics and operations use cases including continuous security monitoring, advanced threat detection, compliance, incident investigation, forensics and incident response. Splunk ES delivers an end-to-end view of an organization's security posture with flexible investigations, unmatched performance, and the most flexible deployment options offered in the cloud, on-premises, or hybrid deployment models. If you have questions about this use case, see the Security Research team's support options on GitHub.
In addition, these Splunk resources might help you understand and implement this use case: