User Keychain Copied via Suspicious Parent
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.
Query · eql
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/*")