Linux auditd: systemd service file creation under systemd directories

Identifies new systemd unit file creation events under common systemd directories using auditd PATH create logs.

FreeReviewedSigma · Medium · v3
Product
linux
Service
auditd
Author
Pawel Mazur (SigmaHQ), DRL 1.1
Published
2022-02-03
Updated
2026-07-31
title: "Linux auditd: systemd service file creation under systemd directories"
id: 5462dc06-fce7-4bba-bf90-10e67ce1c29e
status: test
description: This rule flags file creation events for systemd service units under standard systemd locations (e.g., /usr/lib/systemd/system/ and /etc/systemd/system/) and user unit paths containing /.config/systemd/user/. Adversaries can abuse these locations to persist by having systemd start attacker-controlled code via newly created unit files. It relies on Linux auditd PATH create telemetry that includes the created file path.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1543.002/T1543.002.md
  - https://github.com/SigmaHQ/sigma/blob/master/rules/linux/auditd/path/lnx_auditd_systemd_service_creation.yml
author: Pawel Mazur, Huntrule Team
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
license: DRL-1.1
related:
  - id: 1bac86ba-41aa-4f62-9d6b-405eac99b485
    type: derived