2022-10-14 18:19:32 +00:00
|
|
|
-- Find programs running from strange directories on macOS
|
|
|
|
--
|
|
|
|
-- false positives:
|
|
|
|
-- - Vendors who are doing weird things that are not in the signature list
|
|
|
|
--
|
|
|
|
-- See "execdir-events" for the version that is more likely to catch things
|
|
|
|
--
|
|
|
|
-- platform: darwin
|
|
|
|
-- tags: transient seldom process filesystem state
|
|
|
|
SELECT
|
|
|
|
p.pid,
|
|
|
|
p.name,
|
|
|
|
p.path,
|
|
|
|
p.euid,
|
|
|
|
p.gid,
|
|
|
|
f.ctime,
|
2022-11-03 20:00:19 +00:00
|
|
|
f.directory AS dir,
|
|
|
|
REPLACE(f.directory, u.directory, '~') AS homedir,
|
2022-10-14 18:19:32 +00:00
|
|
|
p.cmdline,
|
|
|
|
hash.sha256,
|
|
|
|
pp.path AS parent_path,
|
|
|
|
pp.name AS parent_name,
|
|
|
|
pp.cmdline AS parent_cmdline,
|
|
|
|
pp.euid AS parent_euid,
|
|
|
|
hash.sha256 AS parent_sha256,
|
|
|
|
signature.identifier,
|
|
|
|
signature.authority
|
|
|
|
FROM
|
|
|
|
processes p
|
|
|
|
LEFT JOIN file f ON p.path = f.path
|
|
|
|
LEFT JOIN hash ON hash.path = p.path
|
|
|
|
LEFT JOIN users u ON p.uid = u.uid
|
|
|
|
LEFT JOIN processes pp ON p.parent = pp.pid
|
2022-11-03 20:00:19 +00:00
|
|
|
LEFT JOIN signature ON p.path = signature.path
|
2022-10-14 18:19:32 +00:00
|
|
|
WHERE
|
2022-11-03 20:00:19 +00:00
|
|
|
dir NOT IN (
|
2022-10-14 18:19:32 +00:00
|
|
|
'/bin',
|
2022-11-03 20:00:19 +00:00
|
|
|
'/Library/Application Support/Logitech.localized/Logitech Options.localized/LogiMgrUpdater.app/Contents/Resources',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/Library/DropboxHelperTools/Dropbox_u501',
|
2022-10-28 23:24:00 +00:00
|
|
|
'/Library/Filesystems/kbfuse.fs/Contents/Resources',
|
2022-11-03 20:00:19 +00:00
|
|
|
'/Library/Frameworks/Python.framework/Versions/3.10/bin',
|
|
|
|
'/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers.app/Contents/MacOS',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/GoogleSoftwareUpdateAgent.app/Contents/MacOS',
|
|
|
|
'/Library/Printers/DYMO/Utilities',
|
|
|
|
'/Library/PrivilegedHelperTools',
|
2022-11-03 20:00:19 +00:00
|
|
|
'/Library/TeX/texbin',
|
|
|
|
'/nix/store',
|
|
|
|
'/nix/var/nix/profiles/default/bin',
|
|
|
|
'/node_modules/.bin',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gke-gcloud-auth-plugin',
|
|
|
|
'/opt/usr/bin',
|
|
|
|
'/opt/X11/bin',
|
|
|
|
'/opt/X11/libexec',
|
2022-11-03 20:00:19 +00:00
|
|
|
'/run/current-system/sw/bin',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/sbin',
|
|
|
|
'/usr/bin',
|
|
|
|
'/usr/lib',
|
|
|
|
'/usr/lib/bluetooth',
|
|
|
|
'/usr/lib/cups/notifier',
|
|
|
|
'/usr/libexec',
|
|
|
|
'/usr/libexec/ApplicationFirewall',
|
|
|
|
'/usr/libexec/AssetCache',
|
2022-11-03 20:00:19 +00:00
|
|
|
'/usr/libexec/firmwarecheckers/eficheck',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/usr/libexec/rosetta',
|
2022-11-03 20:00:19 +00:00
|
|
|
'/usr/lib/fwupd',
|
|
|
|
'/usr/lib/ibus',
|
|
|
|
'/usr/lib/system',
|
|
|
|
'/usr/sbin'
|
2022-10-14 18:19:32 +00:00
|
|
|
)
|
|
|
|
AND homedir NOT IN (
|
|
|
|
'~/bin',
|
2022-11-03 20:00:19 +00:00
|
|
|
'~/code/bin',
|
2022-10-14 18:19:32 +00:00
|
|
|
'~/go/bin',
|
|
|
|
'~/Library/Application Support/cloud-code/installer/google-cloud-sdk/bin',
|
|
|
|
'~/Library/Application Support/Code/User/globalStorage/grafana.vscode-jsonnet/bin',
|
2022-11-03 20:00:19 +00:00
|
|
|
'~/Library/Application Support/com.elgato.StreamDeck/Plugins/com.lostdomain.zoom.sdPlugin',
|
|
|
|
'~/Library/Application Support/dev.warp.Warp-Stable',
|
|
|
|
'~/Library/Printers/Brother MFC-J5330DW.app/Contents/MacOS',
|
|
|
|
'~/.local/bin',
|
|
|
|
'~/.local/share/nvim/mason/packages/tflint',
|
|
|
|
'~/.local/share/nvim.old/mason/packages/tflint',
|
|
|
|
'~/projects/go/bin'
|
2022-10-14 18:19:32 +00:00
|
|
|
)
|
|
|
|
AND signature.authority NOT IN (
|
2022-11-03 20:00:19 +00:00
|
|
|
'Apple iPhone OS Application Signing',
|
2022-10-14 18:19:32 +00:00
|
|
|
'Apple Mac OS Application Signing',
|
|
|
|
'Developer ID Application: Adobe Inc. (JQ525L2MZD)',
|
2022-11-03 20:00:19 +00:00
|
|
|
'Developer ID Application: Cisco (DE8Y96K9QP)',
|
|
|
|
'Developer ID Application: CodeWeavers Inc. (9C6B7X7Z8E)',
|
2022-10-14 18:19:32 +00:00
|
|
|
'Developer ID Application: Corsair Memory, Inc. (Y93VXCB8Q5)',
|
|
|
|
'Developer ID Application: Docker Inc (9BNSXJN65R)',
|
|
|
|
'Developer ID Application: Dropbox, Inc. (G7HH3F8CAK)',
|
|
|
|
'Developer ID Application: Figma, Inc. (T8RA8NE3B7)',
|
|
|
|
'Developer ID Application: GEORGE NACHMAN (H7V7XYVQ7D)',
|
2022-11-03 20:00:19 +00:00
|
|
|
'Developer ID Application: Google LLC (EQHXZ8M8AV)',
|
2022-10-14 18:19:32 +00:00
|
|
|
'Developer ID Application: Hashicorp, Inc. (D38WU7D763)',
|
|
|
|
'Developer ID Application: Logitech Inc. (QED4VVPZWA)',
|
|
|
|
'Developer ID Application: Microsoft Corporation (UBF8T346G9)',
|
2022-11-03 20:00:19 +00:00
|
|
|
'Developer ID Application: Node.js Foundation (HX7739G8FX)',
|
2022-10-14 18:19:32 +00:00
|
|
|
'Developer ID Application: Objective Development Software GmbH (MLZF7K7B5R)',
|
|
|
|
'Developer ID Application: Objective-See, LLC (VBG97UB4TA)',
|
|
|
|
'Developer ID Application: Opal Camera Inc (97Z3HJWCRT)',
|
|
|
|
'Developer ID Application: Oracle America, Inc. (VB5E2TV963)',
|
2022-11-03 20:00:19 +00:00
|
|
|
'Developer ID Application: TablePlus Inc (3X57WP8E8V)',
|
2022-10-14 18:19:32 +00:00
|
|
|
'Developer ID Application: Tenable, Inc. (4B8J598M7U)',
|
|
|
|
'Developer ID Application: Valve Corporation (MXGJJ98X76)',
|
|
|
|
'Developer ID Application: Wireshark Foundation, Inc. (7Z6EMTD2C6)',
|
|
|
|
'Software Signing'
|
|
|
|
)
|
2022-11-03 20:00:19 +00:00
|
|
|
AND dir NOT LIKE '/Applications/%.app/%'
|
|
|
|
AND dir NOT LIKE '/Applications/Utilities/Adobe Creative Cloud/%'
|
|
|
|
AND dir NOT LIKE '/etc/profiles/per-user/%/bin'
|
|
|
|
AND dir NOT LIKE '/home/%'
|
|
|
|
AND dir NOT LIKE '/Library/Apple/System/%'
|
|
|
|
AND dir NOT LIKE '/Library/Application Support/Adobe/%'
|
|
|
|
AND dir NOT LIKE '/Library/Application Support/%/Contents/MacOS'
|
|
|
|
AND dir NOT LIKE '/Library/Audio/Plug-Ins/%/Contents/MacOS'
|
|
|
|
AND dir NOT LIKE '/Library/%/%.bundle/Contents/Helpers'
|
|
|
|
AND dir NOT LIKE '/Library/CoreMediaIO/Plug-Ins/%'
|
|
|
|
AND dir NOT LIKE '/Library/Developer/%'
|
|
|
|
AND dir NOT LIKE '/Library/Internet Plug-Ins/%/Contents/MacOS'
|
|
|
|
AND dir NOT LIKE '/Library/Java/JavaVirtualMachines/%'
|
|
|
|
AND dir NOT LIKE '/Library/Printers/%.app/Contents/MacOS'
|
|
|
|
AND dir NOT LIKE '/Library/PrivilegedHelperTools/com.%'
|
|
|
|
AND dir NOT LIKE '/Library/%/Resources/%/Contents/MacOS'
|
|
|
|
AND dir NOT LIKE '/Library/%/sbin' -- Nessus
|
|
|
|
AND dir NOT LIKE '/Library/SystemExtensions/%'
|
|
|
|
AND dir NOT LIKE '/nix/store/%'
|
2022-11-04 23:04:31 +00:00
|
|
|
AND dir NOT LIKE '/opt/%/bin'
|
2022-11-03 20:00:19 +00:00
|
|
|
AND dir NOT LIKE '/opt/homebrew/Caskroom/%'
|
|
|
|
AND dir NOT LIKE '/opt/homebrew/Cellar/%'
|
|
|
|
AND dir NOT LIKE '/private/tmp/%.app/Contents/MacOS'
|
|
|
|
AND dir NOT LIKE '/private/tmp/go-build%/exe'
|
|
|
|
AND dir NOT LIKE '/private/tmp/KSInstallAction.%/Install Google Software Update.app/Contents/Helpers'
|
|
|
|
AND dir NOT LIKE '/private/tmp/nix-build-%'
|
|
|
|
AND dir NOT LIKE '/private/tmp/PKInstallSandbox.%/Scripts/com.microsoft.OneDrive.%'
|
|
|
|
AND dir NOT LIKE '/private/var/db/com.apple.xpc.roleaccountd.staging/%.xpc/Contents/MacOS'
|
|
|
|
AND dir NOT LIKE '/private/var/folders/%/bin'
|
|
|
|
AND dir NOT LIKE '/private/var/folders/%/Contents/%'
|
|
|
|
AND dir NOT LIKE '/private/var/folders/%/d/Wrapper/%.app'
|
|
|
|
AND dir NOT LIKE '/private/var/folders/%/go-build%'
|
|
|
|
AND dir NOT LIKE '/private/var/folders/%/GoLand'
|
|
|
|
AND dir NOT LIKE '/snap/%'
|
|
|
|
AND dir NOT LIKE '/store/%/bin'
|
|
|
|
AND dir NOT LIKE '/System/%'
|
|
|
|
AND dir NOT LIKE '/Users/%'
|
|
|
|
AND dir NOT LIKE '/usr/libexec/%'
|
|
|
|
AND dir NOT LIKE '/usr/local/%'
|
|
|
|
AND dir NOT LIKE '/Volumes/com.getdropbox.dropbox-%'
|
|
|
|
AND homedir NOT LIKE '~/homebrew/Cellar/%'
|
|
|
|
AND homedir NOT LIKE '~/Library/Caches/ms-playwright/%'
|
|
|
|
AND homedir NOT LIKE '~/.local/share/%'
|
2022-10-14 18:19:32 +00:00
|
|
|
AND homedir NOT LIKE '~/%/node_modules/.pnpm/esbuild-%/node_modules/esbuild-darwin-arm64/bin'
|
2022-11-03 20:00:19 +00:00
|
|
|
AND homedir NOT LIKE '~/.tflint.d/plugins/%'
|
|
|
|
|