T1053.006

Systemd Timers

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.

Microsoft Sentinel / Defender
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

Data Sources

File: File Creation File: File Modification Process: Process Creation Command: Command Execution Syslog

Required Tables

Syslog DeviceFileEvents

False Positives

  • 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

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