Detection rules › Elastic
Possible JAVA Reverse Shell
Identifies the execution of a shell process from a Java JAR application post an incoming network connection. This behavior may indicate a reverse shell activity via malicious Java application.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule body
[rule]
description = """
Identifies the execution of a shell process from a Java JAR application post an incoming network connection. This
behavior may indicate a reverse shell activity via malicious Java application.
"""
id = "41dcfe9e-9170-4ffe-b620-351736366ced"
license = "Elastic License v2"
name = "Possible JAVA Reverse Shell"
os_list = ["macos"]
version = "1.0.10"
query = '''
sequence with maxspan=5s
[network where event.action in ("connection_accepted", "connection_attempted") and
process.name in ("java", "javaw")] by process.entity_id
[process where event.action == "start" and process.parent.name like "java" and
process.parent.args like~ "-jar" and
process.name in ("bash", "sh", "zsh")] by process.parent.entity_id
'''
min_endpoint_version = "8.16.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.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 = "8.16.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5s, correlated by process.entity_id, process.parent.entity_id.
Stage 1: network
[network where event.action in ("connection_accepted", "connection_attempted") and
process.name in ("java", "javaw")] by process.entity_id
Stage 2: process
[process where event.action == "start" and process.parent.name like "java" and
process.parent.args like~ "-jar" and
process.name in ("bash", "sh", "zsh")] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | in |
| field:"EventType" kind:in |
process.name | in |
| field:"process_name" kind:in |
process.parent.args | wildcard |
| field:"process.parent.args" kind:wildcard value:"-jar" |
process.parent.name | wildcard |
| field:"parent_process_name" kind:wildcard value:"java" |