T1547.013

XDG Autostart Entries

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.

Microsoft Sentinel / Defender
kusto
let AutostartPaths = dynamic(["/etc/xdg/autostart/", "/.config/autostart/"]);
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated", "FileModified")
| where FolderPath has_any (AutostartPaths)
| where FileName endswith ".desktop"
| project Timestamp, DeviceName, AccountName, ActionType, FileName, FolderPath, InitiatingProcessFileName, InitiatingProcessCommandLine, SHA256
| sort by Timestamp desc;
DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has_any (".config/autostart", "/etc/xdg/autostart", "xdg-autostart")
| where ProcessCommandLine has_any ("cp ", "mv ", "tee ", "cat ", "echo ", "printf ", ">>")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc
medium severity medium confidence

Data Sources

File: File Creation File: File Modification Process: Process Creation Command: Command Execution Microsoft Defender for Endpoint (Linux)

Required Tables

DeviceFileEvents DeviceProcessEvents

False Positives

  • Desktop environment package installations (GNOME, KDE, XFCE) that add .desktop autostart entries for system services like keyring agents, polkit, and accessibility tools
  • User-installed applications (Slack, Discord, Spotify, Steam) that create autostart entries during installation or when the user enables 'Start on login'
  • System administrators deploying autostart entries via configuration management tools (Ansible, Puppet, Chef) for monitoring agents or corporate tools
  • Package manager operations (apt, dnf, pacman) that install or update packages containing XDG autostart entries

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