Detection rules › Elastic

Kill Command Executed from Binary in Unusual Location

Source
github.com/elastic/protections-artifacts

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

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.

FieldKindExcluded valuesSearch
process.command_lineeqpkill -HUP dockerdexcludes:process.command_line field:"process.command_line" value:"pkill -HUP dockerd"
process.parent.executableeq/tmp/o.chaban/devpod/agentexcludes:process.parent.executable field:"process.parent.executable" value:"/tmp/o.chaban/devpod/agent"
process.command_lineeqpkill -SIGHUP -f acconsoleexcludes:process.command_line field:"process.command_line" value:"pkill -SIGHUP -f acconsole"
process.parent.nameequpgrade-execute.shexcludes:process.parent.name field:"process.parent.name" value:"upgrade-execute.sh"
process.command_lineinkillall -e -9 lmgrd, killall steam-runtime-launcher-service, pkill -f /nopexcludes: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.executablestarts_with./merged/excludes:process.executable field:"process.executable" value:"./merged/"
process.parent.executablewildcard/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-wrappedexcludes:process.parent.executable
process.parent.namewildcardcheck_openvpnauthentication, python*, vmis-launcher, nessuscli, AppRun, ., .azotebgexcludes:process.parent.name

Indicators

These rows show field, operator, and value matches.