Detection rules › Sigma

Monitoring For Persistence Via BITS

Status
test
Severity
medium
Log source
category process_creation, product windows
Author
Sreeman
Source
github.com/SigmaHQ/sigma

BITS will allow you to schedule a command to execute after a successful download to notify you that the job is finished. When the job runs on the system the command specified in the BITS job will be executed. This can be abused by actors to create a backdoor within the system and for persistence. It will be chained in a BITS job to schedule the download of malware/additional binaries and execute the program after being downloaded.

MITRE ATT&CK coverage

TacticTechniques
Execution
Persistence
Stealth

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: Monitoring For Persistence Via BITS
id: b9cbbc17-d00d-4e3d-a827-b06d03d2380d
status: test
description: |
    BITS will allow you to schedule a command to execute after a successful download to notify you that the job is finished.
    When the job runs on the system the command specified in the BITS job will be executed.
    This can be abused by actors to create a backdoor within the system and for persistence.
    It will be chained in a BITS job to schedule the download of malware/additional binaries and execute the program after being downloaded.
references:
    - https://www.fireeye.com/blog/threat-research/2020/10/kegtap-and-singlemalt-with-a-ransomware-chaser.html
    - http://0xthem.blogspot.com/2014/03/t-emporal-persistence-with-and-schtasks.html
    - https://isc.sans.edu/diary/Wipe+the+drive+Stealthy+Malware+Persistence+Mechanism+-+Part+1/15394
author: Sreeman
date: 2020-10-29
modified: 2024-01-25
tags:
    - attack.persistence
    - attack.execution
    - attack.stealth
    - attack.t1197
logsource:
    product: windows
    category: process_creation
detection:
    selection_img:
        - Image|endswith: '\bitsadmin.exe'
        - OriginalFileName: 'bitsadmin.exe'
    selection_cli_notify_1:
        CommandLine|contains: '/SetNotifyCmdLine'
    selection_cli_notify_2:
        CommandLine|contains:
            - '%COMSPEC%'
            - 'cmd.exe'
            - 'regsvr32.exe'
    selection_cli_add_1:
        CommandLine|contains: '/Addfile'
    selection_cli_add_2:
        CommandLine|contains:
            - 'http:'
            - 'https:'
            - 'ftp:'
            - 'ftps:'
    condition: selection_img and (all of selection_cli_notify_* or all of selection_cli_add_*)
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

selection_img and (all of selection_cli_notify_* or all of selection_cli_add_*)

Stage 1: selection_img

selection_img:
    - Image|endswith: '\bitsadmin.exe'
    - OriginalFileName: 'bitsadmin.exe'

Stage 2: selection_cli_notify_1

selection_cli_notify_1:
    CommandLine|contains: '/SetNotifyCmdLine'

Stage 3: selection_cli_notify_2

selection_cli_notify_2:
    CommandLine|contains:
        - '%COMSPEC%'
        - 'cmd.exe'
        - 'regsvr32.exe'

Stage 4: selection_cli_add_1

selection_cli_add_1:
    CommandLine|contains: '/Addfile'

Stage 5: selection_cli_add_2

selection_cli_add_2:
    CommandLine|contains:
        - 'http:'
        - 'https:'
        - 'ftp:'
        - 'ftps:'

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
CommandLinematch
  • %COMSPEC% corpus 6 (sigma 5, splunk 1)
  • /Addfile corpus 2 (sigma 1, kusto 1)
  • /SetNotifyCmdLine
  • cmd.exe corpus 4 (sigma 3, splunk 1)
  • ftp: corpus 2 (sigma 1, elastic 1)
  • ftps: corpus 2 (sigma 1, elastic 1)
  • http: corpus 5 (elastic 3, sigma 2)
  • https: corpus 5 (elastic 3, sigma 2)
  • regsvr32.exe corpus 3 (sigma 3)
field:"CommandLine" kind:match
Imageends_with
  • \bitsadmin.exe corpus 29 (sigma 29)
field:"Image" kind:ends_with value:"\bitsadmin.exe"
OriginalFileNameeq
  • bitsadmin.exe corpus 20 (sigma 9, elastic 8, splunk 2, kusto 1)
field:"OriginalFileName" kind:eq value:"bitsadmin.exe"