Detection rules › Elastic

Reverse or Bind Shell via Suspicious Utility

Source
github.com/elastic/protections-artifacts

Detects the creation of a reverse or bind shell through suspicious utilities. Attackers may spawn reverse or bind shells to establish persistence onto a target system.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Detects the creation of a reverse or bind shell through suspicious utilities. Attackers may spawn reverse or bind shells
to establish persistence onto a target system.
"""
id = "bb330560-0042-48a5-8232-7f2012d6e440"
license = "Elastic License v2"
name = "Reverse or Bind Shell via Suspicious Utility"
os_list = ["linux"]
reference = [
    "https://gtfobins.github.io/#+non-interactive%20bind%20shell",
    "https://gtfobins.github.io/#+non-interactive%20reverse%20shell",
]
version = "1.0.5"

query = '''
process where event.type == "start" and event.action == "exec" and (
  (process.name == "nmap" and process.args like~ "--script=/tmp/tmp.*") or
  (process.name like "lua*" and process.args == "-e" and process.command_line like~ "*socket*") or
  (process.name in ("awk", "gawk", "nawk") and process.command_line like~ "*/inet/tcp*") or
  (process.name in ("rvim", "vim", "vimdiff", "rview", "view") and process.args == "-c" and process.command_line like~ "*socket*")
 ) and
not (process.parent.executable == "/usr/lib/git-core/git-difftool--helper")
'''

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 == "nmap" and process.args like~ "--script=/tmp/tmp.*") or
  (process.name like "lua*" and process.args == "-e" and process.command_line like~ "*socket*") or
  (process.name in ("awk", "gawk", "nawk") and process.command_line like~ "*/inet/tcp*") or
  (process.name in ("rvim", "vim", "vimdiff", "rview", "view") and process.args == "-c" and process.command_line like~ "*socket*")
 ) and
not (process.parent.executable == "/usr/lib/git-core/git-difftool--helper")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.parent.executableeq/usr/lib/git-core/git-difftool--helperexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/lib/git-core/git-difftool--helper"

Indicators

These rows show field, operator, and value matches.