Detection rules › Elastic
Persistence via BITS SetNotifyCmdLine Method
Identifies suspicious execution from the Windows Background Intelligent Transfer Service (BITS) service via BITS SetNotifyCmdLine method. This method specifies a program to execute when a BITS job enters the BG_JOB_STATE_ERROR or BG_JOB_STATE_TRANSFERRED state. This feature can be abused to maintain stealthy persistence on an infected system.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule body
[rule]
description = """
Identifies suspicious execution from the Windows Background Intelligent Transfer Service (BITS) service via BITS
SetNotifyCmdLine method. This method specifies a program to execute when a BITS job enters the BG_JOB_STATE_ERROR or
BG_JOB_STATE_TRANSFERRED state. This feature can be abused to maintain stealthy persistence on an infected system.
"""
id = "3400fac0-3978-4cc5-a82d-69d08625c3ad"
license = "Elastic License v2"
name = "Persistence via BITS SetNotifyCmdLine Method"
os_list = ["windows"]
reference = [
"https://blog.menasec.net/2021/05/hunting-for-suspicious-usage-of.html",
"https://docs.microsoft.com/en-us/windows/win32/api/bits1_5/nf-bits1_5-ibackgroundcopyjob2-setnotifycmdline",
"https://www.elastic.co/security-labs/bits-and-bytes-analyzing-bitsloth",
]
version = "1.0.30"
query = '''
process where event.action == "start" and
/* child process of the BITS service */
process.parent.name == "svchost.exe" and process.parent.args == "BITS" and
(
/* commonly abused trusted programs */
process.pe.original_file_name in ("cscript.exe", "wscript.exe", "PowerShell.EXE", "Cmd.Exe", "MSHTA.EXE", "RUNDLL32.EXE",
"REGSVR32.EXE", "MSBuild.exe", "InstallUtil.exe", "RegAsm.exe", "wmic.exe", "CMSTP.EXE", "wuauclt.exe", "CertUtil.exe") or
/* programs unsigned or with untrusted code signature status running from users home folder */
(process.code_signature.trusted != true and process.executable : "?:\\Users\\*") or
/* suspicious paths */
process.executable : ("?:\\Users\\Public\\*", "?:\\ProgramData\\*", "?:\\Users\\*\\AppData\\*", "?:\\Windows\\Microsoft.NET\\*")
)
/* false positives */
and not (process.code_signature.subject_name :
("YANDEX LLC", "McAfee, LLC", "AVG Technologies USA, Inc.", "Reason Cybersecurity Inc.") and
process.code_signature.trusted == true) and
not (process.name : "wmic.exe" and process.args : "MSFT_MpComputerStatus" and process.args : "get") and
not (process.name : "rundll32.exe" and process.args : "?:\\Program Files (x86)\\PCPitstop\\Super Shield\\*") and
not process.hash.sha256 in ("65aee904ab6008a25963a85941039baae02e9a120e338ad2635ec4be9ddf2e73",
"867a86be9ab8dfa8f2d4997dd7f4df584709f9677d35efa94ddf0d2be224351a",
"fbdbf5f13818503b5d311c233af6467f5f9a462418bcc4558c1561df0c033d7c",
"bca7e687a39ac52d8ddb0e95f0886ba3d194ff55a11cdf09fc2b0da9ebbad572",
"11d659e714ff6d393a30c6c560062e82587b50462aeb33db3dda508009d3ed76",
"5aff8a288cbb22900a0c21088ca5af4447d492ebc35caed757e93a2ccdfa4455")
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1197"
name = "BITS Jobs"
reference = "https://attack.mitre.org/techniques/T1197/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.parent.name == "svchost.exe" and process.parent.args == "BITS" and
(
process.pe.original_file_name in ("cscript.exe", "wscript.exe", "PowerShell.EXE", "Cmd.Exe", "MSHTA.EXE", "RUNDLL32.EXE",
"REGSVR32.EXE", "MSBuild.exe", "InstallUtil.exe", "RegAsm.exe", "wmic.exe", "CMSTP.EXE", "wuauclt.exe", "CertUtil.exe") or
(process.code_signature.trusted != true and process.executable : "?:\\Users\\*") or
process.executable : ("?:\\Users\\Public\\*", "?:\\ProgramData\\*", "?:\\Users\\*\\AppData\\*", "?:\\Windows\\Microsoft.NET\\*")
)
and not (process.code_signature.subject_name :
("YANDEX LLC", "McAfee, LLC", "AVG Technologies USA, Inc.", "Reason Cybersecurity Inc.") and
process.code_signature.trusted == true) and
not (process.name : "wmic.exe" and process.args : "MSFT_MpComputerStatus" and process.args : "get") and
not (process.name : "rundll32.exe" and process.args : "?:\\Program Files (x86)\\PCPitstop\\Super Shield\\*") and
not process.hash.sha256 in ("65aee904ab6008a25963a85941039baae02e9a120e338ad2635ec4be9ddf2e73",
"867a86be9ab8dfa8f2d4997dd7f4df584709f9677d35efa94ddf0d2be224351a",
"fbdbf5f13818503b5d311c233af6467f5f9a462418bcc4558c1561df0c033d7c",
"bca7e687a39ac52d8ddb0e95f0886ba3d194ff55a11cdf09fc2b0da9ebbad572",
"11d659e714ff6d393a30c6c560062e82587b50462aeb33db3dda508009d3ed76",
"5aff8a288cbb22900a0c21088ca5af4447d492ebc35caed757e93a2ccdfa4455")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | MSFT_MpComputerStatus | excludes:process.args field:"process.args" value:"MSFT_MpComputerStatus" |
process.args | eq | get | excludes:process.args field:"process.args" value:"get" |
process.name | eq | wmic.exe | excludes:process.name field:"process.name" value:"wmic.exe" |
process.args | starts_with | ?:\Program Files (x86)\PCPitstop\Super Shield\ | excludes:process.args field:"process.args" value:"?:\Program Files (x86)\PCPitstop\Super Shield\" |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.code_signature.subject_name | eq | YANDEX LLC, McAfee, LLC, AVG Technologies USA, Inc., Reason Cybersecurity Inc. | excludes:process.code_signature.subject_name |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.hash.sha256 | in | 11d659e714ff6d393a30c6c560062e82587b50462aeb33db3dda508009d3ed76, 5aff8a288cbb22900a0c21088ca5af4447d492ebc35caed757e93a2ccdfa4455, 65aee904ab6008a25963a85941039baae02e9a120e338ad2635ec4be9ddf2e73, 867a86be9ab8dfa8f2d4997dd7f4df584709f9677d35efa94ddf0d2be224351a, bca7e687a39ac52d8ddb0e95f0886ba3d194ff55a11cdf09fc2b0da9ebbad572, fbdbf5f13818503b5d311c233af6467f5f9a462418bcc4558c1561df0c033d7c | excludes:process.hash.sha256 |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.code_signature.trusted | ne |
| field:"process.code_signature.trusted" kind:ne value:"true" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.args | eq |
| field:"process.parent.args" kind:eq value:"BITS" |
process.parent.name | eq |
| field:"parent_process_name" kind:eq value:"svchost.exe" |
process.pe.original_file_name | in |
| field:"OriginalFileName" kind:in |