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"
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.9"

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"
'''

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.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/"

[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.