Creation of Hidden Login Item via Apple Script

Identifies the execution of osascript to create a hidden login item. This may indicate an attempt to persist a malicious program while concealing its presence.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/01/05"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2024/05/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies the execution of osascript to create a hidden login item. This may indicate an attempt to persist a malicious
 11program while concealing its presence.
 12"""
 13from = "now-9m"
 14index = ["logs-endpoint.events.*"]
 15language = "eql"
 16license = "Elastic License v2"
 17name = "Creation of Hidden Login Item via Apple Script"
 18risk_score = 47
 19rule_id = "f24bcae1-8980-4b30-b5dd-f851b055c9e7"
 20setup = """## Setup
 21
 22This rule requires data coming in from Elastic Defend.
 23
 24### Elastic Defend Integration Setup
 25Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
 26
 27#### Prerequisite Requirements:
 28- Fleet is required for Elastic Defend.
 29- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 30
 31#### The following steps should be executed in order to add the Elastic Defend integration on a macOS System:
 32- Go to the Kibana home page and click "Add integrations".
 33- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 34- Click "Add Elastic Defend".
 35- Configure the integration name and optionally add a description.
 36- Select the type of environment you want to protect, for MacOS it is recommended to select "Traditional Endpoints".
 37- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
 38- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 39- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
 40For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
 41- Click "Save and Continue".
 42- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
 43For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 44"""
 45severity = "medium"
 46tags = [
 47    "Domain: Endpoint",
 48    "OS: macOS",
 49    "Use Case: Threat Detection",
 50    "Tactic: Persistence",
 51    "Tactic: Execution",
 52    "Data Source: Elastic Defend",
 53]
 54timestamp_override = "event.ingested"
 55type = "eql"
 56
 57query = '''
 58process where host.os.type == "macos" and event.type in ("start", "process_started") and process.name : "osascript" and
 59 process.command_line : "osascript*login item*hidden:true*"
 60'''
 61
 62
 63[[rule.threat]]
 64framework = "MITRE ATT&CK"
 65[[rule.threat.technique]]
 66id = "T1547"
 67name = "Boot or Logon Autostart Execution"
 68reference = "https://attack.mitre.org/techniques/T1547/"
 69
 70
 71[rule.threat.tactic]
 72id = "TA0003"
 73name = "Persistence"
 74reference = "https://attack.mitre.org/tactics/TA0003/"
 75[[rule.threat]]
 76framework = "MITRE ATT&CK"
 77[[rule.threat.technique]]
 78id = "T1059"
 79name = "Command and Scripting Interpreter"
 80reference = "https://attack.mitre.org/techniques/T1059/"
 81[[rule.threat.technique.subtechnique]]
 82id = "T1059.002"
 83name = "AppleScript"
 84reference = "https://attack.mitre.org/techniques/T1059/002/"
 85
 86
 87
 88[rule.threat.tactic]
 89id = "TA0002"
 90name = "Execution"
 91reference = "https://attack.mitre.org/tactics/TA0002/"
 92[[rule.threat]]
 93framework = "MITRE ATT&CK"
 94[[rule.threat.technique]]
 95id = "T1647"
 96name = "Plist File Modification"
 97reference = "https://attack.mitre.org/techniques/T1647/"
 98
 99
100[rule.threat.tactic]
101id = "TA0005"
102name = "Defense Evasion"
103reference = "https://attack.mitre.org/tactics/TA0005/"

Related rules

to-top