Executable File Extracted to Temporary Directory
Description
Detects a compressed executable file is extracted to a tmp directory. Threat actors will sometimes drop a compressed file and extract its contents (usually containing a payload) to a tmp directory in order to avoid being seen on the system.
Query · eql
file where event.action != "deletion" and
process.name in ("bsdtar", "tar", "unzip", "Archive Utility", "ArchiveService") and
file.path like ("/tmp/*", "/private/var/tmp/*", "/var/tmp/*") and
file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and
not file.path like~ "/private/var/tmp/*bazel*" and
not Effective_process.executable in ("/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
"/Applications/NinjaRMMAgent/programfiles/ninjarmm-macagent",
"/Library/Application Support/TrendMicro/RPD/RecoveryPackDownloader.app/Contents/MacOS/RecoveryPackDownloader",
"/Applications/Utilities/NacAgent.app/Contents/MacOS/NacAgent",
"/Applications/Warp.app/Contents/MacOS/stable",
"/usr/libexec/xpcproxy",
"/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/SimulatorTrampoline.xpc/Contents/MacOS/SimulatorTrampoline",
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService",
"/Library/Kandji/Kandji Agent.app/Contents/Helpers/Kandji Library Manager.app/Contents/MacOS/kandji-library-manager",
"/opt/jc/bin/jumpcloud-agent",
"/Library/Iru/Iru Agent.app/Contents/Helpers/Iru Library Manager.app/Contents/MacOS/kandji-library-manager")