Linux Powershell Suspicious Child Process


Description

Detects when Powershell (pwsh) spawns a highly abnormal or suspicious child process. Powershell usage on Linux is rare, and leveraging Powershell to launch any of this list of suspicious utilities may indicate malicious behavior.

Query · eql

process where event.type == "start" and event.action == "exec" and process.parent.name == "pwsh" and
process.name like (
  "nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd", "nc.traditional", "socat", "ngrok", "ping",
  "python*", "php*", "perl*", "ruby*", "lua*", "openssl", "telnet"
) and
not (
  (process.name like "python*" and process.args == "azure.cli") or
  process.parent.executable like~ (
    "/opt/ansible*/Evaluate-STIG/powershell/pwsh", "/evaluate/Evaluate-STIG/powershell/pwsh",
    "/opt/Evaluate-STIG/powershell/pwsh"
  ) or
  process.working_directory like "/opt/azurevstsagent/agent*" or
  process.args like "/home/*/.local/bin/az" or
  (process.parent.args == "./vmware_ap_vcenter.global.ps1" and process.name == "ping")
)
Raw source Linux Powershell Suspicious Child Process · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Detects when Powershell (pwsh) spawns a highly abnormal or suspicious child process. Powershell usage on Linux is rare,
and leveraging Powershell to launch any of this list of suspicious utilities may indicate malicious behavior.
"""
id = "e9731cea-c3fc-4183-a76c-9a798ae0a2b0"
license = "Elastic License v2"
name = "Linux Powershell Suspicious Child Process"
os_list = ["linux"]
version = "1.0.12"

query = '''
process where event.type == "start" and event.action == "exec" and process.parent.name == "pwsh" and
process.name like (
  "nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd", "nc.traditional", "socat", "ngrok", "ping",
  "python*", "php*", "perl*", "ruby*", "lua*", "openssl", "telnet"
) and
not (
  (process.name like "python*" and process.args == "azure.cli") or
  process.parent.executable like~ (
    "/opt/ansible*/Evaluate-STIG/powershell/pwsh", "/evaluate/Evaluate-STIG/powershell/pwsh",
    "/opt/Evaluate-STIG/powershell/pwsh"
  ) or
  process.working_directory like "/opt/azurevstsagent/agent*" or
  process.args like "/home/*/.local/bin/az" or
  (process.parent.args == "./vmware_ap_vcenter.global.ps1" and process.name == "ping")
)
'''

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.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "7.15.0"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.