osquery-defense-kit/process/hidden-cwd.sql

27 lines
741 B
MySQL
Raw Normal View History

2022-09-30 18:12:24 +00:00
SELECT p.pid,
p.path,
p.name,
p.cmdline,
p.cwd,
p.euid,
p.parent,
pp.path AS parent_path,
pp.name AS parent_name,
pp.cmdline AS parent_cmdline,
pp.cwd AS parent_cwd,
pp.euid AS parent_euid,
2022-09-30 18:12:24 +00:00
hash.sha256
FROM processes p
LEFT JOIN processes pp ON p.parent = pp.pid
LEFT JOIN hash ON p.path = hash.path
2022-09-30 18:12:24 +00:00
WHERE p.cwd LIKE "%/.%"
AND NOT (
p.cwd LIKE "%/.local/share%"
OR p.cwd LIKE "%/.vscode/extensions%"
OR p.cwd LIKE "/Users/%/.%"
OR p.cwd LIKE "/home/%/.%"
OR p.cwd LIKE "/Library/Apple/System/Library/InstallerSandboxes/.PKInstallSandboxManager-SystemSoftware/%"
OR p.cwd LIKE "/tmp/.wine-%/server-%"
OR p.name IN ('bindfs', 'wineserver')
OR p.path = "/usr/libexec/dirhelper"
2022-09-30 18:12:24 +00:00
)