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.
Query · spl
`linux_auditd`
type=SYSCALL
success="yes"
(
syscall IN ("59", "221", "11")
OR
SYSCALL="execve"
)
| sort 0 _time
| 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
| eval transition_seconds=round(_time - previous_time, 3)
| where isnotnull(previous_exe) AND previous_exe!=exe AND ppid=previous_ppid AND transition_seconds>=1 AND transition_seconds<=60
| stats count as transition_count
min(previous_time) as firstTime
max(_time) as lastTime
values(comm) as process_name
values(uid) as uid
values(auid) as auid
values(subj) as subj
by host pid ppid previous_exe exe
| rename host as dest exe as current_exe
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `linux_auditd_process_image_change_under_same_pid_filter`
Implementation guide
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.
Analyst notes
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.