Suspicious Hidden Child Process of Launchd
Identifies the execution of a launchd child process with a hidden file. An adversary can establish persistence by installing a new logon item, launch agent, or daemon that executes upon login.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/01/07"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2025/01/15"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies the execution of a launchd child process with a hidden file. An adversary can establish persistence by
11installing a new logon item, launch agent, or daemon that executes upon login.
12"""
13from = "now-9m"
14index = ["logs-endpoint.events.*"]
15language = "kuery"
16license = "Elastic License v2"
17name = "Suspicious Hidden Child Process of Launchd"
18references = [
19 "https://objective-see.com/blog/blog_0x61.html",
20 "https://www.intezer.com/blog/research/operation-electrorat-attacker-creates-fake-companies-to-drain-your-crypto-wallets/",
21 "https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html",
22]
23risk_score = 47
24rule_id = "083fa162-e790-4d85-9aeb-4fea04188adb"
25setup = """## Setup
26
27This rule requires data coming in from Elastic Defend.
28
29### Elastic Defend Integration Setup
30Elastic 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.
31
32#### Prerequisite Requirements:
33- Fleet is required for Elastic Defend.
34- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
35
36#### The following steps should be executed in order to add the Elastic Defend integration on a macOS System:
37- Go to the Kibana home page and click "Add integrations".
38- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
39- Click "Add Elastic Defend".
40- Configure the integration name and optionally add a description.
41- Select the type of environment you want to protect, for MacOS it is recommended to select "Traditional Endpoints".
42- 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).
43- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
44- 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.
45For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
46- Click "Save and Continue".
47- 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.
48For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
49"""
50severity = "medium"
51tags = [
52 "Domain: Endpoint",
53 "OS: macOS",
54 "Use Case: Threat Detection",
55 "Tactic: Persistence",
56 "Tactic: Defense Evasion",
57 "Data Source: Elastic Defend",
58 "Resources: Investigation Guide",
59]
60timestamp_override = "event.ingested"
61type = "query"
62
63query = '''
64event.category:process and host.os.type:macos and event.type:(start or process_started) and
65 process.name:.* and process.parent.executable:/sbin/launchd
66'''
67note = """## Triage and analysis
68
69> **Disclaimer**:
70> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
71
72### Investigating Suspicious Hidden Child Process of Launchd
73
74Launchd is a key macOS system process responsible for managing system and user services. Adversaries may exploit it by creating hidden child processes to maintain persistence or evade defenses. The detection rule identifies unusual child processes of launchd, focusing on hidden files, which are often indicative of malicious activity. By monitoring process initiation events, it helps uncover potential threats linked to persistence and defense evasion tactics.
75
76### Possible investigation steps
77
78- Review the process details to identify the hidden child process, focusing on the process.name field to determine if it matches known malicious patterns or unusual names.
79- Examine the process.parent.executable field to confirm that the parent process is indeed /sbin/launchd, ensuring the alert is not a false positive.
80- Investigate the file path and attributes of the hidden file associated with the child process to determine its origin and legitimacy.
81- Check the user account associated with the process initiation event to assess if it aligns with expected user behavior or if it indicates potential compromise.
82- Correlate the event with other recent process initiation events on the same host to identify any patterns or additional suspicious activities.
83- Review system logs and other security alerts for the host to gather more context on the potential threat and assess the scope of the activity.
84
85### False positive analysis
86
87- System updates or legitimate software installations may trigger hidden child processes of launchd. Users can create exceptions for known update processes or trusted software installations to prevent unnecessary alerts.
88- Some legitimate applications may use hidden files for configuration or temporary data storage, which could be misidentified as suspicious. Users should identify these applications and whitelist their processes to reduce false positives.
89- Development tools or scripts that run as background processes might appear as hidden child processes. Developers can exclude these tools by specifying their process names or paths in the detection rule exceptions.
90- Automated backup or synchronization services might create hidden files as part of their normal operation. Users should verify these services and add them to an exclusion list if they are deemed safe.
91- Custom scripts or automation tasks scheduled to run at login could be flagged. Users should review these scripts and, if legitimate, configure the rule to ignore these specific processes.
92
93### Response and remediation
94
95- Isolate the affected macOS system from the network to prevent further spread or communication with potential command and control servers.
96- Terminate the suspicious hidden child process of launchd to stop any ongoing malicious activity.
97- Conduct a thorough review of all launch agents, daemons, and logon items on the affected system to identify and remove any unauthorized or malicious entries.
98- Restore the system from a known good backup if available, ensuring that the backup predates the initial compromise.
99- Update the macOS system and all installed applications to the latest versions to patch any vulnerabilities that may have been exploited.
100- Monitor the system for any signs of re-infection or further suspicious activity, focusing on process initiation events and hidden files.
101- Escalate the incident to the security operations team for further investigation and to determine if additional systems may be affected."""
102
103
104[[rule.threat]]
105framework = "MITRE ATT&CK"
106[[rule.threat.technique]]
107id = "T1543"
108name = "Create or Modify System Process"
109reference = "https://attack.mitre.org/techniques/T1543/"
110[[rule.threat.technique.subtechnique]]
111id = "T1543.001"
112name = "Launch Agent"
113reference = "https://attack.mitre.org/techniques/T1543/001/"
114
115
116
117[rule.threat.tactic]
118id = "TA0003"
119name = "Persistence"
120reference = "https://attack.mitre.org/tactics/TA0003/"
121[[rule.threat]]
122framework = "MITRE ATT&CK"
123[[rule.threat.technique]]
124id = "T1564"
125name = "Hide Artifacts"
126reference = "https://attack.mitre.org/techniques/T1564/"
127[[rule.threat.technique.subtechnique]]
128id = "T1564.001"
129name = "Hidden Files and Directories"
130reference = "https://attack.mitre.org/techniques/T1564/001/"
131
132
133
134[rule.threat.tactic]
135id = "TA0005"
136name = "Defense Evasion"
137reference = "https://attack.mitre.org/tactics/TA0005/"
Triage and analysis
Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
Investigating Suspicious Hidden Child Process of Launchd
Launchd is a key macOS system process responsible for managing system and user services. Adversaries may exploit it by creating hidden child processes to maintain persistence or evade defenses. The detection rule identifies unusual child processes of launchd, focusing on hidden files, which are often indicative of malicious activity. By monitoring process initiation events, it helps uncover potential threats linked to persistence and defense evasion tactics.
Possible investigation steps
- Review the process details to identify the hidden child process, focusing on the process.name field to determine if it matches known malicious patterns or unusual names.
- Examine the process.parent.executable field to confirm that the parent process is indeed /sbin/launchd, ensuring the alert is not a false positive.
- Investigate the file path and attributes of the hidden file associated with the child process to determine its origin and legitimacy.
- Check the user account associated with the process initiation event to assess if it aligns with expected user behavior or if it indicates potential compromise.
- Correlate the event with other recent process initiation events on the same host to identify any patterns or additional suspicious activities.
- Review system logs and other security alerts for the host to gather more context on the potential threat and assess the scope of the activity.
False positive analysis
- System updates or legitimate software installations may trigger hidden child processes of launchd. Users can create exceptions for known update processes or trusted software installations to prevent unnecessary alerts.
- Some legitimate applications may use hidden files for configuration or temporary data storage, which could be misidentified as suspicious. Users should identify these applications and whitelist their processes to reduce false positives.
- Development tools or scripts that run as background processes might appear as hidden child processes. Developers can exclude these tools by specifying their process names or paths in the detection rule exceptions.
- Automated backup or synchronization services might create hidden files as part of their normal operation. Users should verify these services and add them to an exclusion list if they are deemed safe.
- Custom scripts or automation tasks scheduled to run at login could be flagged. Users should review these scripts and, if legitimate, configure the rule to ignore these specific processes.
Response and remediation
- Isolate the affected macOS system from the network to prevent further spread or communication with potential command and control servers.
- Terminate the suspicious hidden child process of launchd to stop any ongoing malicious activity.
- Conduct a thorough review of all launch agents, daemons, and logon items on the affected system to identify and remove any unauthorized or malicious entries.
- Restore the system from a known good backup if available, ensuring that the backup predates the initial compromise.
- Update the macOS system and all installed applications to the latest versions to patch any vulnerabilities that may have been exploited.
- Monitor the system for any signs of re-infection or further suspicious activity, focusing on process initiation events and hidden files.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems may be affected.
References
Related rules
- Creation of Hidden Launch Agent or Daemon
- APT Package Manager Configuration File Creation
- Attempt to Disable Gatekeeper
- Attempt to Enable the Root Account
- Attempt to Install Root Certificate