BITS Jobs

Adversaries may abuse BITS jobs to persistently execute code and perform various background tasks. Windows Background Intelligent Transfer Service (BITS) is a low-bandwidth, asynchronous file transfer mechanism exposed through Component Object Model (COM).[1][2] BITS is commonly used by updaters, messengers, and other applications preferred 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.[2][3]

Adversaries may abuse BITS to download (e.g. Ingress Tool Transfer), execute, and even clean up after running malicious code (e.g. Indicator Removal). BITS tasks are self-contained in the BITS job database, without new files or registry modifications, and often permitted by host firewalls.[4][5][6] BITS enabled execution may also enable persistence by creating long-standing jobs (the default maximum lifetime is 90 days and extendable) or invoking an arbitrary program when a job completes or errors (including after system reboots).[7][4]

BITS upload functionalities can also be used to perform Exfiltration Over Alternative Protocol.[4]

ID: T1197
Sub-techniques:  No sub-techniques
Platforms: Windows
Defense Bypassed: Firewall, Host forensic analysis
Contributors: Brent Murphy, Elastic; David French, Elastic; Red Canary; Ricardo Dias
Version: 1.4
Created: 18 April 2018
Last Modified: 21 April 2023

Procedure Examples

ID Name Description
G0087 APT39

APT39 has used the BITS protocol to exfiltrate stolen data from a compromised host.[8]

G0096 APT41

APT41 used BITSAdmin to download and install payloads.[9][10]

S0534 Bazar

Bazar has been downloaded via Windows BITS functionality.[11]

S0190 BITSAdmin

BITSAdmin can be used to create BITS Jobs to launch a malicious process.[12]

S0154 Cobalt Strike

Cobalt Strike can download a hosted "beacon" payload using BITSAdmin.[13][14][15]

S0554 Egregor

Egregor has used BITSadmin to download and execute malicious DLLs.[16]

S0201 JPIN

A JPIN variant downloads the backdoor payload via the BITS service.[17]

G0065 Leviathan

Leviathan has used BITSAdmin to download additional tools.[18]

S0652 MarkiRAT

MarkiRAT can use BITS Utility to connect with the C2 server.[19]

G0040 Patchwork

Patchwork has used BITS jobs to download malicious payloads.[20]

S0654 ProLock

ProLock can use BITS jobs to download its malicious payload.[21]

S0333 UBoatRAT

UBoatRAT takes advantage of the /SetNotifyCmdLine option in BITSAdmin to ensure it stays running on a system to maintain persistence.[7]

G0102 Wizard Spider

Wizard Spider has used batch scripts that utilizes WMIC to execute a BITSAdmin transfer of a ransomware payload to each compromised machine.[22]

Mitigations

ID Mitigation Description
M1037 Filter Network Traffic

Modify network and/or host firewall rules, as well as other network controls, to only allow legitimate BITS traffic.

M1028 Operating System Configuration

Consider reducing the default BITS job lifetime in Group Policy or by editing the JobInactivityTimeout and MaxDownloadTime Registry values in HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\BITS.[2]

M1018 User Account Management

Consider limiting access to the BITS interface to specific users or groups.[6]

Detection

ID Data Source Data Component Detects
DS0017 Command Command Execution

Monitor executed commands and arguments from the BITSAdmin tool (especially the ‘Transfer’, 'Create', 'AddFile', 'SetNotifyFlags', 'SetNotifyCmdLine', 'SetMinRetryDelay', 'SetCustomHeaders', and 'Resume' command options)[2] Admin logs, PowerShell logs, and the Windows Event log for BITS activity.[23] Also consider investigating more detailed information about jobs by parsing the BITS job database.[4]

DS0029 Network Traffic Network Connection Creation

Monitor for newly constructed network activity generated by BITS. BITS jobs use HTTP(S) and SMB for remote connections and are tethered to the creating user and will only function when that user is logged on (this rule applies even if a user attaches the job to a service account).

DS0009 Process Process Creation

Monitor for newly constructed BITS tasks to enumerate using the BITSAdmin tool (bitsadmin /list /allusers /verbose).

Note: Event IDs are for Sysmon (Event ID 1 - process create) and Windows Security Log (Event ID 4688 - a new process has been created). Analytic 1 is oriented around looking for the creation of Microsoft Background Intelligent Transfer Service utility (bitsadmin.exe) processes that schedule a BITS job to persist on an endpoint. The analytic identifies the command-line parameters used to create, resume or add a file to a BITS job; these are typically seen combined in a single command-line or executed in sequence.

Analytic 2 identifies Microsoft Background Intelligent Transfer Service utility bitsadmin.exe using the transfer parameter to download a remote object. In addition, look for download or upload on the command-line, the switches are not required to perform a transfer. Capture any files downloaded. Review the reputation of the IP or domain used. Typically once executed, a follow on command will be used to execute the dropped file. Network connection or file modification events related 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. In some suspicious and malicious instances, BITS jobs will be created. You can use bitsadmin /list /verbose to list out the jobs during investigation.

Analytic 1 - BITS Job Persistence

processes = filter processes where ( (event_id == "1" OR event_id == "4688") AND exe ="C:\Windows\System32\bitsadmin.exe" AND (command_line == "create" OR command_line == "addfile" OR command_line == "setnotifyflags" OR command_line == "setnotifycmdline" OR command_line == "setminretrydelay" OR command_line == "setcustomheaders" OR command_line == "resume"))

Analytic 2 : BITSAdmin Download File

bitsadmin_commands = filter processes where ( exe ="C:\Windows\System32\bitsadmin.exe" AND command_line = transfer)output bitsadmin_commands

DS0019 Service Service Metadata

BITS runs as a service and its status can be checked with the Sc query utility (sc query bits).[24]

References