Detection rules › Elastic
Kill Command Executed from Binary in Unusual Location
This rule detects the execution of the "kill" or "pkill" command from a binary located in an unusual location. Miners and other types of malware may attempt to kill competing processes to maintain control of the system.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Defense Impairment |
Telemetry coverage
Rule body
[rule]
description = """
This rule detects the execution of the "kill" or "pkill" command from a binary located in an unusual location. Miners
and other types of malware may attempt to kill competing processes to maintain control of the system.
"""
id = "b9935dcc-e885-4954-9999-3c016b990737"
license = "Elastic License v2"
name = "Kill Command Executed from Binary in Unusual Location"
os_list = ["linux", "macos"]
reference = ["https://blog.xlab.qianxin.com/8220-k4spreader-new-tool-en/"]
version = "1.0.18"
query = '''
process where event.type == "start" and event.action == "exec" and process.name in ("kill", "pkill", "killall") and
(process.parent.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "./.*") or process.parent.name like ".*") and
not (
process.parent.executable like (
"/tmp/newroot/*", "/tmp/JobScheduler-Agent-start_rib-*", "/tmp/ubuntu-release-upgrader-*", "/tmp/.criu*",
"/tmp/home-manager-build*/generation/activate", "/tmp/wpsupgrade.prerm", "/tmp/.mount_Cursor*", "/var/tmp/buildah*",
"/tmp/JackettUpdate*/Jackett/JackettUpdater", "/tmp/.*.ansible/ansible-tmp-*", "/tmp/user/*/ubuntu-release-upgrader-*/noble",
"/tmp/snap.rootfs_*/snap/zoom-client/*/zoom/zoom", "/tmp/B1ServerTools.*/opt/sap/SAPBusinessOne/Common/*/bin/java",
"/nix/store/*", "/var/lib/containers/storage/overlay/nix/store/*/bin/.hyprshot-wrapped"
) or
process.executable like "./merged/*" or
process.parent.name like ("check_openvpnauthentication", "python*", "vmis-launcher", "nessuscli", "AppRun", ".", ".azotebg") or
process.command_line in ("pkill -f /nop", "killall -e -9 lmgrd", "killall steam-runtime-launcher-service") or
(process.parent.executable == "/tmp/o.chaban/devpod/agent" and process.command_line == "pkill -HUP dockerd") or
(process.parent.name == "upgrade-execute.sh" and process.command_line == "pkill -SIGHUP -f acconsole")
)
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"
[[threat.technique.subtechnique]]
id = "T1562.006"
name = "Indicator Blocking"
reference = "https://attack.mitre.org/techniques/T1562/006/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.name in ("kill", "pkill", "killall") and
(process.parent.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "./.*") or process.parent.name like ".*") and
not (
process.parent.executable like (
"/tmp/newroot/*", "/tmp/JobScheduler-Agent-start_rib-*", "/tmp/ubuntu-release-upgrader-*", "/tmp/.criu*",
"/tmp/home-manager-build*/generation/activate", "/tmp/wpsupgrade.prerm", "/tmp/.mount_Cursor*", "/var/tmp/buildah*",
"/tmp/JackettUpdate*/Jackett/JackettUpdater", "/tmp/.*.ansible/ansible-tmp-*", "/tmp/user/*/ubuntu-release-upgrader-*/noble",
"/tmp/snap.rootfs_*/snap/zoom-client/*/zoom/zoom", "/tmp/B1ServerTools.*/opt/sap/SAPBusinessOne/Common/*/bin/java",
"/nix/store/*", "/var/lib/containers/storage/overlay/nix/store/*/bin/.hyprshot-wrapped"
) or
process.executable like "./merged/*" or
process.parent.name like ("check_openvpnauthentication", "python*", "vmis-launcher", "nessuscli", "AppRun", ".", ".azotebg") or
process.command_line in ("pkill -f /nop", "killall -e -9 lmgrd", "killall steam-runtime-launcher-service") or
(process.parent.executable == "/tmp/o.chaban/devpod/agent" and process.command_line == "pkill -HUP dockerd") or
(process.parent.name == "upgrade-execute.sh" and process.command_line == "pkill -SIGHUP -f acconsole")
)
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | eq | pkill -HUP dockerd | excludes:process.command_line field:"process.command_line" value:"pkill -HUP dockerd" |
process.parent.executable | eq | /tmp/o.chaban/devpod/agent | excludes:process.parent.executable field:"process.parent.executable" value:"/tmp/o.chaban/devpod/agent" |
process.command_line | eq | pkill -SIGHUP -f acconsole | excludes:process.command_line field:"process.command_line" value:"pkill -SIGHUP -f acconsole" |
process.parent.name | eq | upgrade-execute.sh | excludes:process.parent.name field:"process.parent.name" value:"upgrade-execute.sh" |
process.command_line | in | killall -e -9 lmgrd, killall steam-runtime-launcher-service, pkill -f /nop | excludes:process.command_line field:"process.command_line" value:"killall -e -9 lmgrd" field:"process.command_line" value:"killall steam-runtime-launcher-service" field:"process.command_line" value:"pkill -f /nop" |
process.executable | starts_with | ./merged/ | excludes:process.executable field:"process.executable" value:"./merged/" |
process.parent.executable | wildcard | /tmp/newroot/*, /tmp/JobScheduler-Agent-start_rib-*, /tmp/ubuntu-release-upgrader-*, /tmp/.criu*, /tmp/home-manager-build*/generation/activate, /tmp/wpsupgrade.prerm, /tmp/.mount_Cursor*, /var/tmp/buildah*, /tmp/JackettUpdate*/Jackett/JackettUpdater, /tmp/.*.ansible/ansible-tmp-*, /tmp/user/*/ubuntu-release-upgrader-*/noble, /tmp/snap.rootfs_*/snap/zoom-client/*/zoom/zoom, /tmp/B1ServerTools.*/opt/sap/SAPBusinessOne/Common/*/bin/java, /nix/store/*, /var/lib/containers/storage/overlay/nix/store/*/bin/.hyprshot-wrapped | excludes:process.parent.executable |
process.parent.name | wildcard | check_openvpnauthentication, python*, vmis-launcher, nessuscli, AppRun, ., .azotebg | excludes:process.parent.name |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | in |
| field:"process_name" kind:in |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_name" kind:wildcard value:".*" |