Detection: Linux Auditd Process Image Change Under Same PID

Description

This analytic detects a successful Linux execve event where a PID changes executable image under the same parent after the prior image has been active for at least one second and no more than 60 seconds. A delayed image change in an existing process can indicate execution following exploitation and should be investigated with related endpoint and network activity.

 1`linux_auditd`
 2type=SYSCALL
 3success="yes"
 4(
 5    syscall IN ("59", "221", "11")
 6    OR
 7    SYSCALL="execve"
 8)
 9
10
11| sort 0 _time
12
13
14| streamstats current=f window=1 global=f last(exe) as previous_exe last(_time) as previous_time last(ppid) as previous_ppid by host pid
15
16
17| eval transition_seconds=round(_time - previous_time, 3)
18
19
20| where isnotnull(previous_exe) AND previous_exe!=exe AND ppid=previous_ppid AND transition_seconds>=1 AND transition_seconds<=60
21
22
23| stats count as transition_count
24        min(previous_time) as firstTime
25        max(_time) as lastTime
26        values(comm) as process_name
27        values(uid) as uid
28        values(auid) as auid
29        values(subj) as subj
30  by host pid ppid previous_exe exe
31
32
33| rename host as dest exe as current_exe
34
35
36| `security_content_ctime(firstTime)`
37
38| `security_content_ctime(lastTime)`
39
40| `linux_auditd_process_image_change_under_same_pid_filter`

Data Source

Name Platform Sourcetype Source
Linux Auditd Syscall Linux icon Linux 'auditd' 'auditd'

Macros Used

Name Value
linux_auditd sourcetype="auditd"
linux_auditd_process_image_change_under_same_pid_filter search *
linux_auditd_process_image_change_under_same_pid_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1106 Native API Execution
Installation
DE.CM
CIS 10

CVE

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) Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Intermediate Finding (Risk Event) No
TTP detections generate a Finding (Notable) and may generate Intermediate Findings (Risk Events) for associated entities.

Implementation

To implement this detection, the process begins by ingesting auditd data, that consists of SYSCALL, TYPE, EXECVE and PROCTITLE events, which captures command-line executions and process details on Unix/Linux systems. These logs should be ingested and processed using Splunk Add-on for Unix and Linux (https://splunkbase.splunk.com/app/833), which is essential for correctly parsing and categorizing the data. The next step involves normalizing the field names to match the field names set by the Splunk Common Information Model (CIM) to ensure consistency across different data sources and enhance the efficiency of data modeling. This approach enables effective monitoring and detection of linux endpoints where auditd is deployed

Known False Positives

Some applications may intentionally replace their executable image after performing setup or initialization. Review the executable transition, elapsed time, parent process, host role, and related activity; tune the filter macro for expected workloads.

Associated Analytic Story

Finding

Title Entity Field Entity Type Risk Score
PID [$pid$] changed executable from [$previous_exe$] to [$current_exe$] on [$dest$] dest system 50

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation ✅ Passing N/A N/A N/A
Unit ✅ Passing Dataset auditd auditd
Integration ✅ Passing Dataset auditd auditd

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