osquery-defense-kit/fd/unexpected-bpf-user.sql

26 lines
793 B
MySQL
Raw Normal View History

2022-09-22 23:35:24 +00:00
-- Find running processes which link against libbpf
-- WARNING: This check consumes an unusual amount of system memory (up to 225MB)
2022-09-10 19:14:46 +00:00
SELECT pmm.pid,
pmm.path AS lib_path,
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,
hash.sha256 AS child_sha256,
phash.sha256 AS parent_sha256
2022-09-10 19:14:46 +00:00
FROM process_memory_map pmm
LEFT JOIN processes p ON pmm.pid = p.pid
LEFT JOIN processes pp ON p.parent = pp.pid
LEFT JOIN hash ON p.path = hash.path
2022-09-21 14:30:17 +00:00
LEFT JOIN hash AS phash ON pp.path = phash.path
2022-09-11 19:07:54 +00:00
WHERE (lib_path LIKE "%:bpf%" OR lib_path LIKE "%libbpf%")
AND p.path != '/usr/lib/systemd/systemd'
GROUP BY pmm.pid