Persistence via BITS Job Notify Cmdline

An adversary can use the Background Intelligent Transfer Service (BITS) SetNotifyCmdLine method to execute a program that runs after a job finishes transferring data or after a job enters a specified state in order to persist on a system.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2021/12/04"
 3integration = ["endpoint", "windows"]
 4maturity = "production"
 5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
 6min_stack_version = "8.3.0"
 7updated_date = "2023/03/06"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12An adversary can use the Background Intelligent Transfer Service (BITS) SetNotifyCmdLine method to execute a program
13that runs after a job finishes transferring data or after a job enters a specified state in order to persist on a
14system.
15"""
16from = "now-9m"
17index = ["logs-endpoint.events.*", "winlogbeat-*", "logs-windows.*", "endgame-*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Persistence via BITS Job Notify Cmdline"
21note = """## Setup
22
23If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define `event.ingested` and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate `event.ingested` to @timestamp for this rule to work.
24"""
25references = [
26    "https://pentestlab.blog/2019/10/30/persistence-bits-jobs/",
27    "https://docs.microsoft.com/en-us/windows/win32/api/bits1_5/nf-bits1_5-ibackgroundcopyjob2-setnotifycmdline",
28    "https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/bitsadmin-setnotifycmdline",
29    "https://www.elastic.co/blog/hunting-for-persistence-using-elastic-security-part-2",
30]
31risk_score = 47
32rule_id = "c3b915e0-22f3-4bf7-991d-b643513c722f"
33severity = "medium"
34tags = ["Elastic", "Host", "Windows", "Threat Detection", "Persistence", "Elastic Endgame"]
35timestamp_override = "event.ingested"
36type = "eql"
37
38query = '''
39process where host.os.type == "windows" and event.type == "start" and
40  process.parent.name : "svchost.exe" and process.parent.args : "BITS" and
41  not process.executable :
42              ("?:\\Windows\\System32\\WerFaultSecure.exe",
43               "?:\\Windows\\System32\\WerFault.exe",
44               "?:\\Windows\\System32\\wermgr.exe",
45               "?:\\WINDOWS\\system32\\directxdatabaseupdater.exe")
46'''
47
48
49[[rule.threat]]
50framework = "MITRE ATT&CK"
51[[rule.threat.technique]]
52id = "T1197"
53name = "BITS Jobs"
54reference = "https://attack.mitre.org/techniques/T1197/"
55
56
57[rule.threat.tactic]
58id = "TA0003"
59name = "Persistence"
60reference = "https://attack.mitre.org/tactics/TA0003/"

Setup

If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define event.ingested and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate event.ingested to @timestamp for this rule to work.

to-top