Ingress Transfer via Windows BITS
Identifies downloads of executable and archive files via the Windows Background Intelligent Transfer Service (BITS). Adversaries could leverage Windows BITS transfer jobs to download remote payloads.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2023/01/13"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/08/06"
6
7[transform]
8[[transform.osquery]]
9label = "Osquery - Retrieve DNS Cache"
10query = "SELECT * FROM dns_cache"
11
12[[transform.osquery]]
13label = "Osquery - Retrieve All Services"
14query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
15
16[[transform.osquery]]
17label = "Osquery - Retrieve Services Running on User Accounts"
18query = """
19SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
20NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
21user_account == null)
22"""
23
24[[transform.osquery]]
25label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
26query = """
27SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
28services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
29authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
30"""
31
32
33[rule]
34author = ["Elastic"]
35description = """
36Identifies downloads of executable and archive files via the Windows Background Intelligent Transfer Service (BITS).
37Adversaries could leverage Windows BITS transfer jobs to download remote payloads.
38"""
39from = "now-9m"
40index = ["logs-endpoint.events.file-*"]
41language = "eql"
42license = "Elastic License v2"
43name = "Ingress Transfer via Windows BITS"
44note = """## Triage and analysis
45
46### Investigating Ingress Transfer via Windows BITS
47
48Windows Background Intelligent Transfer Service (BITS) is a technology that allows the transfer of files between a client and a server, which makes it a dual-use mechanism, being used by both legitimate apps and attackers. When malicious applications create BITS jobs, files are downloaded or uploaded in the context of the service host process, which can bypass security protections, and it helps to obscure which application requested the transfer.
49
50This rule identifies such abuse by monitoring for file renaming events involving "svchost.exe" and "BIT*.tmp" on Windows systems.
51
52> **Note**:
53> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/master/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
54
55### Possible investigation steps
56
57- Gain context into the BITS transfer.
58 - Try to determine the process that initiated the BITS transfer.
59 - Search `bitsadmin.exe` processes and examine their command lines.
60 - Look for unusual processes loading `Bitsproxy.dll` and other BITS-related DLLs.
61 - Try to determine the origin of the file.
62 - Inspect network connections initiated by `svchost.exe`.
63 - Inspect `Microsoft-Windows-Bits-Client/Operational` Windows logs, specifically the event ID 59, for unusual events.
64 - Velociraptor can be used to extract these entries using the [bitsadmin artifact](https://docs.velociraptor.app/exchange/artifacts/pages/bitsadmin/).
65 - Check the reputation of the remote server involved in the BITS transfer, such as its IP address or domain, using threat intelligence platforms or online reputation services.
66 - Check if the domain is newly registered or unexpected.
67 - Use the identified domain as an indicator of compromise (IoCs) to scope other compromised hosts in the environment.
68 - [BitsParser](https://github.com/fireeye/BitsParser) can be used to parse BITS database files to extract BITS job information.
69- Examine the details of the dropped file, and whether it was executed.
70- Investigate other alerts associated with the user/host during the past 48 hours.
71- Examine the host for derived artifacts that indicate suspicious activities:
72 - Analyze the involved executables using a private sandboxed analysis system.
73 - Observe and collect information about the following activities in both the sandbox and the alert subject host:
74 - Attempts to contact external domains and addresses.
75 - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process's `process.entity_id`.
76 - Examine the DNS cache for suspicious or anomalous entries.
77 - $osquery_0
78 - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
79 - Examine the host services for suspicious or anomalous entries.
80 - $osquery_1
81 - $osquery_2
82 - $osquery_3
83 - Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
84
85
86### False positive analysis
87
88- Known false positives for the rule include legitimate software and system updates that use BITS for downloading files.
89
90### Related Rules
91
92- Persistence via BITS Job Notify Cmdline - c3b915e0-22f3-4bf7-991d-b643513c722f
93- Unsigned BITS Service Client Process - 9a3884d0-282d-45ea-86ce-b9c81100f026
94- Bitsadmin Activity - 8eec4df1-4b4b-4502-b6c3-c788714604c9
95
96### Response and Remediation
97
98- Initiate the incident response process based on the outcome of the triage.
99 - If malicious activity is confirmed, perform a broader investigation to identify the scope of the compromise and determine the appropriate remediation steps.
100- Isolate the involved hosts to prevent further post-compromise behavior.
101- If the triage identified malware, search the environment for additional compromised hosts.
102 - Implement temporary network rules, procedures, and segmentation to contain the malware.
103 - Stop suspicious processes.
104 - Immediately block the identified indicators of compromise (IoCs).
105 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
106- Remove and block malicious artifacts identified during triage.
107- Restore the affected system to its operational state by applying any necessary patches, updates, or configuration changes.
108- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
109- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
110- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
111- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
112"""
113references = ["https://attack.mitre.org/techniques/T1197/"]
114risk_score = 21
115rule_id = "f95972d3-c23b-463b-89a8-796b3f369b49"
116severity = "low"
117tags = [
118 "Domain: Endpoint",
119 "OS: Windows",
120 "Use Case: Threat Detection",
121 "Tactic: Defense Evasion",
122 "Tactic: Command and Control",
123 "Data Source: Elastic Defend",
124]
125timestamp_override = "event.ingested"
126type = "eql"
127
128query = '''
129file where host.os.type == "windows" and event.action == "rename" and
130 process.name : "svchost.exe" and file.Ext.original.name : "BIT*.tmp" and
131 (file.extension : ("exe", "zip", "rar", "bat", "dll", "ps1", "vbs", "wsh", "js", "vbe", "pif", "scr", "cmd", "cpl") or
132 file.Ext.header_bytes : "4d5a*") and
133
134 /* noisy paths, for hunting purposes you can use the same query without the following exclusions */
135 not file.path : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "?:\\Windows\\*", "?:\\ProgramData\\*\\*") and
136
137 /* lot of third party SW use BITS to download executables with a long file name */
138 not length(file.name) > 30 and
139 not file.path : (
140 "?:\\Users\\*\\AppData\\Local\\Temp*\\wct*.tmp",
141 "?:\\Users\\*\\AppData\\Local\\Adobe\\ARM\\*\\RdrServicesUpdater*.exe",
142 "?:\\Users\\*\\AppData\\Local\\Adobe\\ARM\\*\\AcroServicesUpdater*.exe",
143 "?:\\Users\\*\\AppData\\Local\\Docker Desktop Installer\\update-*.exe"
144 )
145'''
146
147
148[[rule.threat]]
149framework = "MITRE ATT&CK"
150[[rule.threat.technique]]
151id = "T1105"
152name = "Ingress Tool Transfer"
153reference = "https://attack.mitre.org/techniques/T1105/"
154
155
156[rule.threat.tactic]
157id = "TA0011"
158name = "Command and Control"
159reference = "https://attack.mitre.org/tactics/TA0011/"
160[[rule.threat]]
161framework = "MITRE ATT&CK"
162[[rule.threat.technique]]
163id = "T1197"
164name = "BITS Jobs"
165reference = "https://attack.mitre.org/techniques/T1197/"
166
167
168[rule.threat.tactic]
169id = "TA0005"
170name = "Defense Evasion"
171reference = "https://attack.mitre.org/tactics/TA0005/"
Triage and analysis
Investigating Ingress Transfer via Windows BITS
Windows Background Intelligent Transfer Service (BITS) is a technology that allows the transfer of files between a client and a server, which makes it a dual-use mechanism, being used by both legitimate apps and attackers. When malicious applications create BITS jobs, files are downloaded or uploaded in the context of the service host process, which can bypass security protections, and it helps to obscure which application requested the transfer.
This rule identifies such abuse by monitoring for file renaming events involving "svchost.exe" and "BIT*.tmp" on Windows systems.
Note: This investigation guide uses the Osquery Markdown Plugin introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
Possible investigation steps
- Gain context into the BITS transfer.
- Try to determine the process that initiated the BITS transfer.
- Search
bitsadmin.exe
processes and examine their command lines. - Look for unusual processes loading
Bitsproxy.dll
and other BITS-related DLLs.
- Search
- Try to determine the origin of the file.
- Inspect network connections initiated by
svchost.exe
. - Inspect
Microsoft-Windows-Bits-Client/Operational
Windows logs, specifically the event ID 59, for unusual events.- Velociraptor can be used to extract these entries using the bitsadmin artifact.
- Check the reputation of the remote server involved in the BITS transfer, such as its IP address or domain, using threat intelligence platforms or online reputation services.
- Check if the domain is newly registered or unexpected.
- Use the identified domain as an indicator of compromise (IoCs) to scope other compromised hosts in the environment.
- Inspect network connections initiated by
- BitsParser can be used to parse BITS database files to extract BITS job information.
- Try to determine the process that initiated the BITS transfer.
- Examine the details of the dropped file, and whether it was executed.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Examine the host for derived artifacts that indicate suspicious activities:
- Analyze the involved executables using a private sandboxed analysis system.
- Observe and collect information about the following activities in both the sandbox and the alert subject host:
- Attempts to contact external domains and addresses.
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process's
process.entity_id
. - Examine the DNS cache for suspicious or anomalous entries.
- $osquery_0
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process's
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
- Examine the host services for suspicious or anomalous entries.
- $osquery_1
- $osquery_2
- $osquery_3
- Attempts to contact external domains and addresses.
- Retrieve the files' SHA-256 hash values using the PowerShell
Get-FileHash
cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
False positive analysis
- Known false positives for the rule include legitimate software and system updates that use BITS for downloading files.
Related Rules
- Persistence via BITS Job Notify Cmdline - c3b915e0-22f3-4bf7-991d-b643513c722f
- Unsigned BITS Service Client Process - 9a3884d0-282d-45ea-86ce-b9c81100f026
- Bitsadmin Activity - 8eec4df1-4b4b-4502-b6c3-c788714604c9
Response and Remediation
- Initiate the incident response process based on the outcome of the triage.
- If malicious activity is confirmed, perform a broader investigation to identify the scope of the compromise and determine the appropriate remediation steps.
- Isolate the involved hosts to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Restore the affected system to its operational state by applying any necessary patches, updates, or configuration changes.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
References
Related rules
- Unusual Network Connection via RunDLL32
- Suspicious Antimalware Scan Interface DLL
- First Time Seen Commonly Abused Remote Access Tool Execution
- Microsoft Build Engine Started an Unusual Process
- Potential Evasion via Filter Manager