Suspicious Network Connection via Installer Package
Description
Detects the execution of a MacOS installer package with an abnormal child process (e.g bash) followed immediately by a network connection via a suspicious process (e.g curl). Threat actors will build and distribute malicious MacOS installer packages, which have a .pkg extension, many times imitating valid software in order to persuade and infect their victims often using the package files (e.g pre/post install scripts etc.) to download additional tools or malicious software. If this rule fires it should indicate a the installation of a malicious or suspicious package.
Query · eql
sequence by user.id with maxspan=30s
[process where event.type == "start" and event.action == "exec" and
process.parent.name in ("installer", "package_script_service") and
process.name like ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "fish", "python*", "osascript", "tclsh*") and
process.args like ("/Users/*", "/Volumes/*")]
[process where event.type == "start" and
process.parent.pid == 1 and
(process.name in ("curl", "wget", "nscurl") or
(process.name == "osascript" and process.args like~ "*.js"))] as event1
[network where event.type == "start" and
process.name in ("curl", "osascript", "wget", "nscurl") and process.pid == event1.process.pid]