Startup Items
Adversaries may use startup items automatically executed at boot initialization to establish persistence on macOS systems. Startup items execute during the final phase of the boot process and contain shell scripts or other executable files along with configuration information (StartupParameters.plist) used by the system to determine execution order. Although technically deprecated in favor of Launch Daemons, the /Library/StartupItems directory may still exist on systems. An adversary can create the appropriate folders and files in the StartupItems directory to register their own persistence mechanism that executes as root during system boot.
// T1037.005 - macOS Startup Items Persistence Detection
// Detects file creation/modification in /Library/StartupItems or related startup item paths
// Note: macOS telemetry via Microsoft Defender for Endpoint (MDE) on macOS
DeviceFileEvents
| where Timestamp > ago(24h)
| where FolderPath has "/Library/StartupItems"
or FileName =~ "StartupParameters.plist"
| extend StartupItemDir = extract(@"(/Library/StartupItems/[^/]+)", 1, FolderPath)
| extend IsPlist = FileName endswith ".plist"
| extend IsExecutable = not(FileName endswith ".plist") and not(FileName endswith ".txt") and not(FileName endswith ".log")
| project Timestamp, DeviceName, AccountName, ActionType, FileName, FolderPath,
InitiatingProcessFileName, InitiatingProcessCommandLine,
InitiatingProcessAccountName, StartupItemDir, IsPlist, IsExecutable
| sort by Timestamp desc
| union (
DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has "/Library/StartupItems"
or ProcessCommandLine has "StartupParameters.plist"
or (ProcessCommandLine has "mkdir" and ProcessCommandLine has "/Library/StartupItems")
or (ProcessCommandLine has "cp" and ProcessCommandLine has "/Library/StartupItems")
or (ProcessCommandLine has "chmod" and ProcessCommandLine has "/Library/StartupItems")
| project Timestamp, DeviceName, AccountName, ActionType=ActionType, FileName,
FolderPath=InitiatingProcessFolderPath, InitiatingProcessFileName,
InitiatingProcessCommandLine, InitiatingProcessAccountName,
StartupItemDir="", IsPlist=false, IsExecutable=false
| sort by Timestamp desc
) Data Sources
Required Tables
False Positives
- Legitimate third-party macOS software installers that still use the deprecated StartupItems mechanism for compatibility with older macOS versions
- System administrators or IT teams manually creating startup items for legacy application compatibility
- macOS system updates or migration tools that read or restore /Library/StartupItems content from backups
- Security or monitoring software that scans /Library/StartupItems as part of system inventory or compliance checks
References (8)
- https://attack.mitre.org/techniques/T1037/005/
- https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/StartupItems.html
- https://www.virusbulletin.com/uploads/pdf/conference/vb2014/VB2014-Wardle.pdf
- https://objective-see.org/blog.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1037.005/T1037.005.md
- https://www.kaspersky.com/blog/adwind-rat/11430/
- https://support.apple.com/guide/deployment/startup-items-dep7b3ee4a0e/web
- https://www.jamf.com/blog/how-malware-persists-on-macos/
Unlock Pro Content
Get the full detection package for T1037.005 including response playbook, investigation guide, and atomic red team tests.