Detection rules › Elastic

Command Execution via Screen Session

Source
github.com/elastic/protections-artifacts

Detects the execution of the screen binary to execute a command or commands via a shell. Threat actors have used this technique via interactive sessions to execute commands on the host and avoid standard detections.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

[rule]
description = """
Detects the execution of the screen binary to execute a command or commands via a shell. Threat actors have used this
technique via interactive sessions to execute commands on the host and avoid standard detections.
"""
id = "232c03d2-ff5d-4ec5-88b5-5926dc491e91"
license = "Elastic License v2"
name = "Command Execution via Screen Session"
os_list = ["macos"]
version = "1.0.6"

query = '''
process where event.type == "start" and event.action == "exec" and 
 process.name == "screen" and
 process.args in ("/bin/bash", "/usr/bin/bash", "/bin/sh", "/usr/bin/sh", "/bin/zsh", "/usr/bin/zsh", "bash", "sh", "zsh") and
 process.args == "-c" and
 not process.Ext.effective_parent.executable == "/Applications/kitty.app/Contents/MacOS/kitty"
'''

min_endpoint_version = "8.7.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/"

[internal]
min_endpoint_version = "8.7.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and 
 process.name == "screen" and
 process.args in ("/bin/bash", "/usr/bin/bash", "/bin/sh", "/usr/bin/sh", "/bin/zsh", "/usr/bin/zsh", "bash", "sh", "zsh") and
 process.args == "-c" and
 not process.Ext.effective_parent.executable == "/Applications/kitty.app/Contents/MacOS/kitty"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.Ext.effective_parent.executableeq/Applications/kitty.app/Contents/MacOS/kittyexcludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/Applications/kitty.app/Contents/MacOS/kitty"

Indicators

These rows show field, operator, and value matches.