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