process where host.os.type == "macos" and event.type in ("start", "process_started") and event.action == "exec" and
process.args like ("/Users/*/Library/Keychains/*", "/Library/Keychains/*", "login.keychain-db", "login.keychain") and
((process.code_signature.trusted == false or process.code_signature.exists == false) or
(process.name in ("bash", "sh", "zsh", "osascript", "cat", "echo", "cp") and
(process.parent.code_signature.trusted == false or process.parent.code_signature.exists == false)))
Install detection rules in Elastic Security
Detect Keychain CommandLine Interaction via Unsigned or Untrusted Process in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).