T1053.006 Microsoft Sentinel · KQL

Detect Systemd Timers in Microsoft Sentinel

Adversaries may abuse systemd timers to perform task scheduling for initial or recurring execution of malicious code. Systemd timers are unit files with file extension .timer that control services. Timers can be set to run on a calendar event or after a time span relative to a starting point. Each .timer file must have a corresponding .service file with the same name. Privileged timers are written to /etc/systemd/system/ and /usr/lib/systemd/system while user level timers are written to ~/.config/systemd/user/. Adversaries may use systemd timers to execute malicious code at system startup or on a scheduled basis for persistence, and may leverage root-level timer paths to maintain privileged persistence.

MITRE ATT&CK

Tactic
Execution Persistence Privilege Escalation
Technique
T1053 Scheduled Task/Job
Sub-technique
T1053.006 Systemd Timers
Canonical reference
https://attack.mitre.org/techniques/T1053/006/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
let TimerPaths = dynamic([
  "/etc/systemd/system/",
  "/usr/lib/systemd/system/",
  "/lib/systemd/system/",
  ".config/systemd/user/"
]);
let SuspiciousServiceContent = dynamic([
  "/tmp/", "/dev/shm/", "/var/tmp/",
  "bash -i", "nc ", "ncat ", "curl ", "wget ",
  "python", "perl", "ruby",
  "base64", "chmod +x", "chmod 777"
]);
// Detect systemctl commands enabling or starting timers
let SystemctlTimerEvents = Syslog
| where TimeGenerated > ago(24h)
| where ProcessName == "systemd" or SyslogMessage has "systemctl"
| where SyslogMessage has ".timer"
| where SyslogMessage has_any ("enable", "start", "daemon-reload", "link")
| extend TimerName = extract(@"([\w\-\.]+\.timer)", 1, SyslogMessage)
| extend Action = case(
    SyslogMessage has "enable", "enabled",
    SyslogMessage has "start", "started",
    SyslogMessage has "daemon-reload", "daemon-reloaded",
    "other")
| project TimeGenerated, Computer, ProcessName, SyslogMessage, TimerName, Action;
// Detect new .timer files written to systemd directories
let TimerFileCreation = DeviceFileEvents
| where TimeGenerated > ago(24h)
| where FileName endswith ".timer" or FileName endswith ".service"
| where FolderPath has_any (TimerPaths)
| extend IsPrivilegedPath = FolderPath has_any ("/etc/systemd/system/", "/usr/lib/systemd/system/", "/lib/systemd/system/")
| extend IsUserTimer = FolderPath has ".config/systemd/user/"
| project TimeGenerated, DeviceName, FileName, FolderPath, InitiatingProcessFileName,
         InitiatingProcessCommandLine, InitiatingProcessAccountName,
         IsPrivilegedPath, IsUserTimer;
union SystemctlTimerEvents, TimerFileCreation
| sort by TimeGenerated desc
high severity medium confidence

Detects systemd timer abuse on Linux systems by monitoring two primary vectors: (1) Syslog entries indicating systemctl operations enabling or starting timer units, and (2) DeviceFileEvents showing creation or modification of .timer and .service unit files in systemd directories. Covers both privileged paths (/etc/systemd/system/, /usr/lib/systemd/system/) and user-level paths (~/.config/systemd/user/). Alerts on new timer units being installed and activated, which is the core persistence mechanism for T1053.006.

Data Sources

File: File CreationFile: File ModificationProcess: Process CreationCommand: Command ExecutionSyslog

Required Tables

SyslogDeviceFileEvents

False Positives & Tuning

  • Legitimate software packages (e.g., apt, dnf, snap) installing systemd timers during package updates or installation
  • System administrators creating scheduled maintenance timers (log rotation, backup jobs, certificate renewal via certbot)
  • Configuration management tools (Ansible, Chef, Puppet, Salt) deploying timer units as part of infrastructure automation
  • Cloud-init or provisioning scripts creating timers during VM initialization or boot
Download portable Sigma rule (.yml)

Other platforms for T1053.006


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Create and Enable a Privileged Systemd Timer for Persistence

    Expected signal: Auditd: SYSCALL openat/write events for /etc/systemd/system/argus-test.timer and /etc/systemd/system/argus-test.service creation. Process creation events for 'systemctl daemon-reload', 'systemctl enable argus-test.timer', 'systemctl start argus-test.timer'. Syslog: systemd entries showing 'argus-test.timer' enabled and started. After 1 minute: process creation for /bin/bash /tmp/argus_payload.sh spawned with parent=systemd.

  2. Test 2Create User-Level Systemd Timer for Unprivileged Persistence

    Expected signal: File creation events for ~/.config/systemd/user/argus-user-test.timer and ~/.config/systemd/user/argus-user-test.service. Process creation events for 'systemctl --user daemon-reload', 'systemctl --user enable', 'systemctl --user start'. User journal entries: 'journalctl --user -u argus-user-test.timer' shows activation. On calendar trigger: process creation for /bin/bash /tmp/user_payload.sh with parent process systemd (user instance).

  3. Test 3Deploy Systemd Timer with Base64-Encoded Payload in ExecStart

    Expected signal: File creation events for /etc/systemd/system/argus-encoded-test.service and /etc/systemd/system/argus-encoded-test.timer. The service unit file content contains 'base64 -d | bash' in ExecStart — detectable via file content inspection. Syslog: systemctl enable/start events. Process creation: /bin/bash spawned by systemd with base64 decode pipe pattern visible in command line arguments.

  4. Test 4Simulate Remote Systemd Timer Activation via SSH

    Expected signal: File creation for unit files in /etc/systemd/system/. Process creation: systemctl enable and start commands. If run via SSH: /var/log/auth.log shows SSH session from source IP, with subsequent systemctl commands in the same session. Syslog: 'argus-remote-test.timer' enabled and started entries. Auditd: EXECVE records for systemctl with timer arguments.

Unlock Pro Content

Get the full detection package for T1053.006 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections