Detection rules › Sigma

Systemd Service Creation

Status
test
Severity
medium
Log source
product linux, service auditd
Author
Pawel Mazur
Source
github.com/SigmaHQ/sigma

Detects a creation of systemd services which could be used by adversaries to execute malicious code.

Known false positives

  • Admin work like legit service installs.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

title: Systemd Service Creation
id: 1bac86ba-41aa-4f62-9d6b-405eac99b485
status: test
description: Detects a creation of systemd services which could be used by adversaries to execute malicious code.
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1543.002/T1543.002.md
author: 'Pawel Mazur'
date: 2022-02-03
modified: 2022-02-06
tags:
    - attack.privilege-escalation
    - attack.persistence
    - attack.t1543.002
logsource:
    product: linux
    service: auditd
detection:
    path:
        type: 'PATH'
        nametype: 'CREATE'
    name_1:
        name|startswith:
            - '/usr/lib/systemd/system/'
            - '/etc/systemd/system/'
    name_2:
        name|contains: '/.config/systemd/user/'
    condition: path and 1 of name_*
falsepositives:
    - Admin work like legit service installs.
level: medium

Stages and Predicates

Stage 0: condition

path and 1 of name_*

Stage 1: path

path:
    type: 'PATH'
    nametype: 'CREATE'

Stage 2: name_1

name_1:
    name|startswith:
        - '/usr/lib/systemd/system/'
        - '/etc/systemd/system/'

Stage 3: name_2

name_2:
    name|contains: '/.config/systemd/user/'

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
namematch
  • /.config/systemd/user/
field:"name" kind:match value:"/.config/systemd/user/"
namestarts_with
  • /etc/systemd/system/
  • /usr/lib/systemd/system/
field:"name" kind:starts_with
nametypeeq
  • CREATE
field:"nametype" kind:eq value:"CREATE"
typeeq
  • PATH
field:"type" kind:eq value:"PATH"