Name:Linux Auditd Possible Setuid Execve Privesc id:e958e6ee-7c73-4eff-a4d9-43232d719b26 version:1 date:None 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' analytic_story:['Linux Privilege Escalation']