Detection rules for macOS Data sources. Every rule contains its MITRE ATT&CK mapping, an impact rating, and details on what it identifies.

This category lists 36 detection rules.

RuleCategoryTechniqueImpact (C/I/A)
Apple Script Abuse DetectionExecutionT1059.002 - Command and Scripting Interpreter: AppleScriptC:3 / I:3 / A:2
Dynamic Library Hijacking DetectedPersistenceT1574.004 - Hijack Execution Flow: Dylib HijackingC:3 / I:3 / A:2
Endpoint Security Framework Bypass AttemptDefense EvasionT1562.001 - Impair Defenses: Disable or Modify ToolsC:3 / I:3 / A:3
Folder Actions Script AbusePersistenceT1546.002 - Event Triggered Execution: ScreensaverC:2 / I:3 / A:1
GUI Input Capture via Fake Password DialogCredential AccessT1056.002 - Input Capture: GUI Input CaptureC:3 / I:2 / A:1
Gatekeeper Bypass Attempt DetectedDefense EvasionT1553.001 - Subvert Trust Controls: Gatekeeper BypassC:2 / I:3 / A:2
Gatekeeper Bypass via Quarantine Attribute RemovalDefense EvasionT1553.001 - Subvert Trust Controls: Gatekeeper BypassC:2 / I:3 / A:2
Hidden User Account Creation on macOSPersistenceT1564.002 - Hide Artifacts: Hidden UsersC:3 / I:3 / A:2
JXA In-Memory Execution DetectedExecutionT1059.002 - Command and Scripting Interpreter: AppleScriptC:3 / I:3 / A:2
Keychain Access Violations DetectionCredential AccessT1555.001 - Credentials from Password Stores: KeychainC:3 / I:2 / A:1
Keychain Credential Dumping DetectedCredential AccessT1555.001 - Credentials from Password Stores: KeychainC:3 / I:2 / A:1
Keychain Credential Dumping via CLICredential AccessT1555.001 - Credentials from Password Stores: KeychainC:3 / I:2 / A:0
Launch Agent/Daemon Persistence DetectionPersistence, Privilege EscalationT1543.001 - Create or Modify System Process: Launch AgentC:2 / I:3 / A:2
Login Items Persistence ModificationPersistenceT1547.015 - Boot or Logon Autostart Execution: Login ItemsC:2 / I:3 / A:1
Notarization Bypass Attempt DetectedDefense EvasionT1553.001 - Subvert Trust Controls: Gatekeeper BypassC:2 / I:3 / A:1
Osascript Encoded or Suspicious ExecutionExecutionT1059.002 - Command and Scripting Interpreter: AppleScriptC:3 / I:3 / A:2
PlistBuddy Persistence via RunAtLoadPersistenceT1543.001 - Create or Modify System Process: Launch AgentC:2 / I:3 / A:2
Privacy Preferences (TCC) Database TamperingPrivilege Escalation, Defense EvasionT1548 - Abuse Elevation Control MechanismC:3 / I:3 / A:1
SSH Private Key Theft AttemptCredential AccessT1552.004 - Unsecured Credentials: Private KeysC:3 / I:2 / A:0
Shell Profile Modification for PersistencePersistenceT1546.004 - Event Triggered Execution: Unix Shell Configuration ModificationC:2 / I:3 / A:1
Sudo Credential Caching AbusePrivilege EscalationT1548.003 - Abuse Elevation Control Mechanism: Sudo and Sudo CachingC:3 / I:3 / A:1
Suspicious Browser Child Process on macOSInitial AccessT1189 - Drive-by CompromiseC:3 / I:3 / A:2
Suspicious Kernel Extension Loading DetectedPersistence, Privilege EscalationT1547.006 - Boot or Logon Autostart Execution: Kernel Modules and ExtensionsC:3 / I:3 / A:2
Suspicious Office Application Child Process on macOSExecutionT1204.002 - User Execution: Malicious FileC:3 / I:3 / A:2
System Integrity Protection (SIP) Bypass AttemptDefense EvasionT1553.006 - Subvert Trust Controls: Code Signing Policy ModificationC:3 / I:3 / A:2
TCC Database Manipulation DetectedPrivilege Escalation, Defense EvasionT1548 - Abuse Elevation Control MechanismC:3 / I:3 / A:2
Time Machine Backup Deletion DetectedImpactT1490 - Inhibit System RecoveryC:1 / I:3 / A:3
User Added to Admin Group via dsclPrivilege EscalationT1078.003 - Valid Accounts: Local AccountsC:3 / I:3 / A:2
WizardUpdate Malware Indicators DetectedMalware DetectionT1059.002 - Command and Scripting Interpreter: AppleScriptC:3 / I:3 / A:3
XCSSET Malware Indicators DetectedMalware DetectionT1059.002 - Command and Scripting Interpreter: AppleScriptC:3 / I:3 / A:3
XProtect Evasion or Tampering DetectedDefense EvasionT1562.001 - Impair Defenses: Disable or Modify ToolsC:3 / I:3 / A:2
macOS Cron Job PersistencePersistenceT1053.003 - Scheduled Task/Job: CronC:2 / I:3 / A:1
macOS Ransomware IndicatorsImpactT1486 - Data Encrypted for ImpactC:3 / I:3 / A:3
macOS Root Account EnabledPrivilege EscalationT1078 - Valid AccountsC:3 / I:3 / A:2
macOS Security Tools DisabledDefense EvasionT1562.001 - Impair Defenses: Disable or Modify ToolsC:3 / I:3 / A:3
macOS System Log Clearing DetectedDefense EvasionT1070.002 - Indicator Removal: Clear Linux or Mac System LogsC:1 / I:3 / A:2

