Detection rules › Elastic
User Keychain Copied via Suspicious Parent
Detects when the copy command is used to copy the user keychain database and the parent process is executing from a suspicious or temporary directory. Threat actors often deploy malware to staging locations such as /tmp, /Library/Caches, or /Users/Shared and then use native macOS utilities to collect sensitive credential files like the keychain database prior to exfiltration. This rule complements shell-interpreter-based detections by covering cases where malware directly spawns the copy utility without an intermediary shell process.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
Telemetry coverage
Rule body
[rule]
description = """
Detects when the copy command is used to copy the user keychain database and the parent process is executing from a
suspicious or temporary directory. Threat actors often deploy malware to staging locations such as /tmp,
/Library/Caches, or /Users/Shared and then use native macOS utilities to collect sensitive credential files like the
keychain database prior to exfiltration. This rule complements shell-interpreter-based detections by covering cases
where malware directly spawns the copy utility without an intermediary shell process.
"""
id = "2f6d797d-b14a-4f9f-8914-b5b29a0103e2"
license = "Elastic License v2"
name = "User Keychain Copied via Suspicious Parent"
os_list = ["macos"]
reference = ["https://daylight.ai/blog/prospect-call-microsoft-teams-meetings"]
version = "1.0.1"
query = '''
process where event.type == "start" and event.action == "exec" and
process.name == "cp" and
process.command_line : "*login.keychain-db*" and
process.parent.executable like ("/tmp/*", "/private/tmp/*", "/var/tmp/*",
"/private/var/tmp/*", "/Users/Shared/*", "/Library/Caches/*",
"/Users/*/Library/Caches/*", "/private/var/folders/*", "/var/folders/*")
'''
min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1555"
name = "Credentials from Password Stores"
reference = "https://attack.mitre.org/techniques/T1555/"
[[threat.technique.subtechnique]]
id = "T1555.001"
name = "Keychain"
reference = "https://attack.mitre.org/techniques/T1555/001/"
[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.name == "cp" and
process.command_line : "*login.keychain-db*" and
process.parent.executable like ("/tmp/*", "/private/tmp/*", "/var/tmp/*",
"/private/var/tmp/*", "/Users/Shared/*", "/Library/Caches/*",
"/Users/*/Library/Caches/*", "/private/var/folders/*", "/var/folders/*")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*login.keychain-db*" |
process.name | eq |
| field:"process_name" kind:eq value:"cp" |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |