Defense Evasion (TA0005)(external, opens in a new tab or window)
text code block:FROM logs-endpoint.events.* | WHERE host.os.type == "macos" AND event.action == "tcc_modify" AND Tcc.right == "allowed" AND Tcc.update_type == "create" AND Tcc.service IN ("SystemPolicyDocumentsFolder", "SystemPolicyDownloadsFolder", "SystemPolicyDesktopFolder") AND Effective_process.name RLIKE "(bash|zsh|sh|osascript|python.*|perl.*|ruby.*|node|Terminal|iTerm2|ghostty)" | STATS Esql.grant_count = COUNT(*), Esql.unique_folders = COUNT_DISTINCT(Tcc.service), Esql.folders = VALUES(Tcc.service) BY Effective_process.entity_id, Effective_process.executable, host.name, user.name | WHERE Esql.unique_folders >= 2 | KEEP Esql.*, Effective_process.entity_id, Effective_process.executable, host.name, user.name
Install detection rules in Elastic Security
Detect Suspicious TCC Access Granted for User Folders 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(external, opens in a new tab or window).