Rule Example

Below is an example of a rule definition for Apple Script Abuse Detection (view in repository):

# Rule version v1.0.0

dataTypes:
  - macos
name: Apple Script Abuse Detection
impact:
  confidentiality: 3
  integrity: 3
  availability: 2
category: Execution
technique: "T1059.002 - Command and Scripting Interpreter: AppleScript"
adversary: origin
references:
  - https://attack.mitre.org/techniques/T1059/002/
  - https://developer.apple.com/documentation/os/logging
  - https://www.crowdstrike.com/en-us/blog/how-to-leverage-apple-unified-log-for-incident-response/
description: |
  Detects suspicious AppleScript execution that could indicate malicious activity, including osascript command-line usage, automation attempts, and script-based attacks on macOS systems. AppleScript can be abused by attackers to execute commands, interact with applications, and perform system manipulation.
  
  Next Steps:
  1. Review the specific AppleScript commands being executed
  2. Check if the script execution is part of legitimate automation or suspicious activity
  3. Examine the process tree to understand the execution context
  4. Verify if the user executing the script has legitimate reasons to do so
  5. Look for additional indicators of compromise on the affected system
  6. Consider blocking or monitoring the source if malicious intent is confirmed
where: |
  (oneOf("log.process", ["osascript", "Script Editor", "AppleScript", "Automator"]) ||
   contains("log.eventMessage", "osascript") ||
   contains("log.eventMessage", "AppleScript") ||
   equals("log.subsystem", "com.apple.applescript")) &&
  (contains("log.eventMessage", "tell application") ||
   contains("log.eventMessage", "do shell script") ||
   contains("log.eventMessage", "keystroke") ||
   contains("log.eventMessage", "System Events") ||
   contains("log.eventMessage", "admin privileges") ||
   contains("log.eventMessage", "sudo") ||
   contains("log.eventMessage", "password")) &&
  oneOf("log.eventType", ["logEvent", "traceEvent"])
groupBy:
  - adversary.host
  - adversary.user

Rule Details

Apple Script Abuse Detection

Identifies potentially malicious AppleScript activity, such as osascript use from the command line, automation efforts, and script-based attacks against macOS systems. Attackers can misuse AppleScript to run commands, communicate with applications, and manipulate the system.

Dynamic Library Hijacking Detected

Identifies dylib hijacking on macOS, in which attackers plant malicious dynamic libraries in paths checked ahead of valid libraries, enabling code to run under trusted applications.

Endpoint Security Framework Bypass Attempt

Identifies efforts to circumvent or alter the macOS Endpoint Security framework, a possible sign of malicious activity seeking to avoid security monitoring. This framework is essential for monitoring system security, and if compromised, it can let attackers work without being detected.

