The detection of Mach-O binaries in a cloud environment may indicate the presence of macOS-based malware or adversarial tools that leverage Apple’s binary format for execution. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential advanced threats that may bypass traditional detection mechanisms.
YARA Rule
rule MachO
{
meta:
description = "Mach-O binaries"
id = "40526d0e-dede-5001-996c-b12f668a7f53"
condition:
uint32(0) == 0xfeedface or uint32(0) == 0xcefaedfe or uint32(0) == 0xfeedfacf or uint32(0) == 0xcffaedfe or uint32(0) == 0xcafebabe or uint32(0) == 0xbebafeca
}
This YARA rule can be deployed in the following contexts:
Scenario: System Integrity Protection (SIP) enforcement checks using spctl
Filter/Exclusion: process.name != "spctl"
Scenario: Scheduled maintenance task using launchd to run a legitimate binary
Filter/Exclusion: process.parent.name == "launchd" && process.name == "<legitimate_binary>"
Scenario: Admin task using installer to deploy a macOS application
Filter/Exclusion: process.name == "installer" && process.parent.name == "launchd"
Scenario: Automated build process using xcodebuild to compile a macOS project
Filter/Exclusion: process.name == "xcodebuild" && process.parent.name == "launchd"
Scenario: Security tool like osquery running a query that generates Mach-O binaries temporarily
Filter/Exclusion: process.name == "osquery" && process.parent.name == "launchd"