Detection rules › Elastic

URL as Process Argument via Installer Package

Source
github.com/elastic/protections-artifacts

Detects when a url is supplied as a command line argument to an installer package binary via the installer process itself. This technique is a creative way to download a second stage payload and evade curl based detections. This activity can be observed when in a pre or post install script it specifies a url as an argument to a binary included in the package that when executed will reach out to the specified url.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Detects when a url is supplied as a command line argument to an installer package binary via the installer process
itself. This technique is a creative way to download a second stage payload and evade curl based detections. This
activity can be observed when in a pre or post install script it specifies a url as an argument to a binary included in
the package that when executed will reach out to the specified url.
"""
id = "b06dcea7-9ef3-428d-bd4d-80004f69200f"
license = "Elastic License v2"
name = "URL as Process Argument via Installer Package"
os_list = ["macos"]
version = "1.0.8"

query = '''
process where event.type == "start" and 
 process.Ext.effective_parent.executable like~ ("/usr/sbin/installer", "/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer") and
 process.args like~ ("http://*", "https://*") and
 not process.name in ("wget", "curl", "git", "nscurl") and
 not process.executable like ("/opt/homebrew/*", "/usr/local/Cellar/*", "/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksadmin") and
 not process.code_signature.team_id == "PXPZ95SK77"
'''

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

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

[[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.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.7.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and 
 process.Ext.effective_parent.executable like~ ("/usr/sbin/installer", "/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer") and
 process.args like~ ("http://*", "https://*") and
 not process.name in ("wget", "curl", "git", "nscurl") and
 not process.executable like ("/opt/homebrew/*", "/usr/local/Cellar/*", "/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksadmin") and
 not process.code_signature.team_id == "PXPZ95SK77"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.team_ideqPXPZ95SK77excludes:process.code_signature.team_id field:"process.code_signature.team_id" value:"PXPZ95SK77"
process.executablewildcard/opt/homebrew/*, /usr/local/Cellar/*, /Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksadminexcludes:process.executable field:"process.executable" value:"/opt/homebrew/*" field:"process.executable" value:"/usr/local/Cellar/*" field:"process.executable" value:"/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksadmin"
process.nameincurl, git, nscurl, wgetexcludes:process.name

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.Ext.effective_parent.executablewildcard
  • /System/Library/CoreServices/Installer.app/Contents/MacOS/Installer
  • /usr/sbin/installer
field:"process.Ext.effective_parent.executable" kind:wildcard
process.argswildcard
  • http://*
  • https://*
field:"process.args" kind:wildcard