Screensaver Plist File Modified by Unexpected Process

Identifies when a screensaver plist file is modified by an unexpected process. An adversary can maintain persistence on a macOS endpoint by creating a malicious screensaver (.saver) file and configuring the screensaver plist file to execute code each time the screensaver is activated.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2021/10/05"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2024/05/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies when a screensaver plist file is modified by an unexpected process. An adversary can maintain persistence on
 11a macOS endpoint by creating a malicious screensaver (.saver) file and configuring the screensaver plist file to execute
 12code each time the screensaver is activated.
 13"""
 14from = "now-9m"
 15index = ["logs-endpoint.events.*"]
 16language = "eql"
 17license = "Elastic License v2"
 18name = "Screensaver Plist File Modified by Unexpected Process"
 19note = """## Triage and analysis
 20
 21- Analyze the plist file modification event to identify whether the change was expected or not
 22- Investigate the process that modified the plist file for malicious code or other suspicious behavior
 23- Identify if any suspicious or known malicious screensaver (.saver) files were recently written to or modified on the host
 24"""
 25references = [
 26    "https://posts.specterops.io/saving-your-access-d562bf5bf90b",
 27    "https://github.com/D00MFist/PersistentJXA",
 28]
 29risk_score = 47
 30rule_id = "e6e8912f-283f-4d0d-8442-e0dcaf49944b"
 31setup = """## Setup
 32
 33This rule requires data coming in from Elastic Defend.
 34
 35### Elastic Defend Integration Setup
 36Elastic 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.
 37
 38#### Prerequisite Requirements:
 39- Fleet is required for Elastic Defend.
 40- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 41
 42#### The following steps should be executed in order to add the Elastic Defend integration on a macOS System:
 43- Go to the Kibana home page and click "Add integrations".
 44- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 45- Click "Add Elastic Defend".
 46- Configure the integration name and optionally add a description.
 47- Select the type of environment you want to protect, for MacOS it is recommended to select "Traditional Endpoints".
 48- 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).
 49- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 50- 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.
 51For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
 52- Click "Save and Continue".
 53- 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.
 54For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 55"""
 56severity = "medium"
 57tags = [
 58    "Domain: Endpoint",
 59    "OS: macOS",
 60    "Use Case: Threat Detection",
 61    "Tactic: Persistence",
 62    "Data Source: Elastic Defend",
 63]
 64timestamp_override = "event.ingested"
 65type = "eql"
 66
 67query = '''
 68file where host.os.type == "macos" and event.type != "deletion" and
 69  file.name: "com.apple.screensaver.*.plist" and
 70   file.path : (
 71      "/Users/*/Library/Preferences/ByHost/*",
 72      "/Library/Managed Preferences/*",
 73      "/System/Library/Preferences/*"
 74      ) and
 75  (
 76    process.code_signature.trusted == false or
 77    process.code_signature.exists == false or
 78
 79    /* common script interpreters and abused native macOS bins */
 80    process.name : (
 81      "curl",
 82      "mktemp",
 83      "tail",
 84      "funzip",
 85      "python*",
 86      "osascript",
 87      "perl"
 88      )
 89   ) and
 90
 91  /* Filter OS processes modifying screensaver plist files */
 92  not process.executable : (
 93    "/usr/sbin/cfprefsd",
 94    "/usr/libexec/xpcproxy",
 95    "/System/Library/CoreServices/ManagedClient.app/Contents/Resources/MCXCompositor",
 96    "/System/Library/CoreServices/ManagedClient.app/Contents/MacOS/ManagedClient"
 97    )
 98'''
 99
100
101[[rule.threat]]
102framework = "MITRE ATT&CK"
103[[rule.threat.technique]]
104id = "T1546"
105name = "Event Triggered Execution"
106reference = "https://attack.mitre.org/techniques/T1546/"
107
108
109[rule.threat.tactic]
110id = "TA0003"
111name = "Persistence"
112reference = "https://attack.mitre.org/tactics/TA0003/"

Triage and analysis

  • Analyze the plist file modification event to identify whether the change was expected or not
  • Investigate the process that modified the plist file for malicious code or other suspicious behavior
  • Identify if any suspicious or known malicious screensaver (.saver) files were recently written to or modified on the host

References

Related rules

to-top