Suspicious Interactive Shell Execution
Description
Detects the suspicious use of the -i shell option indicating an interactive session via an abnormal parent process. Threat actors have been observed using this technique to gain interactive command line access via their payloads in order to maintain access and conduct post-exploitation actions on the objective.
Query · eql
sequence with maxspan=30s
[network where event.type == "start" and event.action == "connection_attempted" and
process.name like~ (".*", "osascript", "ruby*", "python*")] by process.entity_id
[process where event.type == "start" and event.action == "exec" and
(process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
(process.args in ("/bin/bash", "/usr/bin/bash", "/bin/sh", "/usr/bin/sh", "/bin/zsh", "/usr/bin/zsh", "/bin/dash", "/usr/bin/dash", "/bin/csh", "/usr/bin/csh", "/bin/tcsh", "/usr/bin/tcsh", "/bin/ksh", "/usr/bin/ksh", "/bin/tclsh", "/usr/bin/tclsh", "/bin/fish", "/usr/bin/fish", "/usr/local/bin/fish", "/opt/homebrew/bin/fish") or process.args like "*/bin/tclsh*") and
process.args == "-i" and process.args_count == 2 and
process.parent.name like~ (".*", "osascript", "ruby*", "python*")] by process.parent.entity_id