Techniques
Sample rules
Potential Privilege Escalation via SUID/SGID
- source: elastic
- technicques:
- T1548
Description
Detects potential privilege escalation under the root effective user when the real user and parent user are not root, indicative of the execution of binaries with SUID or SGID bits set.
Detection logic
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
(
startsWith(process.executable, process.command_line) or
startsWith(process.name, process.command_line)
) 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
)
) and
not (
(process.executable == "/usr/lib/landscape/apt-update" and process.args == "/usr/lib/landscape/apt-update") or
(process.executable == "/usr/bin/mount" and process.args in ("/usr/bin/mount", "mount")) or
(process.executable like "/u0?/app/agent/agent_*/sbin/nmo" and process.args like "/u0?/app/agent/agent_*/sbin/nmo") or
(process.executable == "/usr/bin/screen" and process.args == "screen") or
(process.executable == "/usr/sbin/playpen" and process.args == "/usr/sbin/playpen") or
process.executable == "/usr/bin/sudo"
)
Suspicious SUID Binary Execution
- source: elastic
- technicques:
- T1548
Description
Detects execution of SUID binaries that may be used for privilege escalation under the root effective user when the real user and parent user are not root, combined with minimal argument counts and suspicious parent context (interpreters, short shell -c invocations, or parents running from user-writable paths) to indicate potential misuse of SUID binaries for privilege escalation.
Detection logic
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 ("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",
"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
)
) and
not (
(process.name == "crontab" and process.args in ("-l", "-e")) or
(process.name in ("passwd", "chsh") and process.args == "--version")
)