Detection rules › Elastic

Curl Execution via Env Binary

Time window
30s
Sequence by
process.parent.entity_id
Source
github.com/elastic/protections-artifacts

Detects when curl is executed via the env binary. This is a common technique used by adversaries to avoid standard curl focused detections.

MITRE ATT&CK coverage

TacticTechniques
Command & Control

Rule body

[rule]
description = """
Detects when curl is executed via the env binary. This is a common technique used by adversaries to avoid standard curl
focused detections.
"""
id = "6fbfa489-517a-4b1a-ada6-e88da2012e7b"
license = "Elastic License v2"
name = "Curl Execution via Env Binary"
os_list = ["macos"]
version = "1.0.8"

query = '''
sequence by process.parent.entity_id with maxspan=30s
[process where event.type == "start" and process.name == "env" and 
  process.args == "-c" and process.args like~ ("*curl*", "*nscurl*")]
[process where event.type == "start" and 
  process.name in ("bash", "sh", "zsh") and
  process.args == "-c" and process.args like~ ("*curl*", "*nscurl*")]
[process where event.type == "start" and process.name in ("curl", "nscurl") and
  not process.parent.executable like ("/Library/Developer/*", "/opt/homebrew/Cellar/*", "/Applications/Xcode.app/Contents/Developer/usr/bin/make")]
'''

min_endpoint_version = "8.5.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 2

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"


[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[internal]
min_endpoint_version = "8.5.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 30s, correlated by process.parent.entity_id.

Stage 1: process

[process where event.type == "start" and process.name == "env" and 
  process.args == "-c" and process.args like~ ("*curl*", "*nscurl*")]

Stage 2: process

[process where event.type == "start" and 
  process.name in ("bash", "sh", "zsh") and
  process.args == "-c" and process.args like~ ("*curl*", "*nscurl*")]

Stage 3: process

[process where event.type == "start" and process.name in ("curl", "nscurl") and
  not process.parent.executable like ("/Library/Developer/*", "/opt/homebrew/Cellar/*", "/Applications/Xcode.app/Contents/Developer/usr/bin/make")]

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.