Suspicious Codesign Execution via Osacompile


Description

Detects the abnormal execution of the codesign binary via Osacompile to forcefully sign all contents of a bundle. Threat actors may use this technique to bypass code signing requirements.

Query · eql

process where event.type == "start" and event.action == "exec" and 
 process.name == "codesign" and
 process.args in ("--sign", "-s") and
 process.args in ("--force", "-f") and
 process.args in ("--deep") and
 ((process.parent.name == "osacompile") or (process.parent.name in ("bash", "sh", "zsh") and process.Ext.effective_parent.name like~ ("terminal", "codesign"))) and
 not process.Ext.effective_parent.executable like~ ("/Volumes/PostgreSQL*/postgresql*.app/Contents/MacOS/PostgreSQL",
                                                    "/Users/*/Library/Application Support/Claude/claude-code/*/claude.app/Contents/MacOS/claude")
Raw source Suspicious Codesign Execution via Osacompile · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Detects the abnormal execution of the codesign binary via Osacompile to forcefully sign all contents of a bundle. Threat
actors may use this technique to bypass code signing requirements.
"""
id = "7d2a993e-967f-4abd-b53e-ac14fdd66ddb"
license = "Elastic License v2"
name = "Suspicious Codesign Execution via Osacompile"
os_list = ["macos"]
version = "1.0.11"

query = '''
process where event.type == "start" and event.action == "exec" and 
 process.name == "codesign" and
 process.args in ("--sign", "-s") and
 process.args in ("--force", "-f") and
 process.args in ("--deep") and
 ((process.parent.name == "osacompile") or (process.parent.name in ("bash", "sh", "zsh") and process.Ext.effective_parent.name like~ ("terminal", "codesign"))) and
 not process.Ext.effective_parent.executable like~ ("/Volumes/PostgreSQL*/postgresql*.app/Contents/MacOS/PostgreSQL",
                                                    "/Users/*/Library/Application Support/Claude/claude-code/*/claude.app/Contents/MacOS/claude")
'''

min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.002"
name = "AppleScript"
reference = "https://attack.mitre.org/techniques/T1059/002/"

[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1553"
name = "Subvert Trust Controls"
reference = "https://attack.mitre.org/techniques/T1553/"
[[threat.technique.subtechnique]]
id = "T1553.002"
name = "Code Signing"
reference = "https://attack.mitre.org/techniques/T1553/002/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.16.0"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.