osquery-defense-kit/detection/execution/relative-exec-low-uid.sql

33 lines
768 B
MySQL
Raw Normal View History

2023-01-04 16:14:04 +00:00
-- Programs running as root with a relative path
--
-- references:
-- * https://www.microsoft.com/en-us/security/blog/2022/12/21/microsoft-research-uncovers-new-zerobot-capabilities/
--
-- tags: transient process rapid state
-- platform: linux
2023-01-09 20:10:48 +00:00
SELECT
p.pid,
2023-01-04 16:14:04 +00:00
p.name,
p.path,
p.euid,
p.gid,
p.cgroup_path,
f.ctime,
f.directory AS dirname,
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
2023-01-09 20:10:48 +00:00
FROM
processes p
2023-01-04 16:14:04 +00:00
LEFT JOIN file f ON p.path = f.path
LEFT JOIN hash ON hash.path = p.path
LEFT JOIN processes pp ON p.parent = pp.pid
2023-01-09 20:10:48 +00:00
WHERE
p.euid < 500
2023-01-06 21:01:35 +00:00
AND p.cmdline LIKE './%'
2023-01-09 20:10:48 +00:00
AND NOT p.cgroup_path LIKE '/system.slice/docker-%'