Quarantine Cleared via Xattr Followed by Ad-hoc Codesign
Description
Identifies recursive clearing of extended attributes with xattr -rc immediately followed by ad-hoc codesigning using a dash identity (codesign --sign -). Malware and stealers use this chain to remove the quarantine flag from downloaded payloads and apply an ad-hoc signature so binaries can run with fewer Gatekeeper prompts.
Query · eql
sequence by process.parent.entity_id with maxspan=30s
[process where event.type == "start" and event.action == "exec" and process.name == "xattr" and
(
process.args in ("-rc", "-cr") or
(process.args == "-r" and process.args == "-c") or
(process.args == "-d" and process.args == "com.apple.quarantine")
) and
/* https://github.com/NousResearch/hermes-agent/blob/main/scripts/install.sh#L2349 */
not process.Ext.effective_parent.executable like "/Volumes/Hermes*/Hermes.app/Contents/MacOS/Hermes-Setup" and
not process.args like "/Users/*/.hermes/hermes-agent/apps/desktop/release/mac-arm64/Hermes.app" and
not process.Ext.effective_parent.executable == "/Applications/Cursor.app/Contents/MacOS/Cursor"
]
[process where event.type == "start" and event.action == "exec" and
process.name == "codesign" and
process.args in ("--sign", "-s") and process.args in ("--force", "-f") and process.args == "--deep"]