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.
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 Data Sources
Required Tables
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
References (7)
- https://attack.mitre.org/techniques/T1547/013/
- https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html
- https://specifications.freedesktop.org/desktop-entry-spec/latest/recognized-keys.html
- https://redcanary.com/blog/netwire-remote-access-trojan-on-linux/
- https://www.zscaler.com/blogs/security-research/contagious-interview-campaign-beavertail-invisibleferret
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1547.013/T1547.013.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/linux/file_event
Unlock Pro Content
Get the full detection package for T1547.013 including response playbook, investigation guide, and atomic red team tests.