Detect XDG Autostart Entries in CrowdStrike LogScale
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/
LogScale Detection Query
// XDG Autostart .desktop file creation or modification
#event_simpleName=MotionDetectionInfoEvent OR #event_simpleName=FileOpenInfo OR #event_simpleName=NewExecutableWritten
| TargetFileName=/(\/etc\/xdg\/autostart\/|\.config\/autostart\/).*\.desktop$/
| eval autostart_scope=if(TargetFileName=/\/etc\/xdg\/autostart\//, "system-wide", "user-level")
| table([_timstamp, ComputerName, UserName, TargetFileName, autostart_scope, ImageFileName, CommandLine])
| sort(_timstamp, order=desc)
// Alternative: process writing to autostart paths via shell commands
| union [
#event_simpleName=ProcessRollup2
| CommandLine=/(autostart|xdg-autostart)/
| CommandLine=/( cp | mv | tee |echo |printf |>>)/
| ImageFileName=/(\/bin\/sh|\/bin\/bash|\/usr\/bin\/python|\/usr\/bin\/perl|\/usr\/bin\/cp|\/usr\/bin\/mv|\/usr\/bin\/tee)/
| table([_timstamp, ComputerName, UserName, ImageFileName, CommandLine, ParentBaseFileName])
| sort(_timstamp, order=desc)
] CrowdStrike Falcon LogScale (CQL) detection for XDG Autostart Entry persistence (T1547.013). Queries Falcon telemetry for file write events targeting .desktop files in XDG autostart directories (/etc/xdg/autostart/ system-wide and ~/.config/autostart/ user-level), as well as ProcessRollup2 events where shells or file manipulation utilities are used to write to autostart paths.
Data Sources
Required Tables
False Positives & Tuning
- CrowdStrike Falcon sensor updates or Linux agent installations may themselves trigger file write events in monitored directories if the agent registers itself as an autostart service on desktop Linux systems
- IT asset management tools (e.g., Landscape, Puppet agent) performing scheduled configuration enforcement may repeatedly write known-good .desktop autostart entries, generating recurring alerts
- Developer workstations running build or test automation scripts that provision local desktop environments as part of integration testing pipelines may write .desktop files to autostart directories programmatically
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.
- 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.
- 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.
- 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.
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.