process where
/* net, sc or wmic stopping or deleting Elastic Agent on Windows */
(event.type == "start" and
process.name : ("net.exe", "sc.exe", "wmic.exe","powershell.exe","taskkill.exe","PsKill.exe","ProcessHacker.exe") and
process.args : ("stopservice","uninstall", "stop", "disabled","Stop-Process","terminate","suspend") and
process.args : ("elasticendpoint", "Elastic Agent","elastic-agent","elastic-endpoint"))
or
/* service or systemctl used to stop Elastic Agent on Linux */
(event.type == "end" and
(process.name : ("systemctl", "service") and
process.args : "elastic-agent" and
process.args : ("stop", "disable"))
or
/* pkill , killall used to stop Elastic Agent on Linux */
( event.type == "end" and process.name : ("pkill", "killall") and process.args: "elastic-agent")
or
/* Unload Elastic Agent extension on MacOS */
(process.name : "kextunload" and
process.args : "com.apple.iokit.EndpointSecurity" and
event.action : "end"))
Install detection rules in Elastic Security
Detect Elastic Agent Service Terminated in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).