Defense Evasion (TA0005)(external, opens in a new tab or window)
Persistence (TA0003)(external, opens in a new tab or window)
text code block:sequence by process.entity_id with maxspan=15s [process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and process.env_vars like ("DYLD_INSERT_LIBRARIES=?*", "LD_PRELOAD=?*") and not process.env_vars like ("DYLD_INSERT_LIBRARIES=", "LD_PRELOAD=", "LD_PRELOAD=<null>") and not process.executable like ("/Users/*/Library/Developer/Xcode/*", "/Users/*/Library/Developer/CoreSimulator/*") and not process.parent.executable like ("/usr/bin/xcrun", "/Applications/Xcode*.app/*", "/Library/Developer/*")] [library where host.os.type == "macos" and event.action == "load" and not dll.name like ("*.aot", "*.so") and not dll.code_signature.trusted == true and not dll.path like ("/System/*", "/usr/lib/*", "/opt/homebrew/*", "/private/var/folders/*", "/Library/Apple/*", "/Library/Developer/*", "/Users/*/Library/Developer/Xcode/*", "/Users/*/Library/Developer/CoreSimulator/*")]
Install detection rules in Elastic Security
Detect Dylib Injection via Process Environment Variables in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).