Detection rules › Elastic

Interactive Shell Spawned via Hidden Process

Source
github.com/elastic/protections-artifacts

Detects when a hidden process spawns an interactive shell. This behavior may indicate a malicious actor attempting to execute post-exploitation commands.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Detects when a hidden process spawns an interactive shell. This behavior may indicate a malicious actor attempting to
execute post-exploitation commands.
"""
id = "52deef30-e633-49e1-9dd2-da1ad6cb5e43"
license = "Elastic License v2"
name = "Interactive Shell Spawned via Hidden Process"
os_list = ["linux"]
version = "1.0.7"

query = '''
process where event.type == "start" and event.action == "exec" and process.parent.name like ".*" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.args in ("-i", "-li", "-il") and
not (
  process.parent.executable like ("/nix/store/*", "/tmp/newroot/nix/store/*") or
  process.parent.args == "/usr/bin/crun" or
  process.parent.command_line == "runc init"
)
'''

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/"

[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 ".*" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.args in ("-i", "-li", "-il") and
not (
  process.parent.executable like ("/nix/store/*", "/tmp/newroot/nix/store/*") or
  process.parent.args == "/usr/bin/crun" or
  process.parent.command_line == "runc init"
)

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.