Persistence via Suspicious Launch Agent or Launch Daemon

Identifies the creation of a launch agent or daemon property list file containing abnormal or suspicious values. An adversary may establish persistence by installing a new launch agent or daemon which executes at login. This rule looks for plist files created in LaunchAgents/LaunchDaemons directories with paths commonly used by malware.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/01/30"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2026/11/09"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies the creation of a launch agent or daemon property list file containing abnormal or suspicious 
 11values. An adversary may establish persistence by installing a new launch agent or daemon which executes 
 12at login. This rule looks for plist files created in LaunchAgents/LaunchDaemons directories with paths 
 13commonly used by malware.
 14"""
 15from = "now-9m"
 16index = ["logs-endpoint.events.file-*"]
 17language = "eql"
 18license = "Elastic License v2"
 19name = "Persistence via Suspicious Launch Agent or Launch Daemon"
 20references = [
 21    "https://medium.com/red-teaming-with-a-blue-team-mentality/a-brief-look-at-macos-detections-and-post-infection-analysis-b0ede7ecfeb9",
 22    "https://objective-see.org/blog",
 23    "https://www.elastic.co/security-labs/DPRK-strikes-using-a-new-variant-of-rustbucket"
 24]
 25risk_score = 73
 26rule_id = "62ba8542-1246-4647-9b84-98aa1bc0760a"
 27severity = "high"
 28tags = [
 29    "Domain: Endpoint",
 30    "OS: macOS",
 31    "Use Case: Threat Detection",
 32    "Tactic: Persistence",
 33    "Tactic: Defense Evasion",
 34    "Data Source: Elastic Defend",
 35    "Resources: Investigation Guide",
 36    "Noise: Medium",
 37    "Performance: Fast",
 38    "Rule Type: Event Correlation (EQL)",
 39    "Platform: macOS",
 40]
 41timestamp_override = "event.ingested"
 42type = "eql"
 43note = """## Triage and analysis
 44
 45> **Disclaimer**:
 46> 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.
 47
 48### Investigating Persistence via Suspicious Launch Agent or Launch Daemon
 49
 50LaunchAgents and LaunchDaemons are the standard macOS mechanisms for starting programs automatically at user login or system boot. While essential for legitimate software, these persistence mechanisms are heavily abused by malware including RustBucket (DPRK), Shlayer, and CloudMensis. This detection rule identifies plist file creation in LaunchAgent/LaunchDaemon directories when performed by suspicious processes including scripts executing from temporary directories, unsigned binaries, or scripting interpreters like Python and osascript.
 51
 52### Possible investigation steps
 53
 54- Examine the file.path to identify the specific plist file created and its location (user vs system LaunchAgent/LaunchDaemon directory).
 55- Read the plist contents using plutil or defaults to identify the Program or ProgramArguments configured for execution.
 56- Analyze the process.executable to understand what created the plist file and assess whether execution from that location (temp directory, hidden folder) is suspicious.
 57- Check the process.name and process.code_signature fields to determine if the creating process was a scripting interpreter or unsigned binary.
 58- Locate the binary or script referenced in the plist and calculate its hash for threat intelligence lookups.
 59- Review the parent process chain to trace back to the initial execution vector that led to plist creation.
 60- Correlate with other file and process events to identify additional malware components that may have been deployed simultaneously.
 61
 62### False positive analysis
 63
 64- Legitimate software installers may create LaunchAgents/LaunchDaemons during setup, but typically from signed installer processes rather than scripts in temp directories.
 65- Development and testing environments may use scripting languages to create launch items. Verify with development teams if such activities are expected.
 66- Several legitimate signing IDs are already excluded including vim, JetBrains Toolbox, and Sublime Text.
 67- System utilities like cfprefsd may modify plist files during normal operations and are excluded.
 68- Enterprise deployment tools may use scripts to configure launch items. Document and exclude approved deployment processes.
 69
 70### Response and remediation
 71
 72- Immediately unload the suspicious LaunchAgent or LaunchDaemon using launchctl unload with the plist path.
 73- Remove the malicious plist file from the LaunchAgent or LaunchDaemon directory.
 74- Locate and remove the executable or script referenced in the plist's Program or ProgramArguments keys.
 75- Check for other persistence mechanisms that may have been deployed by the same threat actor.
 76- Review system logs for evidence of the persistence mechanism executing and what actions it performed.
 77- If the detection matches patterns of known malware families (RustBucket, Shlayer), perform comprehensive IOC searches and threat hunting.
 78- Reset any credentials that may have been accessed while the malicious process was running.
 79- Monitor for recreation of similar plist files to detect persistent access or ongoing compromise.
 80"""
 81query = '''
 82file where host.os.type == "macos" and event.type != "deletion" and 
 83  file.extension == "plist" and
 84  file.path like ("/Library/LaunchAgents/*", "/Library/LaunchDaemons/*", 
 85                  "/Users/*/Library/LaunchAgents/*", "/System/Library/LaunchAgents/*",
 86                  "/System/Library/LaunchDaemons/*") and
 87  (process.executable like ("/private/tmp/*", "/private/var/root/Library/*", "/var/tmp/*", 
 88                            "/tmp/*", "/var/folders/*", "/Users/Shared/*", "/var/root/*",
 89                            "/Library/WebServer/*", "/Library/Graphics/*", "/Library/Fonts/*") or
 90   process.name like~ ("python*", "osascript", "bash", "zsh", "sh", "curl", "nscurl", "wget", "java")) and
 91  not process.executable like ("/System/*", "/Library/PrivilegedHelperTools/*") and
 92  not (process.code_signature.signing_id in ("com.apple.vim", "com.apple.cat", "com.apple.cfprefsd",
 93                                            "com.jetbrains.toolbox", "com.apple.pico", "com.apple.shove",
 94                                            "com.sublimetext.4", "com.apple.ditto") and process.code_signature.trusted == true) and
 95  not (file.path like ("/Library/LaunchDaemons/com.jumpcloud.*",
 96                       "/Library/LaunchAgents/com.jumpcloud.*",
 97                       "/Library/LaunchDaemons/com.wazuh.*",
 98                       "/Library/LaunchDaemons/com.zscaler.service.plist",
 99                       "/Library/LaunchAgents/com.microsoft.*") and
100       process.executable == "/bin/bash")
101'''
102
103[[rule.threat]]
104framework = "MITRE ATT&CK"
105
106  [rule.threat.tactic]
107  name = "Persistence"
108  id = "TA0003"
109  reference = "https://attack.mitre.org/tactics/TA0003/"
110
111  [[rule.threat.technique]]
112  name = "Boot or Logon Autostart Execution"
113  id = "T1547"
114  reference = "https://attack.mitre.org/techniques/T1547/"
115
116  [[rule.threat.technique]]
117  name = "Create or Modify System Process"
118  id = "T1543"
119  reference = "https://attack.mitre.org/techniques/T1543/"
120
121    [[rule.threat.technique.subtechnique]]
122    name = "Launch Agent"
123    id = "T1543.001"
124    reference = "https://attack.mitre.org/techniques/T1543/001/"
125
126    [[rule.threat.technique.subtechnique]]
127    name = "Launch Daemon"
128    id = "T1543.004"
129    reference = "https://attack.mitre.org/techniques/T1543/004/"
130
131[[rule.threat]]
132framework = "MITRE ATT&CK"
133
134  [rule.threat.tactic]
135  name = "Defense Evasion"
136  id = "TA0005"
137  reference = "https://attack.mitre.org/tactics/TA0005/"
138
139  [[rule.threat.technique]]
140  name = "Plist File Modification"
141  id = "T1647"
142  reference = "https://attack.mitre.org/techniques/T1647/"

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 Persistence via Suspicious Launch Agent or Launch Daemon

LaunchAgents and LaunchDaemons are the standard macOS mechanisms for starting programs automatically at user login or system boot. While essential for legitimate software, these persistence mechanisms are heavily abused by malware including RustBucket (DPRK), Shlayer, and CloudMensis. This detection rule identifies plist file creation in LaunchAgent/LaunchDaemon directories when performed by suspicious processes including scripts executing from temporary directories, unsigned binaries, or scripting interpreters like Python and osascript.

Possible investigation steps

  • Examine the file.path to identify the specific plist file created and its location (user vs system LaunchAgent/LaunchDaemon directory).
  • Read the plist contents using plutil or defaults to identify the Program or ProgramArguments configured for execution.
  • Analyze the process.executable to understand what created the plist file and assess whether execution from that location (temp directory, hidden folder) is suspicious.
  • Check the process.name and process.code_signature fields to determine if the creating process was a scripting interpreter or unsigned binary.
  • Locate the binary or script referenced in the plist and calculate its hash for threat intelligence lookups.
  • Review the parent process chain to trace back to the initial execution vector that led to plist creation.
  • Correlate with other file and process events to identify additional malware components that may have been deployed simultaneously.

False positive analysis

  • Legitimate software installers may create LaunchAgents/LaunchDaemons during setup, but typically from signed installer processes rather than scripts in temp directories.
  • Development and testing environments may use scripting languages to create launch items. Verify with development teams if such activities are expected.
  • Several legitimate signing IDs are already excluded including vim, JetBrains Toolbox, and Sublime Text.
  • System utilities like cfprefsd may modify plist files during normal operations and are excluded.
  • Enterprise deployment tools may use scripts to configure launch items. Document and exclude approved deployment processes.

Response and remediation

  • Immediately unload the suspicious LaunchAgent or LaunchDaemon using launchctl unload with the plist path.
  • Remove the malicious plist file from the LaunchAgent or LaunchDaemon directory.
  • Locate and remove the executable or script referenced in the plist's Program or ProgramArguments keys.
  • Check for other persistence mechanisms that may have been deployed by the same threat actor.
  • Review system logs for evidence of the persistence mechanism executing and what actions it performed.
  • If the detection matches patterns of known malware families (RustBucket, Shlayer), perform comprehensive IOC searches and threat hunting.
  • Reset any credentials that may have been accessed while the malicious process was running.
  • Monitor for recreation of similar plist files to detect persistent access or ongoing compromise.

References

Related rules

to-top