Detection rules › Elastic
Reflective Binary Load
Detects reflective code loading on macOS through creation of "NSCreateObjectFileImageFromMemory-*" temporary files by suspicious processes. This technique allows malware to execute in-memory Mach-O binaries while evading disk-based detection.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule body
[rule]
description = """
Detects reflective code loading on macOS through creation of "NSCreateObjectFileImageFromMemory-*" temporary files by
suspicious processes. This technique allows malware to execute in-memory Mach-O binaries while evading disk-based
detection.
"""
id = "16fba7a9-f8f6-43ce-ae24-6a392a48e49c"
license = "Elastic License v2"
name = "Reflective Binary Load"
os_list = ["macos"]
reference = [
"https://slyd0g.medium.com/understanding-and-defending-against-reflective-code-loading-on-macos-e2e83211e48f",
"https://github.com/slyd0g/SwiftInMemoryLoading",
]
version = "1.0.54"
query = '''
file where event.type != "deletion" and
file.name : "NSCreateObjectFileImageFromMemory-*" and
process.name != null and
process.executable != null and
((process.code_signature.trusted == false or process.code_signature.exists == false) or
process.name like~ ("osascript", "bash", "sh", "zsh", "node")) and
not (process.executable like "/private/tmp/*" and process.name == "osx-x86_64") and
not (process.code_signature.exists == true and process.code_signature.trusted == true and process.code_signature.team_id == "EBNT3ZX97E") and
not process.executable like~ "/private/tmp/PKInstallSandbox.*" and
not process.code_signature.signing_id == "com.steinberg.cubase13" and
not Effective_process.executable in ("/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
"/Applications/iZotope Product Portal.app/Contents/MacOS/Product Portal",
"/Library/Application Support/Mosyle/MosyleMDM.app/Contents/MacOS/MosyleMDM",
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService",
"/Library/Kandji/Kandji Agent.app/Contents/Helpers/Kandji Library Manager.app/Contents/MacOS/kandji-library-manager",
"/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon") and
not Effective_process.executable like "/usr/local/rippling/*"
'''
min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1106"
name = "Native API"
reference = "https://attack.mitre.org/techniques/T1106/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1620"
name = "Reflective Code Loading"
reference = "https://attack.mitre.org/techniques/T1620/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Stage 1: file
file where event.type != "deletion" and
file.name : "NSCreateObjectFileImageFromMemory-*" and
process.name != null and
process.executable != null and
((process.code_signature.trusted == false or process.code_signature.exists == false) or
process.name like~ ("osascript", "bash", "sh", "zsh", "node")) and
not (process.executable like "/private/tmp/*" and process.name == "osx-x86_64") and
not (process.code_signature.exists == true and process.code_signature.trusted == true and process.code_signature.team_id == "EBNT3ZX97E") and
not process.executable like~ "/private/tmp/PKInstallSandbox.*" and
not process.code_signature.signing_id == "com.steinberg.cubase13" and
not Effective_process.executable in ("/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
"/Applications/iZotope Product Portal.app/Contents/MacOS/Product Portal",
"/Library/Application Support/Mosyle/MosyleMDM.app/Contents/MacOS/MosyleMDM",
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService",
"/Library/Kandji/Kandji Agent.app/Contents/Helpers/Kandji Library Manager.app/Contents/MacOS/kandji-library-manager",
"/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon") and
not Effective_process.executable like "/usr/local/rippling/*"
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.exists | eq | true | excludes:process.code_signature.exists field:"process.code_signature.exists" value:"true" |
process.code_signature.team_id | eq | EBNT3ZX97E | excludes:process.code_signature.team_id field:"process.code_signature.team_id" value:"EBNT3ZX97E" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | starts_with | /private/tmp/ | excludes:process.executable field:"process.executable" value:"/private/tmp/" |
process.name | eq | osx-x86_64 | excludes:process.name field:"process.name" value:"osx-x86_64" |
Effective_process.executable | in | /Applications/iZotope Product Portal.app/Contents/MacOS/Product Portal, /Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon, /Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService, /Library/Application Support/Mosyle/MosyleMDM.app/Contents/MacOS/MosyleMDM, /Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon, /Library/Kandji/Kandji Agent.app/Contents/Helpers/Kandji Library Manager.app/Contents/MacOS/kandji-library-manager | excludes:Effective_process.executable |
Effective_process.executable | starts_with | /usr/local/rippling/ | excludes:Effective_process.executable field:"Effective_process.executable" value:"/usr/local/rippling/" |
process.code_signature.signing_id | eq | com.steinberg.cubase13 | excludes:process.code_signature.signing_id field:"process.code_signature.signing_id" value:"com.steinberg.cubase13" |
process.executable | starts_with | /private/tmp/PKInstallSandbox. | excludes:process.executable field:"process.executable" value:"/private/tmp/PKInstallSandbox." |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | ne |
| field:"event.type" kind:ne value:"deletion" |
file.name | wildcard |
| field:"file.name" kind:wildcard value:"NSCreateObjectFileImageFromMemory-*" |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.name | is_not_null | field:"process_name" kind:is_not_null | |
process.name | wildcard |
| field:"process_name" kind:wildcard |