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"
 5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
 6min_stack_version = "8.3.0"
 7updated_date = "2024/03/08"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Monitors for the execution of a netcat listener via rlwrap. rlwrap is a 'readline wrapper', a small utility that uses
13the GNU Readline library to allow the editing of keyboard input for any command. This utility can be used in conjunction 
14with netcat to gain a more stable reverse shell.
15"""
16false_positives = [
17    """
18    Netcat is a dual-use tool that can be used for benign or malicious activity. Netcat is included in some Linux
19    distributions so its presence is not necessarily suspicious. Some normal use of this program, while uncommon, may
20    originate from scripts, automation tools, and frameworks.
21    """,
22]
23from = "now-9m"
24index = ["logs-endpoint.events.*", "endgame-*"]
25language = "eql"
26license = "Elastic License v2"
27name = "Netcat Listener Established via rlwrap"
28risk_score = 21
29rule_id = "0f56369f-eb3d-459c-a00b-87c2bf7bdfc5"
30setup = """## Setup
31
32This rule requires data coming in from Elastic Defend.
33
34### Elastic Defend Integration Setup
35Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows
36the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
37
38#### Prerequisite Requirements:
39- Fleet is required for Elastic Defend.
40- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
41
42#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
43- Go to the Kibana home page and click "Add integrations".
44- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
45- Click "Add Elastic Defend".
46- Configure the integration name and optionally add a description.
47- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
48- 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).
49- We suggest to select "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
50- 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.
51For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
52- Click "Save and Continue".
53- 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.
54For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
55"""
56severity = "low"
57tags = ["Domain: Endpoint",
58        "OS: Linux",
59        "Use Case: Threat Detection",
60        "Tactic: Execution",
61        "Data Source: Elastic Defend",
62        "Data Source: Elastic Endgame"
63        ]
64timestamp_override = "event.ingested"
65type = "eql"
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[[rule.threat]]
73framework = "MITRE ATT&CK"
74
75[[rule.threat.technique]]
76id = "T1059"
77name = "Command and Scripting Interpreter"
78reference = "https://attack.mitre.org/techniques/T1059/"
79
80[[rule.threat.technique.subtechnique]]
81id = "T1059.004"
82name = "Unix Shell"
83reference = "https://attack.mitre.org/techniques/T1059/004/"
84
85[rule.threat.tactic]
86id = "TA0002"
87name = "Execution"
88reference = "https://attack.mitre.org/tactics/TA0002/"

Related rules

to-top