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/06/22"
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"
36severity = "medium"
37tags = ["Domain: Endpoint", "OS: macOS", "Use Case: Threat Detection", "Tactic: Execution", "Tactic: Command and Control", "Data Source: Elastic Defend"]
38type = "eql"
39
40query = '''
41sequence by host.id, user.id with maxspan=30s
42[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*")]
43[network where host.os.type == "macos" and event.type == "start" and process.name : ("curl", "osascript", "wget", "python")]
44'''
45
46
47[[rule.threat]]
48framework = "MITRE ATT&CK"
49[[rule.threat.technique]]
50id = "T1059"
51name = "Command and Scripting Interpreter"
52reference = "https://attack.mitre.org/techniques/T1059/"
53[[rule.threat.technique.subtechnique]]
54id = "T1059.007"
55name = "JavaScript"
56reference = "https://attack.mitre.org/techniques/T1059/007/"
57
58
59
60[rule.threat.tactic]
61id = "TA0002"
62name = "Execution"
63reference = "https://attack.mitre.org/tactics/TA0002/"
64[[rule.threat]]
65framework = "MITRE ATT&CK"
66[[rule.threat.technique]]
67id = "T1071"
68name = "Application Layer Protocol"
69reference = "https://attack.mitre.org/techniques/T1071/"
70[[rule.threat.technique.subtechnique]]
71id = "T1071.001"
72name = "Web Protocols"
73reference = "https://attack.mitre.org/techniques/T1071/001/"
74
75
76
77[rule.threat.tactic]
78id = "TA0011"
79name = "Command and Control"
80reference = "https://attack.mitre.org/tactics/TA0011/"
References
Related rules
- Apple Script Execution followed by Network Connection
- Apple Scripting Execution with Administrator Privileges
- Creation of Hidden Login Item via Apple Script
- EggShell Backdoor Execution
- Execution via Electron Child Process Node.js Module