Folder Actions Script Abuse

Identifies misuse of macOS Folder Actions for persistence. Folder Actions permit scripts to be linked to folders and run when files are placed there, offering a covert persistence method.

GUI Input Capture via Fake Password Dialog

Identifies osascript showing fraudulent password dialogs to collect user credentials. Attackers misuse AppleScript display dialog with hidden answer to create phishing prompts that imitate genuine macOS password requests, deceiving users into providing their credentials.

Gatekeeper Bypass Attempt Detected

Identifies efforts to evade Gatekeeper security checks by altering its database, deleting quarantine attributes, or exploiting assessment flaws. Gatekeeper is a macOS security function that checks downloaded applications before execution, and circumventing it can let malicious software run without correct verification.

Gatekeeper Bypass via Quarantine Attribute Removal

Identifies deletion of the com.apple.quarantine extended attribute from files with xattr -d. macOS Gatekeeper relies on this attribute to apply security checks to downloaded files. Deleting it enables unsigned or untrusted applications to run without Gatekeeper verification, evading a key security control.

Hidden User Account Creation on macOS

Identifies hidden user account creation on macOS. Attackers set up hidden users, with UID below 500 and the IsHidden flag, to keep persistent, concealed access to compromised systems.

JXA In-Memory Execution Detected

Identifies in-memory JavaScript for Automation execution through osascript. Attackers employ JXA with eval(), NSData.dataWithContentsOfURL, or ObjC.import to retrieve and run code wholly in memory, bypassing file-based detection. This is a macOS-specific fileless attack method.

Keychain Access Violations Detection

Identifies unauthorized or suspicious efforts to reach the macOS Keychain, such as failed access tries, access by unusual processes, and possible credential theft. This rule detects security subsystem events tied to keychain access failures, denials, or unauthorized attempts.

Keychain Credential Dumping Detected

Identifies use of the macOS security command-line tool to pull credentials from the Keychain. Attackers use commands such as security find-certificate, security export, and security dump-keychain to gather stored certificates, passwords, and private keys from the macOS Keychain.

Keychain Credential Dumping via CLI

Identifies command-line access to macOS Keychain credentials through security commands such as dump-keychain, find-generic-password, or find-internet-password with the -w flag to retrieve passwords.

Launch Agent/Daemon Persistence Detection

Identifies suspicious creation or alteration of Launch Agents and Launch Daemons, which are often used for persistence on macOS systems. It watches for new plist files appearing in LaunchAgents or LaunchDaemons directories.

Login Items Persistence Modification

Identifies changes to macOS Login Items, which are used to keep applications launching at user login. Attackers misuse this feature to sustain persistent access.

Notarization Bypass Attempt Detected

Identifies efforts to evade macOS notarization checks by methods such as altering quarantine attributes, abusing the AppleDouble file format, or exploiting ZIP archives. This rule detects suspicious activity that tries to get around Apple security mechanisms intended to protect users from malicious software.

Osascript Encoded or Suspicious Execution

Identifies suspicious osascript executions from the command line, such as encoded scripts, scripts that run shell commands, or scripts that modify the system. Attackers misuse AppleScript for execution and evasion.

PlistBuddy Persistence via RunAtLoad

Identifies PlistBuddy being used to set RunAtLoad to true in LaunchAgent or LaunchDaemon plist files. This persistence technique involves attackers changing property list files so their malicious payload runs automatically at system boot or user login.

Privacy Preferences (TCC) Database Tampering

Identifies unauthorized changes to the macOS TCC (Transparency, Consent, and Control) database, which governs application privacy permissions. The TCC database manages access rights for sensitive resources such as camera, microphone, location services, and file system access. Unauthorized modification of this database can let malicious applications evade privacy controls and reach sensitive user data.

SSH Private Key Theft Attempt

Identifies attempts to read or duplicate SSH private keys located in macOS user home directories, which attackers leverage for lateral movement and unauthorized remote system access.

Shell Profile Modification for Persistence

Identifies changes to shell profile files on macOS, such as .bash_profile, .zshrc, and .zprofile, which attackers use to run malicious commands whenever a shell session begins.

Sudo Credential Caching Abuse

