Detection rules › Sigma

Potential Persistence Attempt Via Existing Service Tampering

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

Detects the modification of an existing service in order to execute an arbitrary payload when the service is started or killed as a potential method for persistence.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Potential Persistence Attempt Via Existing Service Tampering
id: 38879043-7e1e-47a9-8d46-6bec88e201df
status: test
description: Detects the modification of an existing service in order to execute an arbitrary payload when the service is started or killed as a potential method for persistence.
references:
    - https://pentestlab.blog/2020/01/22/persistence-modify-existing-service/
author: Sreeman
date: 2020-09-29
modified: 2023-02-04
tags:
    - attack.privilege-escalation
    - attack.persistence
    - attack.execution
    - attack.stealth
    - attack.t1543.003
    - attack.t1574.011
logsource:
    category: process_creation
    product: windows
detection:
    selection_sc:
        - CommandLine|contains|all:
              - 'sc '
              - 'config '
              - 'binpath='
        - CommandLine|contains|all:
              - 'sc '
              - 'failure'
              - 'command='
    selection_reg_img:
        - CommandLine|contains|all:
              - 'reg '
              - 'add '
              - 'FailureCommand'
        - CommandLine|contains|all:
              - 'reg '
              - 'add '
              - 'ImagePath'
    selection_reg_ext:
        CommandLine|contains:
            - '.sh'
            - '.exe'
            - '.dll'
            - '.bin$'
            - '.bat'
            - '.cmd'
            - '.js'
            - '.msh$'
            - '.reg$'
            - '.scr'
            - '.ps'
            - '.vb'
            - '.jar'
            - '.pl'
    condition: selection_sc or all of selection_reg_*
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

selection_sc or all of selection_reg_*

Stage 1: selection_sc

selection_sc:
    - CommandLine|contains|all:
          - 'sc '
          - 'config '
          - 'binpath='
    - CommandLine|contains|all:
          - 'sc '
          - 'failure'
          - 'command='

Stage 2: selection_reg_img

selection_reg_img:
    - CommandLine|contains|all:
          - 'reg '
          - 'add '
          - 'FailureCommand'
    - CommandLine|contains|all:
          - 'reg '
          - 'add '
          - 'ImagePath'

Stage 3: selection_reg_ext

selection_reg_ext:
    CommandLine|contains:
        - '.sh'
        - '.exe'
        - '.dll'
        - '.bin$'
        - '.bat'
        - '.cmd'
        - '.js'
        - '.msh$'
        - '.reg$'
        - '.scr'
        - '.ps'
        - '.vb'
        - '.jar'
        - '.pl'

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • .bat corpus 11 (sigma 9, elastic 1, kusto 1)
  • .bin$
  • .cmd corpus 6 (sigma 5, elastic 1)
  • .dll corpus 16 (sigma 16)
  • .exe corpus 5 (sigma 5)
  • .jar corpus 2 (sigma 2)
  • .js corpus 9 (sigma 9)
  • .msh$
  • .pl corpus 2 (sigma 2)
  • .ps corpus 3 (sigma 3)
  • .reg$
  • .scr corpus 5 (sigma 5)
  • .sh corpus 2 (sigma 2)
  • .vb corpus 3 (sigma 3)
  • FailureCommand corpus 3 (sigma 3)
  • ImagePath corpus 3 (sigma 3)
  • add corpus 12 (sigma 12)
  • binpath= corpus 2 (sigma 2)
  • command=
  • config corpus 2 (sigma 2)
  • failure corpus 3 (sigma 3)
  • reg corpus 5 (sigma 5)
  • sc