Detect XDG Autostart Entries in Sumo Logic CSE
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/
Sumo Detection Query
(_sourceCategory=linux/syslog OR _sourceCategory=linux/audit OR _sourceCategory=*linux*)
| where (_raw matches /\/etc\/xdg\/autostart\// or _raw matches /\.config\/autostart\//) and _raw matches /\.desktop/
| parse regex field=_raw "(?<process_name>[a-zA-Z0-9_\-\.]+)\[(?<pid>\d+)\]" nodrop
| parse regex field=_raw "user=(?<user>\S+)" nodrop
| parse regex field=_raw "exe=\"(?<exe>[^\"]+)\"" nodrop
| parse regex field=_raw "(?<autostart_path>(?:/etc/xdg/autostart/|[\w/]*\.config/autostart/)[\w\-\.]+\.desktop)" nodrop
| eval autostart_scope = if(_raw matches /\/etc\/xdg\/autostart\//, "system-wide", if(_raw matches /\.config\/autostart\//, "user-level", "unknown"))
| eval suspicious_write = if(_raw matches /( cp | mv | tee | echo |printf |>>)/, "true", "false")
| where autostart_scope != "unknown" or suspicious_write = "true"
| table _messageTime, _sourceHost, user, process_name, exe, autostart_path, autostart_scope, suspicious_write, _raw
| sort by _messageTime desc Sumo Logic detection for XDG Autostart Entry persistence (T1547.013). Parses Linux syslog and auditd logs for file creation or modification activity involving .desktop files in both system-wide (/etc/xdg/autostart/) and user-level (~/.config/autostart/) XDG autostart directories. Also identifies shell write commands targeting these paths.
Data Sources
Required Tables
False Positives & Tuning
- Software deployment pipelines using tools like Chef, Puppet, or Ansible may write .desktop autostart files as part of standard workstation configuration management
- User-installed Snap or Flatpak applications automatically create autostart entries in ~/.config/autostart/ during application setup when the user enables autostart features
- Linux desktop session management daemons may write temporary or session-tracking .desktop files to autostart directories during normal login/logout cycles
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.