Detection rules › Elastic
Suspicious Execution via a Hidden Process
This rule detects the execution of unusual commands 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
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth | |
| Command & Control |
Rule body
[rule]
description = """
This rule detects the execution of unusual commands 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 = "c52891b5-8f83-4571-8e68-ea2601f46285"
license = "Elastic License v2"
name = "Suspicious Execution via a Hidden Process"
os_list = ["linux"]
reference = ["https://www.elastic.co/security-labs/primer-on-persistence-mechanisms"]
version = "1.0.7"
query = '''
process where event.type == "start" and event.action == "exec" and process.parent.name : ".*" and process.args : (
"*/dev/tcp*", "*/dev/udp/*", "*import*pty*spawn*", "*import*subprocess*call*", "*TCPSocket.new*", "*TCPSocket.open*",
"*io.popen*", "*os.execute*", "*fsockopen*", "*disown*"
) and not (
process.parent.command_line == "runc init" or
process.parent.args == "/usr/bin/crun" or
process.args like "source /home/*/.claude/shell-snapshots/snapshot-*"
)
'''
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 : ".*" and process.args : (
"*/dev/tcp*", "*/dev/udp/*", "*import*pty*spawn*", "*import*subprocess*call*", "*TCPSocket.new*", "*TCPSocket.open*",
"*io.popen*", "*os.execute*", "*fsockopen*", "*disown*"
) and not (
process.parent.command_line == "runc init" or
process.parent.args == "/usr/bin/crun" or
process.args like "source /home/*/.claude/shell-snapshots/snapshot-*"
)
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | source /home/*/.claude/shell-snapshots/snapshot-* | excludes:process.args field:"process.args" value:"source /home/*/.claude/shell-snapshots/snapshot-*" |
process.parent.args | eq | /usr/bin/crun | excludes:process.parent.args field:"process.parent.args" value:"/usr/bin/crun" |
process.parent.command_line | eq | runc init | excludes:process.parent.command_line field:"process.parent.command_line" value:"runc init" |
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.args | wildcard |
| field:"process.args" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_name" kind:wildcard value:".*" |