Cross-source coverage

T1543.002 / ATT&CK

Create or Modify System Process: Systemd Service

22 rules across 4 sources.

1 deprecated hidden · include

From MITRE ATT&CK 19.2

Adversaries may create or modify systemd services to repeatedly execute malicious payloads as part of persistence. Systemd is a system and service manager commonly used for managing background daemon processes (also known as services) and other system resources. Systemd is the default initialization (init) system on many Linux distributions replacing legacy init systems, including SysVinit and Upstart, while remaining backwards compatible.

Systemd utilizes unit configuration files with the .service file extension to encode information about a service's process. By default, system level unit files are stored in the /systemd/system directory of the root owned directories (/). User level unit files are stored in the /systemd/user directories of the user owned directories ($HOME).

Inside the .service unit files, the following directives are used to execute commands:

  • ExecStart, ExecStartPre, and ExecStartPost directives execute when a service is started manually by systemctl or on system start if the service is set to automatically start.
  • ExecReload directive executes when a service restarts.
  • ExecStop, ExecStopPre, and ExecStopPost directives execute when a service is stopped.

Adversaries have created new service files, altered the commands a .service file’s directive executes, and modified the user directive a .service file executes as, which could result in privilege escalation. Adversaries may also place symbolic links in these directories, enabling systemd to find these payloads regardless of where they reside on the filesystem.

The .service file’s User directive can be used to run service as a specific user, which could result in privilege escalation based on specific user/group permissions.

Systemd services can be created via systemd generators, which support the dynamic generation of unit files. Systemd generators are small executables that run during boot or configuration reloads to dynamically create or modify systemd unit files by converting non-native configurations into services, symlinks, or drop-ins (i.e., Boot or Logon Initialization Scripts).

Platforms
Linux
Telemetry
auditd:SYSCALLlinux:osquery

How MITRE says to detect it DET0253

Detection of Systemd Service Creation or Modification on Linux

Linux Analytic 0701

Detects the creation or modification of `.service` unit files in system/user-level directories, combined with execution of `systemctl`, `service`, or dynamically created drop-ins via systemd generators. Detects persistence by analyzing the `ExecStart` path, file entropy, and symlink usage, especially when paired with execution from `/tmp`, `/dev/shm`, or unmounted volumes.

  • auditd:SYSCALL write, open, or rename to /etc/systemd/system/*.service
  • auditd:SYSCALL modification of existing .service file
  • auditd:SYSCALL execution of systemctl or service with enable/start parameters
  • auditd:SYSCALL fork/exec of service via PID 1 (systemd)
  • linux:osquery newly registered unit file with ExecStart pointing to unknown binary

elastic/detection-rules

11 rules
Detection Severity Format
Suspicious Mining Process Creation Event Medium Elastic TOML
Suspicious Network Connection via systemd Medium Elastic TOML
Systemd Generator Created Medium Elastic TOML
Systemd Service Created Medium Elastic TOML
Systemd Service Override Configuration File Created Medium Elastic TOML
Modification of Persistence Relevant Files Detected via Defend for Containers Low Elastic TOML
Potential Persistence via File Modification Low Elastic TOML
Potential Suspicious File Edit Low Elastic TOML
Systemd Service Started by Unusual Parent Process Low Elastic TOML
Systemd Shell Execution During Boot Low Elastic TOML

+ 1 more from elastic/detection-rules → showing the 10 highest-severity

SigmaHQ/sigma

4 rules
Detection Severity Format
LiteLLM / TeamPCP Supply Chain Attack Indicators High Sigma
TeamPCP LiteLLM Supply Chain Attack Persistence Indicators High Sigma
Systemd Service Creation Medium Sigma
Service Reload or Start - Linux Low Sigma

elastic/protections-artifacts

4 rules
Detection Severity Format
Hidden Payload Executed via Scheduled Job Undefined Elastic TOML
Scheduled Job Executing Binary in Unusual Location Undefined Elastic TOML
Service Created by Suspicious Process and Activated Undefined Elastic TOML
Unusual Command Execution via Systemd Scheduled Task Undefined Elastic TOML

chainguard-dev/osquery-defense-kit

3 rules
Detection Severity Format
Funky systemd units, may be evidence of persistence Undefined osquery SQL
Suspicious calls to systemctl(event-based) Undefined osquery SQL
Unexpected systemd units, may be evidence of persistence Undefined osquery SQL

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.