Potential Meterpreter Reverse Shell
This detection rule identifies a sample of suspicious Linux system file reads used for system fingerprinting, leveraged by the Metasploit Meterpreter shell to gather information about the target that it is executing its shell on. Detecting this pattern is indicative of a successful meterpreter shell connection.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2023/08/10"
3integration = ["auditd_manager"]
4maturity = "production"
5min_stack_comments = "The sampling feature within EQL was introduced in 8.6.0"
6min_stack_version = "8.6.0"
7updated_date = "2023/08/10"
8
9[rule]
10author = ["Elastic"]
11description = """
12This detection rule identifies a sample of suspicious Linux system file reads used for system fingerprinting, leveraged
13by the Metasploit Meterpreter shell to gather information about the target that it is executing its shell on. Detecting
14this pattern is indicative of a successful meterpreter shell connection.
15"""
16from = "now-9m"
17index = ["auditbeat-*", "logs-auditd_manager.auditd-*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Potential Meterpreter Reverse Shell"
21note = """## Setup
22This rule requires the use of the `auditd_manager` integration. `Auditd_manager` is a tool designed to simplify and enhance the management of the audit subsystem in Linux systems. It provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With `auditd_manager`, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system. The following steps should be executed in order to install and deploy `auditd_manager` on a Linux system.
Kibana --> Management --> Integrations --> Auditd Manager --> Add Auditd Manager
1
2`Auditd_manager` subscribes to the kernel and receives events as they occur without any additional configuration. However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.
3
4For this detection rule to trigger, the following additional audit rules are required to be added to the integration:
-w /proc/net/ -p r -k audit_proc -w /etc/machine-id -p wa -k machineid -w /etc/passwd -p wa -k passwd
1
2Add the newly installed `auditd manager` to an agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
3"""
4risk_score = 47
5rule_id = "5c895b4f-9133-4e68-9e23-59902175355c"
6severity = "medium"
7tags = ["Domain: Endpoint", "OS: Linux", "Use Case: Threat Detection", "Tactic: Execution"]
8timestamp_override = "event.ingested"
9type = "eql"
10query = '''
11sample by host.id, process.pid, user.id
12[file where host.os.type == "linux" and event.dataset == "auditd_manager.auditd" and auditd.data.syscall == "open" and
13 auditd.data.a2 == "1b6" and file.path == "/etc/machine-id"]
14[file where host.os.type == "linux" and event.dataset == "auditd_manager.auditd" and auditd.data.syscall == "open" and
15 auditd.data.a2 == "1b6" and file.path == "/etc/passwd"]
16[file where host.os.type == "linux" and event.dataset == "auditd_manager.auditd" and auditd.data.syscall == "open" and
17 auditd.data.a2 == "1b6" and file.path == "/proc/net/route"]
18[file where host.os.type == "linux" and event.dataset == "auditd_manager.auditd" and auditd.data.syscall == "open" and
19 auditd.data.a2 == "1b6" and file.path == "/proc/net/ipv6_route"]
20[file where host.os.type == "linux" and event.dataset == "auditd_manager.auditd" and auditd.data.syscall == "open" and
21 auditd.data.a2 == "1b6" and file.path == "/proc/net/if_inet6"]
22'''
23
24[[rule.threat]]
25framework = "MITRE ATT&CK"
26
27[rule.threat.tactic]
28name = "Execution"
29id = "TA0002"
30reference = "https://attack.mitre.org/tactics/TA0002/"
31
32[[rule.threat.technique]]
33id = "T1059"
34name = "Command and Scripting Interpreter"
35reference = "https://attack.mitre.org/techniques/T1059/"
36
37[[rule.threat.technique.subtechnique]]
38id = "T1059.004"
39name = "Unix Shell"
40reference = "https://attack.mitre.org/techniques/T1059/004/"
41
42[[rule.threat]]
43framework = "MITRE ATT&CK"
44
45[rule.threat.tactic]
46name = "Command and Control"
47id = "TA0011"
48reference = "https://attack.mitre.org/tactics/TA0011/"
49
50[[rule.threat.technique]]
51name = "Application Layer Protocol"
52id = "T1071"
53reference = "https://attack.mitre.org/techniques/T1071/"
Setup
This rule requires the use of the auditd_manager
integration. Auditd_manager
is a tool designed to simplify and enhance the management of the audit subsystem in Linux systems. It provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With auditd_manager
, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system. The following steps should be executed in order to install and deploy auditd_manager
on a Linux system.
1Kibana -->
2Management -->
3Integrations -->
4Auditd Manager -->
5Add Auditd Manager
Auditd_manager
subscribes to the kernel and receives events as they occur without any additional configuration. However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.
For this detection rule to trigger, the following additional audit rules are required to be added to the integration:
1-w /proc/net/ -p r -k audit_proc
2-w /etc/machine-id -p wa -k machineid
3-w /etc/passwd -p wa -k passwd
Add the newly installed auditd manager
to an agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
Related rules
- BPF filter applied using TC
- Binary Executed from Shared Memory Directory
- Cron Job Created or Changed by Previously Unknown Process
- EggShell Backdoor Execution
- File Transfer or Listener Established via Netcat