Interactive Terminal Spawned via Perl

Identifies when a terminal (tty) is spawned via Perl. Attackers may upgrade a simple reverse shell to a fully interactive tty after obtaining initial access to a host.

Elastic rule (View on GitHub)

 2creation_date = "2020/04/16"
 3integration = ["endpoint"]
 4maturity = "production"
 5updated_date = "2024/05/21"
 8author = ["Elastic"]
 9description = """
10Identifies when a terminal (tty) is spawned via Perl. Attackers may upgrade a simple reverse shell to a fully
11interactive tty after obtaining initial access to a host.
13from = "now-9m"
14index = ["auditbeat-*", "*", "endgame-*"]
15language = "kuery"
16license = "Elastic License v2"
17name = "Interactive Terminal Spawned via Perl"
18risk_score = 73
19rule_id = "05e5a668-7b51-4a67-93ab-e9af405c9ef3"
20setup = """## Setup
22This rule requires data coming in from one of the following integrations:
23- Elastic Defend
24- Auditbeat
26### Elastic Defend Integration Setup
27Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
29#### Prerequisite Requirements:
30- Fleet is required for Elastic Defend.
31- To configure Fleet Server refer to the [documentation](
33#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
34- Go to the Kibana home page and click "Add integrations".
35- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
36- Click "Add Elastic Defend".
37- Configure the integration name and optionally add a description.
38- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
39- 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](
40- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
41- 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.
42For more details on Elastic Agent configuration settings, refer to the [helper guide](
43- Click "Save and Continue".
44- 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.
45For more details on Elastic Defend refer to the [helper guide](
47### Auditbeat Setup
48Auditbeat is a lightweight shipper that you can install on your servers to audit the activities of users and processes on your systems. For example, you can use Auditbeat to collect and centralize audit events from the Linux Audit Framework. You can also use Auditbeat to detect changes to critical files, like binaries and configuration files, and identify potential security policy violations.
50#### The following steps should be executed in order to add the Auditbeat on a Linux System:
51- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
52- To install the APT and YUM repositories follow the setup instructions in this [helper guide](
53- To run Auditbeat on Docker follow the setup instructions in the [helper guide](
54- To run Auditbeat on Kubernetes follow the setup instructions in the [helper guide](
55- For complete “Setup and Run Auditbeat” information refer to the [helper guide](
57severity = "high"
58tags = [
59    "Domain: Endpoint",
60    "OS: Linux",
61    "Use Case: Threat Detection",
62    "Tactic: Execution",
63    "Data Source: Elastic Endgame",
64    "Data Source: Elastic Defend",
66timestamp_override = "event.ingested"
67type = "query"
69query = '''
70event.category:process and host.os.type:linux and event.type:(start or process_started) and and
71  process.args:("exec \"/bin/sh\";" or "exec \"/bin/dash\";" or "exec \"/bin/bash\";")
76framework = "MITRE ATT&CK"
78id = "T1059"
79name = "Command and Scripting Interpreter"
80reference = ""
84id = "TA0002"
85name = "Execution"
86reference = ""

Related rules