Detection rules › Elastic

Suspicious Network Connection via Installer Package

Time window
30s
Sequence by
user.id
Source
github.com/elastic/protections-artifacts

Detects the execution of a MacOS installer package with an abnormal child process (e.g bash) followed immediately by a network connection via a suspicious process (e.g curl). Threat actors will build and distribute malicious MacOS installer packages, which have a .pkg extension, many times imitating valid software in order to persuade and infect their victims often using the package files (e.g pre/post install scripts etc.) to download additional tools or malicious software. If this rule fires it should indicate a the installation of a malicious or suspicious package.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

[rule]
description = """
Detects the execution of a MacOS installer package with an abnormal child process (e.g bash) followed immediately by a
network connection via a suspicious process (e.g curl). Threat actors will build and distribute malicious MacOS
installer packages, which have a .pkg extension, many times imitating valid software in order to persuade and infect
their victims often using the package files (e.g pre/post install scripts etc.) to download additional tools or
malicious software. If this rule fires it should indicate a the installation of a malicious or suspicious package.
"""
id = "912f0c30-a7c5-40a5-80e3-a50c6714632f"
license = "Elastic License v2"
name = "Suspicious Network Connection via Installer Package"
os_list = ["macos"]
reference = ["https://redcanary.com/blog/clipping-silver-sparrows-wings"]
version = "1.0.39"

query = '''
sequence by user.id with maxspan=30s
[process where event.type == "start" and event.action == "exec" and 
  process.parent.name in ("installer", "package_script_service") and 
  process.name like ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "fish", "python*", "osascript", "tclsh*") and
  process.args like ("/Users/*", "/Volumes/*")] 
[process where event.type == "start" and 
 process.parent.pid == 1 and 
  (process.name in ("curl", "wget", "nscurl") or
  (process.name == "osascript" and process.args like~ "*.js"))] as event1
[network where event.type == "start" and 
 process.name in ("curl", "osascript", "wget", "nscurl") and process.pid == event1.process.pid]
'''

min_endpoint_version = "8.4.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[threat.technique.subtechnique]]
id = "T1071.001"
name = "Web Protocols"
reference = "https://attack.mitre.org/techniques/T1071/001/"



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

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 30s, correlated by user.id.

Stage 1: process

[process where event.type == "start" and event.action == "exec" and 
  process.parent.name in ("installer", "package_script_service") and 
  process.name like ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "fish", "python*", "osascript", "tclsh*") and
  process.args like ("/Users/*", "/Volumes/*")]

Stage 2: process

[process where event.type == "start" and 
 process.parent.pid == 1 and 
  (process.name in ("curl", "wget", "nscurl") or
  (process.name == "osascript" and process.args like~ "*.js"))] as event1

Stage 3: network

[network where event.type == "start" and 
 process.name in ("curl", "osascript", "wget", "nscurl") and process.pid == event1.process.pid]

Indicators

These rows show field, operator, and value matches.