MacOS Installer Package Spawns Network Event

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 the installation of a malicious or suspicious package.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2021/02/23"
  3integration = ["endpoint"]
  4maturity = "production"
  5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
  6min_stack_version = "8.3.0"
  7updated_date = "2023/11/15"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Detects the execution of a MacOS installer package with an abnormal child process (e.g bash) followed immediately by a
 13network connection via a suspicious process (e.g curl). Threat actors will build and distribute malicious MacOS
 14installer packages, which have a .pkg extension, many times imitating valid software in order to persuade and infect
 15their victims often using the package files (e.g pre/post install scripts etc.) to download additional tools or
 16malicious software. If this rule fires it should indicate the installation of a malicious or suspicious package.
 17"""
 18false_positives = [
 19    """
 20    Custom organization-specific macOS packages that use .pkg files to run cURL could trigger this rule. If known
 21    behavior is causing false positives, it can be excluded from the rule.
 22    """,
 23]
 24from = "now-9m"
 25index = ["logs-endpoint.events.*"]
 26language = "eql"
 27license = "Elastic License v2"
 28name = "MacOS Installer Package Spawns Network Event"
 29references = [
 30    "https://redcanary.com/blog/clipping-silver-sparrows-wings",
 31    "https://posts.specterops.io/introducing-mystikal-4fbd2f7ae520",
 32    "https://github.com/D00MFist/Mystikal",
 33]
 34risk_score = 47
 35rule_id = "99239e7d-b0d4-46e3-8609-acafcf99f68c"
 36setup = """## Setup
 37
 38This rule requires data coming in from Elastic Defend.
 39
 40### Elastic Defend Integration Setup
 41Elastic 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.
 42
 43#### Prerequisite Requirements:
 44- Fleet is required for Elastic Defend.
 45- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 46
 47#### The following steps should be executed in order to add the Elastic Defend integration on a macOS System:
 48- Go to the Kibana home page and click "Add integrations".
 49- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 50- Click "Add Elastic Defend".
 51- Configure the integration name and optionally add a description.
 52- Select the type of environment you want to protect, for MacOS it is recommended to select "Traditional Endpoints".
 53- 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](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
 54- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 55- 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.
 56For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
 57- Click "Save and Continue".
 58- 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.
 59For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 60"""
 61severity = "medium"
 62tags = ["Domain: Endpoint", "OS: macOS", "Use Case: Threat Detection", "Tactic: Execution", "Tactic: Command and Control", "Data Source: Elastic Defend"]
 63type = "eql"
 64
 65query = '''
 66sequence by host.id, user.id with maxspan=30s
 67[process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and process.parent.name : ("installer", "package_script_service") and process.name : ("bash", "sh", "zsh", "python", "osascript", "tclsh*")]
 68[network where host.os.type == "macos" and event.type == "start" and process.name : ("curl", "osascript", "wget", "python")]
 69'''
 70
 71
 72[[rule.threat]]
 73framework = "MITRE ATT&CK"
 74[[rule.threat.technique]]
 75id = "T1059"
 76name = "Command and Scripting Interpreter"
 77reference = "https://attack.mitre.org/techniques/T1059/"
 78[[rule.threat.technique.subtechnique]]
 79id = "T1059.007"
 80name = "JavaScript"
 81reference = "https://attack.mitre.org/techniques/T1059/007/"
 82
 83
 84
 85[rule.threat.tactic]
 86id = "TA0002"
 87name = "Execution"
 88reference = "https://attack.mitre.org/tactics/TA0002/"
 89[[rule.threat]]
 90framework = "MITRE ATT&CK"
 91[[rule.threat.technique]]
 92id = "T1071"
 93name = "Application Layer Protocol"
 94reference = "https://attack.mitre.org/techniques/T1071/"
 95[[rule.threat.technique.subtechnique]]
 96id = "T1071.001"
 97name = "Web Protocols"
 98reference = "https://attack.mitre.org/techniques/T1071/001/"
 99
100
101
102[rule.threat.tactic]
103id = "TA0011"
104name = "Command and Control"
105reference = "https://attack.mitre.org/tactics/TA0011/"

References

Related rules

to-top