Identifies misuse of sudo credential caching on macOS, including timestamp tampering, sudoers file changes to lengthen timeout, and attempts to bypass tty_tickets.

Suspicious Browser Child Process on macOS

Identifies Safari, Chrome, and Firefox spawning suspicious child processes such as bash, curl, wget, python, or osascript. This behavior points to possible browser exploitation, drive-by download, or malicious content execution. Normal browsers seldom spawn shell interpreters or download utilities directly.

Suspicious Kernel Extension Loading Detected

Detects attempts to load kernel extensions (kexts) that are suspicious or unauthorized and could point to a rootkit being installed or the system being compromised. This rule watches for kext loading behavior that circumvents standard security safeguards, includes unsigned or invalid extensions, or takes place in sensitive system directories.

Suspicious Office Application Child Process on macOS

Identifies Microsoft Office applications (Word, Excel, PowerPoint) spawning suspicious child processes such as bash, curl, wget, python, or osascript on macOS. This strongly suggests macro-based malware or document exploitation, since Office applications should not normally spawn shell interpreters or download utilities.

System Integrity Protection (SIP) Bypass Attempt

Identifies efforts to bypass System Integrity Protection (SIP) via unauthorized changes to protected locations or suspicious kernel extension loading with rootless entitlements. SIP is a vital macOS security mechanism that safeguards system files and processes from modification, even by privileged users.

TCC Database Manipulation Detected

Identifies unauthorized efforts to alter the Transparency, Consent, and Control (TCC) database in order to bypass privacy safeguards and reach protected resources. This detection covers multiple methods of TCC database manipulation, such as direct database changes, unauthorized access attempts, and privilege escalation using TCC bypass techniques.

Time Machine Backup Deletion Detected

Detects the use of tmutil to remove Time Machine backups on macOS. This is a frequent ransomware precursor in which attackers erase backups to stop recovery after encryption. Genuine backup deletions are uncommon and warrant close monitoring.

User Added to Admin Group via dscl

Identifies use of dscl to add a user to the admin group on macOS. This is a privilege escalation technique in which attackers grant themselves or a compromised account administrative privileges to gain elevated access to the system.

WizardUpdate Malware Indicators Detected

Identifies indicators of the WizardUpdate (UpdateAgent) macOS trojan. The malware relies on curl piped to bash/eval patterns and references characteristic paths such as intermediate_agent to stage and execute. WizardUpdate is a known macOS trojan that fetches and executes additional payloads.

XCSSET Malware Indicators Detected

Identifies indicators of XCSSET malware on macOS. XCSSET is sophisticated malware that targets Xcode projects, steals browser data, and installs backdoors. Key indicators include curl requests to /sys/log.php C2 endpoints, osacompile commands in Library/Group Containers paths, and distinctive repl staging patterns.

XProtect Evasion or Tampering Detected

Identifies attempts to evade or tamper with XProtect malware detection, including modification of XProtect files, databases, or YARA rules. XProtect is Apple's built-in antimalware system, and efforts to bypass or disable it suggest possible malicious activity.

macOS Cron Job Persistence

Identifies modifications to crontab on macOS systems. Although cron is deprecated on macOS in favor of launchd, attackers still use it for persistence because it is monitored less often.

macOS Ransomware Indicators

Identifies patterns of mass file encryption on macOS that may point to ransomware activity, such as rapid file changes with suspicious extensions and encryption tool usage.

macOS Root Account Enabled

Detects the execution of dsenableroot to activate the root account on macOS. By default, macOS keeps the root account disabled for security reasons. Enabling it provides the highest tier of system privileges and is frequently performed by attackers to escalate privileges and maintain persistent elevated access.

macOS Security Tools Disabled

Identifies attempts to disable or unload macOS security tools by using launchctl or spctl. Attackers often disable endpoint security products such as LuLu, BlockBlock, Santa, CarbonBlack, CrowdStrike, and osquery, or turn off Gatekeeper through spctl to run malicious payloads without detection.

macOS System Log Clearing Detected

Identifies attempts to clear or delete macOS system logs with rm, unlink, or shred commands aimed at /var/log or ~/Library/Logs directories. Attackers clear logs to remove evidence of their activity and obstruct forensic investigation.