Privilege Escalation (TA0004)(external, opens in a new tab or window)
text code block:process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and ( (process.user.id == "0" and process.real_user.id != "0" and process.parent.user.id != "0") or (process.group.id == "0" and process.real_group.id != "0" and process.parent.group.id != "0") ) and ( (process.name in ("su", "passwd", "unix_chkpwd") and process.args_count <= 2) or ( process.name in ("sudo", "pkexec", "fusermount", "fusermount3", "mount", "umount", "newgrp", "chsh") and process.args_count == 1 ) or process.name in ( "sudoedit", "gpasswd", "chfn", "polkit-agent-helper-1", "dbus-daemon-launch-helper", "ssh-keysign", "pam_extrausers_chkpwd", "expiry", "chage", "crontab", "wall", "bsd-write", "ssh-agent", "ping", "ping6", "traceroute", "mtr", "ntfs-3g", "Xorg.wrap", "chrome-sandbox", "bwrap" ) ) and ( process.parent.name like (".*", "python*", "perl*", "ruby*", "lua*", "php*", "node", "deno", "bun", "java") or process.parent.executable like ("./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/user/*", "/var/run/user/*", "/home/*/*") or ( process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh") and process.parent.args in ("-c", "-cl", "-lc", "--command", "-ic", "-ci", "-bash", "-sh", "-zsh", "-dash", "-fish", "-ksh", "-mksh") and process.parent.args_count <= 4 ) )
Install detection rules in Elastic Security
Detect Suspicious SUID Binary Execution in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).