Netcat Listener Established via rlwrap
Monitors for the execution of a netcat listener via rlwrap. rlwrap is a 'readline wrapper', a small utility that uses the GNU Readline library to allow the editing of keyboard input for any command. This utility can be used in conjunction with netcat to gain a more stable reverse shell.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2023/09/22"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/05/21"
6
7[rule]
8author = ["Elastic"]
9description = """
10Monitors for the execution of a netcat listener via rlwrap. rlwrap is a 'readline wrapper', a small utility that uses
11the GNU Readline library to allow the editing of keyboard input for any command. This utility can be used in conjunction
12with netcat to gain a more stable reverse shell.
13"""
14false_positives = [
15 """
16 Netcat is a dual-use tool that can be used for benign or malicious activity. Netcat is included in some Linux
17 distributions so its presence is not necessarily suspicious. Some normal use of this program, while uncommon, may
18 originate from scripts, automation tools, and frameworks.
19 """,
20]
21from = "now-9m"
22index = ["logs-endpoint.events.*", "endgame-*"]
23language = "eql"
24license = "Elastic License v2"
25name = "Netcat Listener Established via rlwrap"
26risk_score = 21
27rule_id = "0f56369f-eb3d-459c-a00b-87c2bf7bdfc5"
28setup = """## Setup
29
30This rule requires data coming in from Elastic Defend.
31
32### Elastic Defend Integration Setup
33Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows
34the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
35
36#### Prerequisite Requirements:
37- Fleet is required for Elastic Defend.
38- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
39
40#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
41- Go to the Kibana home page and click "Add integrations".
42- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
43- Click "Add Elastic Defend".
44- Configure the integration name and optionally add a description.
45- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
46- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
47- We suggest to select "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
48- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
49For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
50- Click "Save and Continue".
51- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
52For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
53"""
54severity = "low"
55tags = [
56 "Domain: Endpoint",
57 "OS: Linux",
58 "Use Case: Threat Detection",
59 "Tactic: Execution",
60 "Data Source: Elastic Defend",
61 "Data Source: Elastic Endgame",
62]
63timestamp_override = "event.ingested"
64type = "eql"
65
66query = '''
67process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and
68process.name == "rlwrap" and process.args in ("nc", "ncat", "netcat", "nc.openbsd", "socat") and
69process.args : "*l*" and process.args_count >= 4
70'''
71
72
73[[rule.threat]]
74framework = "MITRE ATT&CK"
75[[rule.threat.technique]]
76id = "T1059"
77name = "Command and Scripting Interpreter"
78reference = "https://attack.mitre.org/techniques/T1059/"
79[[rule.threat.technique.subtechnique]]
80id = "T1059.004"
81name = "Unix Shell"
82reference = "https://attack.mitre.org/techniques/T1059/004/"
83
84
85
86[rule.threat.tactic]
87id = "TA0002"
88name = "Execution"
89reference = "https://attack.mitre.org/tactics/TA0002/"
Related rules
- BPF filter applied using TC
- Binary Executed from Shared Memory Directory
- Interactive Terminal Spawned via Perl
- Interactive Terminal Spawned via Python
- Potential Reverse Shell via Background Process