Detect XDG Autostart Entries in Google Chronicle
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/
YARA-L Detection Query
rule xdg_autostart_persistence_t1547_013 {
meta:
author = "Argus Detection Engineering"
description = "Detects creation or modification of XDG Autostart .desktop files to establish persistence on Linux desktop systems (MITRE T1547.013)"
mitre_attack_tactic = "Persistence"
mitre_attack_technique = "T1547.013"
severity = "MEDIUM"
confidence = "MEDIUM"
events:
(
// File write to XDG autostart directories
$e.metadata.event_type = "FILE_CREATION" or
$e.metadata.event_type = "FILE_MODIFICATION"
)
and (
$e.target.file.full_path = /\/etc\/xdg\/autostart\/.*\.desktop/ or
$e.target.file.full_path = /\/.config\/autostart\/.*\.desktop/
)
and $e.principal.hostname != ""
match:
$e.principal.hostname over 5m
outcome:
$risk_score = max(if($e.target.file.full_path = /\/etc\/xdg\/autostart\//, 75, 50))
$hostname = $e.principal.hostname
$file_path = $e.target.file.full_path
$process_name = $e.principal.process.file.full_path
$user = $e.principal.user.userid
condition:
$e
} Chronicle YARA-L 2.0 rule detecting XDG Autostart Entry abuse on Linux systems. Monitors UDM FILE_CREATION and FILE_MODIFICATION events targeting .desktop files within /etc/xdg/autostart/ (system-wide, higher risk) or ~/.config/autostart/ (user-level) directories. Assigns higher risk score to system-wide modifications which require elevated privileges.
Data Sources
Required Tables
False Positives & Tuning
- Enterprise software distribution systems pushing desktop application configurations to managed Linux workstations will routinely create .desktop autostart files as part of standard provisioning workflows
- GNOME or KDE desktop environment updates may rewrite or update existing .desktop autostart entries in /etc/xdg/autostart/ when updating system session components
- User-controlled startup preference changes via desktop settings panels (e.g., GNOME Tweaks 'Startup Applications') write directly to ~/.config/autostart/, generating benign file creation events
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.