Detection rules › Elastic
Bind Shell via Socket
Detects the creation of a bind shell via socket. Attackers may spawn bind shells to establish persistence onto a target system.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule body
[rule]
description = """
Detects the creation of a bind shell via socket. Attackers may spawn bind shells to establish persistence onto a target
system.
"""
id = "37f6659f-dff4-42bc-91ae-7ed7a9264529"
license = "Elastic License v2"
name = "Bind Shell via Socket"
os_list = ["linux"]
reference = ["https://gtfobins.github.io/gtfobins/socket/"]
version = "1.0.3"
query = '''
process where event.type == "start" and event.action == "exec" and process.name == "socket" and
process.args : "-*s*" and process.args : "-*p*" and process.args : "*sh*" and process.args_count >= 3
'''
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 = "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.name == "socket" and
process.args : "-*s*" and process.args : "-*p*" and process.args : "*sh*" and process.args_count >= 3
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.args_count | ge |
| field:"process.args_count" kind:ge value:"3" |
process.name | eq |
| field:"process_name" kind:eq value:"socket" |