Terminal closed with Pkill or Killall
Description
Detects when Pkill is used to close all Terminal windows with the responsible process having been executed from a volume mount. Information stealers in particular kill or close any open Terminal windows in order to ensure their shell script execution commands aren't observed by the user. In order to gain quick code execution these samples instruct the user to execute their payloads directly from the volume mounted image which is not a common practice especially when paired with uncommon commands invocations like this.
Query · eql
process where event.type == "start" and event.action == "exec" and process.name in ("pkill", "killall") and
process.args like~ "Terminal" and (process.parent.executable like "/Volumes/*" or process.parent.name in ("bash", "sh", "zsh") or (process.parent.code_signature.trusted == false or process.parent.code_signature.exists == false)) and
not process.Ext.effective_parent.executable in ("/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
"/usr/local/jamf/bin/jamf") and
not (process.parent.name == "bash" and process.parent.command_line == null)