[metadata]
creation_date = "2020/12/07"
maturity = "production"
updated_date = "2020/12/07"

[rule]
author = ["Elastic"]
description = """
Identifies use of the Defaults command to install a login or logoff hook in MacOS. An adversary may abuse this
capability to establish persistence in an environment by inserting code to be executed at login or logout.
"""
from = "now-9m"
index = ["auditbeat-*", "logs-endpoint.events.*"]
language = "eql"
license = "Elastic License"
name = "Persistence via Login or Logout Hook"
references = [
    "https://www.virusbulletin.com/uploads/pdf/conference_slides/2014/Wardle-VB2014.pdf",
    "https://www.manpagez.com/man/1/defaults/",
]
risk_score = 47
rule_id = "5d0265bf-dea9-41a9-92ad-48a8dcd05080"
severity = "medium"
tags = ["Elastic", "Host", "macOS", "Threat Detection", "Persistence"]
type = "eql"

query = '''
process where event.type in ("start", "process_started") and
 process.name == "defaults" and process.args == "write" and process.args in ("LoginHook", "LogoutHook")
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1037"
name = "Boot or Logon Initialization Scripts"
reference = "https://attack.mitre.org/techniques/T1037/"


[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
