2022-09-22 23:35:24 +00:00
|
|
|
-- Find root-run processes which link against libpcap
|
|
|
|
-- WARNING: This check consumes an unusual amount of system memory (up to 225MB)
|
2022-09-24 15:12:23 +00:00
|
|
|
SELECT
|
|
|
|
pmm.pid,
|
|
|
|
p.uid,
|
|
|
|
p.gid,
|
|
|
|
pmm.path AS lib_path,
|
|
|
|
p.path AS child_path,
|
|
|
|
p.name AS child_name,
|
|
|
|
p.cmdline AS child_cmd,
|
|
|
|
p.cwd AS child_cwd,
|
|
|
|
h.sha256 AS child_sha256,
|
|
|
|
pp.path AS parent_path,
|
|
|
|
pp.name AS parent_name,
|
|
|
|
pp.cmdline AS parent_cmd,
|
|
|
|
pp.cwd AS parent_cwd,
|
|
|
|
pp.euid AS parent_euid,
|
2022-09-26 22:27:43 +00:00
|
|
|
ph.sha256 AS parent_sha256,
|
|
|
|
s.authority,
|
|
|
|
s.identifier
|
2022-09-24 15:12:23 +00:00
|
|
|
FROM
|
|
|
|
process_memory_map pmm
|
|
|
|
LEFT JOIN processes p ON pmm.pid = p.pid
|
|
|
|
LEFT JOIN hash h ON p.path = h.path
|
|
|
|
LEFT JOIN processes pp ON p.parent = pp.pid
|
|
|
|
LEFT JOIN hash AS ph ON pp.path = ph.path
|
2022-09-26 22:27:43 +00:00
|
|
|
LEFT JOIN signature s ON p.path = s.path
|
2022-09-24 15:12:23 +00:00
|
|
|
WHERE
|
|
|
|
pmm.path LIKE "%libpcap%"
|
|
|
|
AND p.euid = 0
|
|
|
|
AND child_path NOT LIKE "/usr/local/kolide-k2/bin/osqueryd-updates/%/osqueryd"
|
|
|
|
AND child_path NOT LIKE "/nix/store/%-systemd-%/lib/systemd/systemd-journald"
|
|
|
|
AND child_path NOT LIKE "/nix/store/%-systemd-%/lib/systemd/systemd-logind"
|
|
|
|
AND child_path NOT LIKE "/nix/store/%-systemd-%/bin/udevadm"
|
2022-09-26 22:27:43 +00:00
|
|
|
AND child_path NOT LIKE "/opt/homebrew/Cellar/telepresence%"
|
2022-09-24 15:12:23 +00:00
|
|
|
AND child_path NOT LIKE "/System/Library/%"
|
|
|
|
AND child_path NOT LIKE "/nix/store/%/bin/nix"
|
|
|
|
AND child_path NOT IN (
|
|
|
|
"/usr/libexec/UserEventAgent",
|
|
|
|
"/usr/sbin/systemstats",
|
|
|
|
"/usr/bin/libvirtd",
|
|
|
|
"/usr/sbin/cupsd"
|
|
|
|
)
|
|
|
|
AND child_cmd NOT IN (
|
|
|
|
"/nix/var/nix/profiles/default/bin/nix-daemon",
|
|
|
|
"/run/current-system/systemd/lib/systemd/systemd",
|
|
|
|
"/usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid"
|
|
|
|
)
|
|
|
|
GROUP BY
|
|
|
|
pmm.pid
|