Detection rules › Elastic

Background Task Execution via a Hidden Process

Source
github.com/elastic/protections-artifacts

This rule detects the execution of a background task via a hidden process. Attackers may use hidden processes to evade detection and establish persistence or execute post-exploitation commands on a target system.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
This rule detects the execution of a background task via a hidden process. Attackers may use hidden processes to evade
detection and establish persistence or execute post-exploitation commands on a target system.
"""
id = "2dc02903-9487-4152-87ac-f1c6c7f3a7d3"
license = "Elastic License v2"
name = "Background Task Execution via a Hidden Process"
os_list = ["linux"]
version = "1.0.9"

query = '''
process where event.type == "start" and event.action == "exec" and
(process.parent.name like ".*" or process.name like ".*") and
(process.parent.args like "*&" or process.args like "*&") and
not (
  process.parent.command_line == "runc init" or
  process.parent.executable like (
    ".", "/usr/bin/podman", "./.runc-wrapped", "/nix/store/*", "/dev/.buildkit_qemu_emulator",
    "/home/*/.local/share/fnm/node-versions/*/installation/lib/node_modules/opencode-ai/bin/.opencode",
    "/usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencode"
  ) or
  process.parent.args in ("/usr/bin/crun", "lxc-attach") or
  process.args == "lxc-attach" or
  (process.args == "datadog-ipc-helper" and process.args == "ddog_daemon_entry_point")
)
'''

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 = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[[threat.technique.subtechnique]]
id = "T1564.001"
name = "Hidden Files and Directories"
reference = "https://attack.mitre.org/techniques/T1564/001/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"


[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and
(process.parent.name like ".*" or process.name like ".*") and
(process.parent.args like "*&" or process.args like "*&") and
not (
  process.parent.command_line == "runc init" or
  process.parent.executable like (
    ".", "/usr/bin/podman", "./.runc-wrapped", "/nix/store/*", "/dev/.buildkit_qemu_emulator",
    "/home/*/.local/share/fnm/node-versions/*/installation/lib/node_modules/opencode-ai/bin/.opencode",
    "/usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencode"
  ) or
  process.parent.args in ("/usr/bin/crun", "lxc-attach") or
  process.args == "lxc-attach" or
  (process.args == "datadog-ipc-helper" and process.args == "ddog_daemon_entry_point")
)

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseqdatadog-ipc-helperexcludes:process.args field:"process.args" value:"datadog-ipc-helper"
process.argseqddog_daemon_entry_pointexcludes:process.args field:"process.args" value:"ddog_daemon_entry_point"
process.argseqlxc-attachexcludes:process.args field:"process.args" value:"lxc-attach"
process.parent.argsin/usr/bin/crun, lxc-attachexcludes:process.parent.args field:"process.parent.args" value:"/usr/bin/crun" field:"process.parent.args" value:"lxc-attach"
process.parent.command_lineeqrunc initexcludes:process.parent.command_line field:"process.parent.command_line" value:"runc init"
process.parent.executablewildcard., /usr/bin/podman, ./.runc-wrapped, /nix/store/*, /dev/.buildkit_qemu_emulator, /home/*/.local/share/fnm/node-versions/*/installation/lib/node_modules/opencode-ai/bin/.opencode, /usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencodeexcludes:process.parent.executable

Indicators

These rows show field, operator, and value matches.