Linux Auditd Possible Setuid Execve Privesc


Description

The following detects privilege escalation via execve (syscall 59) where a process transitions from a non-root uid to euid=0 without a corresponding successful PAM authentication event (USER_AUTH, USER_ACCT, or CRED_ACQ) in the same audit session. Legitimate privilege elevation mechanisms such as sudo, su, and pkexec authenticate through PAM and generate these audit records tied to the session ID before granting elevated privileges. The absence of a matching successful PAM event alongside an effective UID change to root is anomalous and may indicate exploitation of a setuid binary, a kernel vulnerability, or another mechanism used to escalate privileges outside the normal authentication flow.

Query · spl

`linux_auditd` ( (type=SYSCALL syscall="59" uid!="0" euid="0") OR (type IN ("USER_AUTH","USER_ACCT","CRED_ACQ") res="success") ) | eval is_suspicious_exec=if(type="SYSCALL" AND syscall="59" AND uid!="0" AND euid="0", 1, 0) | eval is_successful_auth=if(type IN ("USER_AUTH","USER_ACCT","CRED_ACQ") AND res="success", 1, 0) | stats
    count(eval(is_suspicious_exec=1)) as exec_count
    max(eval(if(is_suspicious_exec=1, _time, null()))) as lastTime
    max(is_successful_auth) as has_successful_auth
    min(eval(if(is_suspicious_exec=1, _time, null()))) as firstTime
    values(eval(if(is_suspicious_exec=1, comm, null()))) as process_name
    values(eval(if(is_suspicious_exec=1, euid, null()))) as euid
    values(eval(if(is_suspicious_exec=1, exe, null()))) as process_path
    values(eval(if(is_suspicious_exec=1, pid, null()))) as pid
    values(eval(if(is_suspicious_exec=1, ppid, null()))) as ppid
    values(eval(if(is_suspicious_exec=1, uid, null()))) as uid
    by host ses
| where exec_count > 0 AND has_successful_auth != 1 | rename host as dest, ses as session_id | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)` | `linux_auditd_possible_setuid_execve_privesc_filter`

Implementation guide

To implement this detection, the process begins by ingesting auditd data, that consist 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

  • Processes with an unset audit session, such as cron jobs, that legitimately drop and reacquire root privileges outside of PAM, may trigger this detection and require filtering.

Analyst notes

Known false positives: Processes with an unset audit session, such as cron jobs, that legitimately drop and reacquire root privileges outside of PAM, may trigger this detection and require filtering.

Raw source Linux Auditd Possible Setuid Execve Privesc · SPL
Esc
Published by splunk/security_content ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
name: Linux Auditd Possible Setuid Execve Privesc
id: e958e6ee-7c73-4eff-a4d9-43232d719b26
version: 1
creation_date: '2026-07-06'
modification_date: '2026-07-06'
author: Raven Tait, Nasreddine Bencherchali, Splunk
status: production
type: Anomaly
description: The following detects privilege escalation via execve (syscall 59) where a process transitions from a non-root uid to euid=0 without a corresponding successful PAM authentication event (USER_AUTH, USER_ACCT, or CRED_ACQ) in the same audit session. Legitimate privilege elevation mechanisms such as sudo, su, and pkexec authenticate through PAM and generate these audit records tied to the session ID before granting elevated privileges. The absence of a matching successful PAM event alongside an effective UID change to root is anomalous and may indicate exploitation of a setuid binary, a kernel vulnerability, or another mechanism used to escalate privileges outside the normal authentication flow.
data_source:
    - Linux Auditd Execve
search: >-
    `linux_auditd` (
    (type=SYSCALL syscall="59" uid!="0" euid="0")
    OR
    (type IN ("USER_AUTH","USER_ACCT","CRED_ACQ") res="success")
    )
    | eval is_suspicious_exec=if(type="SYSCALL" AND syscall="59" AND uid!="0" AND euid="0", 1, 0)
    | eval is_successful_auth=if(type IN ("USER_AUTH","USER_ACCT","CRED_ACQ") AND res="success", 1, 0)
    | stats
        count(eval(is_suspicious_exec=1)) as exec_count
        max(eval(if(is_suspicious_exec=1, _time, null()))) as lastTime
        max(is_successful_auth) as has_successful_auth
        min(eval(if(is_suspicious_exec=1, _time, null()))) as firstTime
        values(eval(if(is_suspicious_exec=1, comm, null()))) as process_name
        values(eval(if(is_suspicious_exec=1, euid, null()))) as euid
        values(eval(if(is_suspicious_exec=1, exe, null()))) as process_path
        values(eval(if(is_suspicious_exec=1, pid, null()))) as pid
        values(eval(if(is_suspicious_exec=1, ppid, null()))) as ppid
        values(eval(if(is_suspicious_exec=1, uid, null()))) as uid
        by host ses
    | where exec_count > 0 AND has_successful_auth != 1
    | rename host as dest, ses as session_id
    | `security_content_ctime(firstTime)`
    | `security_content_ctime(lastTime)`
    | `linux_auditd_possible_setuid_execve_privesc_filter`
how_to_implement: To implement this detection, the process begins by ingesting auditd data, that consist 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: Processes with an unset audit session, such as cron jobs, that legitimately drop and reacquire root privileges outside of PAM, may trigger this detection and require filtering.
references:
    - https://github.com/sgkdev/packet_edit_meme
    - https://tuxcare.com/blog/pedit-cow-cve/
drilldown_searches:
    - name: View the detection results for - "$dest$"
      search: '%original_detection_search% | search  dest = "$dest$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$dest$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
      earliest_offset: 7d
      latest_offset: "0"
intermediate_findings:
    entities:
        - field: dest
          type: system
          score: 20
          message: $process_name$ was launched with euid 0 on [$dest$] without PAM auth.
threat_objects:
    - field: process_name
      type: process_name
analytic_story:
    - Linux Privilege Escalation
asset_type: Endpoint
cve:
    - CVE-2026-46331
mitre_attack_id:
    - T1068
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: endpoint
security_domain: endpoint
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1068/linux_pedit/linux_auditd.log
          source: auditd
          sourcetype: auditd
      test_type: unit

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.