T1547.013 Elastic Security · Elastic

Detect XDG Autostart Entries in Elastic Security

Adversaries may add or modify XDG Autostart Entries to execute malicious programs or commands when a user's desktop environment is loaded at login. XDG Autostart entries are available for any XDG-compliant Linux system. XDG Autostart entries use Desktop Entry files (.desktop) to configure the user's desktop environment upon user login. These configuration files determine what applications launch upon user login, define associated applications to open specific file types, and define applications used to open removable media. Adversaries may abuse this feature to establish persistence by adding a path to a malicious binary or command to the Exec directive in the .desktop configuration file. System-wide Autostart entries are located in /etc/xdg/autostart while user entries are located in ~/.config/autostart.

MITRE ATT&CK

Tactic
Persistence Privilege Escalation
Technique
T1547 Boot or Logon Autostart Execution
Sub-technique
T1547.013 XDG Autostart Entries
Canonical reference
https://attack.mitre.org/techniques/T1547/013/

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by host.id with maxspan=5m
  [file where event.action in ("creation", "overwrite", "rename") and
   file.extension == "desktop" and
   (file.path like "/etc/xdg/autostart/*" or file.path like "*/.config/autostart/*")]
  [process where event.action == "start" and
   (process.args like "*autostart*" or process.command_line like "*xdg-autostart*") and
   process.name in ("cp", "mv", "tee", "cat", "bash", "sh", "python3", "python", "perl", "ruby")]
medium severity medium confidence

Detects creation or modification of XDG Autostart .desktop files in system-wide (/etc/xdg/autostart/) or user-level (~/.config/autostart/) directories, correlated with suspicious process execution that references autostart paths. Covers T1547.013 persistence establishment on Linux desktop environments.

Data Sources

Elastic Endpoint SecurityAuditbeatFilebeat (auditd module)

Required Tables

logs-endpoint.events.file-*logs-endpoint.events.process-*auditbeat-*

False Positives & Tuning

  • Legitimate software installers (e.g., Slack, Zoom, VS Code) create .desktop autostart entries during installation as expected application behavior
  • System administrators deploying desktop environment configurations via configuration management tools like Ansible or Puppet may create or modify autostart entries in bulk
  • User-initiated application setup wizards that offer 'Start at login' options commonly write to ~/.config/autostart/ as a standard feature
Download portable Sigma rule (.yml)

Other platforms for T1547.013


Testing Methodology

Validate this detection against 3 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 Malicious XDG Autostart Entry (User Level)

    Expected signal: Sysmon for Linux Event ID 11: FileCreate with TargetFilename=~/.config/autostart/df00tech-test.desktop. Audit log: SYSCALL event for openat/creat on the .desktop file path. DeviceFileEvents with ActionType=FileCreated.

  2. Test 2Create System-Wide XDG Autostart Entry

    Expected signal: Sysmon for Linux Event ID 11: FileCreate with TargetFilename=/etc/xdg/autostart/df00tech-sysupdate.desktop, Image=bash (running as root). Audit log: SYSCALL with auid showing the user who ran sudo. DeviceFileEvents with ActionType=FileCreated.

  3. Test 3XDG Autostart Entry via Echo (Inline Creation)

    Expected signal: Sysmon for Linux Event ID 1: Process Create for bash/echo with CommandLine containing autostart and .desktop. Sysmon Event ID 11: FileCreate for the .desktop file. DeviceProcessEvents with ProcessCommandLine containing the echo command.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections