Suspicious Pseudo-Terminal Proxy Execution via su
Description
Detects the use of "su" with the "-P" or "--pty" option combined with "-c" or "--command" execution. This pattern may indicate an attempt to abuse a privileged pseudo-terminal proxy to relay controlled output from a privileged process. This technique has been demonstrated in exploitation chains targeting AppArmor policy management pseudo-files (".load", ".replace", ".remove") where attackers redirect the output of a privileged utility into these files to load, replace, or remove AppArmor profiles. While "su" usage itself is common, invocation with "--pty" together with command execution is uncommon, and may indicate attempts to proxy controlled data through a privileged process during local privilege escalation activity.
Query · eql
process where event.type == "start" and event.action == "exec" and process.name == "su" and
process.args in ("-P", "--pty") and process.args in ("-c", "--command")
/* May add this in the future, but keeping it broad now to detect general pseudo-terminal proxy execution
and process.command_line like "*stty*raw*"
*/