Detection rules › Elastic
User Keychain copied via Shell interpreter
Detects when the copy command is used to copy the user keychain database via a shell interpreter. Some recent malware stealer samples have been seen using this technique to retrieve sensitive files prior to exfiltration. The copying of the user keychain database is not normal activity under almost any circumstance and should be considered highly suspicious if not malicious.
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 via a shell interpreter. Some recent malware
stealer samples have been seen using this technique to retrieve sensitive files prior to exfiltration. The copying of
the user keychain database is not normal activity under almost any circumstance and should be considered highly
suspicious if not malicious.
"""
id = "8b0e22e0-dfee-46fa-8695-be94334d34f1"
license = "Elastic License v2"
name = "User Keychain copied via Shell interpreter"
os_list = ["macos"]
reference = ["https://hunt.io/blog/macos-malware-impersonates-the-unarchiver-app-to-steal-user-data"]
version = "1.0.3"
query = '''
process where event.type == "start" and event.action == "exec" and process.name == "cp" and
process.command_line like~ "*/Users/*/Library/Keychains/login.keychain-db*" and
process.parent.name in~ ("bash", "zsh", "sh", "Terminal")
'''
min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[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 like~ "*/Users/*/Library/Keychains/login.keychain-db*" and
process.parent.name in~ ("bash", "zsh", "sh", "Terminal")
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:"*/Users/*/Library/Keychains/login.keychain-db*" |
process.name | eq |
| field:"process_name" kind:eq value:"cp" |
process.parent.name | in |
| field:"parent_process_name" kind:in |