| ID | Technique | Tactic |
|---|---|---|
| T1037 | Boot or Logon Initialization Scripts | Persistence |
| T1059.004 | Unix Shell | Privilege Escalation |
| T1547 | Boot or Logon Autostart Execution | Execution |
Detection: Linux Suspicious XDG Autostart
Description
The following analytic detects the creation of a .desktop file within XDG autostart directories, including the system-wide /etc/xdg/autostart and user-local ~/.config/autostart paths. Adversaries abuse XDG autostart entries to achieve persistence on Linux desktop environments — any .desktop file placed in these directories is automatically executed when a user logs into a graphical session. This technique is used by post-exploitation frameworks such as PANIX to survive reboots without requiring root on user-local paths, or to achieve system-wide persistence when writing to /etc/xdg/autostart.
Search
1
2| tstats `security_content_summariesonly`
3 count min(_time) as firstTime max(_time) as lastTime
4
5FROM datamodel=Endpoint.Filesystem WHERE
6
7Filesystem.action="created"
8Filesystem.file_path IN (
9 "/etc/xdg/autostart/*",
10 "*/.config/autostart/*"
11)
12Filesystem.file_path = "*.desktop"
13
14BY Filesystem.action Filesystem.dest Filesystem.file_access_time
15 Filesystem.file_create_time Filesystem.file_hash Filesystem.file_modify_time
16 Filesystem.file_name Filesystem.file_path Filesystem.process_guid
17 Filesystem.process_id Filesystem.user Filesystem.vendor_product
18
19
20| `drop_dm_object_name(Filesystem)`
21
22| `security_content_ctime(firstTime)`
23
24| `security_content_ctime(lastTime)`
25
26| `linux_suspicious_xdg_autostart_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Sysmon for Linux EventID 11 | 'sysmon:linux' |
'Syslog:Linux-Sysmon/Operational' |
Macros Used
| Name | Value |
|---|---|
| security_content_summariesonly | summariesonly=summariesonly_config allow_old_summaries=oldsummaries_config fillnull_value=fillnull_config`` |
| linux_suspicious_xdg_autostart_filter | search * |
linux_suspicious_xdg_autostart_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
| Setting | Value |
|---|---|
| Disabled | true |
| Cron Schedule | 0 * * * * |
| Earliest Time | -70m@m |
| Latest Time | -10m@m |
| Schedule Window | auto |
| Creates Finding (Notable) | No |
| Creates Intermediate Finding (Risk Event) | Yes |
Implementation
The detection is based on data that originates from Endpoint Detection and Response (EDR) agents. These agents are designed to provide security-related telemetry from the endpoints where the agent is installed. To implement this search, you must ingest logs that contain file creation events including the file path and user context. These logs must be processed using the appropriate Splunk Technology Add-ons that are specific to the EDR product. The logs must also be mapped to the Filesystem node of the Endpoint data model. Use the Splunk Common Information Model (CIM) to normalize the field names and speed up the data modeling process.
Known False Positives
Legitimate software installations may create .desktop files in /etc/xdg/autostart as part of their normal setup process. Filter known software deployment tools and approved administrative activity as needed.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| Possible Suspicious XDG Autostart file created under [$file_path$] by [$user$] on [$dest$] | dest | system | 20 |
Threat Objects
| Field | Type |
|---|---|
| file_name | file_name |
References
Detection Testing
| Test Type | Status | Dataset | Source | Sourcetype |
|---|---|---|---|---|
| Validation | ✅ Passing | N/A | N/A | N/A |
| Unit | ✅ Passing | Dataset | Syslog:Linux-Sysmon/Operational |
sysmon:linux |
| Integration | ✅ Passing | Dataset | Syslog:Linux-Sysmon/Operational |
sysmon:linux |
Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
Source: GitHub |
Version: 1