Curl Execution via Shell Profile

Last updated a month ago on 2026-01-30
Created a month ago on 2026-01-30

About

Detects when curl is executed via a shell profile upon login. This indicates a curl command was added to the user's shell profile (like .zshrc or .bashrc) and is executed automatically at login, which could be used for persistence and payload delivery.
Tags
Domain: EndpointOS: macOSUse Case: Threat DetectionTactic: PersistenceTactic: Command and ControlData Source: Elastic DefendLanguage: eql
Severity
high
Risk Score
73
MITRE ATT&CK™

Persistence (TA0003)(external, opens in a new tab or window)

Command and Control (TA0011)(external, opens in a new tab or window)

License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-endpoint.events.process-*
Related Integrations

endpoint(external, opens in a new tab or window)

Query
text code block:
sequence with maxspan=10s [process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and process.name in ("bash", "zsh", "sh") and process.args in ("-zsh", "-sh", "-bash") and process.args_count == 1 and process.parent.name == "login"] by process.entity_id [process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl") and process.args in ("-o", "--output", "--download", "-dl", "-dir", "--directory", "-F", "--form") and not process.args like ("https://upload.elastic.co*", "https://vault-ci-prod.elastic.dev", "https://artifacts.elastic.co*")] by process.parent.entity_id

Install detection rules in Elastic Security

Detect Curl Execution via Shell Profile in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).