osquery-defense-kit/process/name_path_mismatch.sql

31 lines
837 B
MySQL
Raw Normal View History

2022-09-09 16:51:52 +00:00
SELECT p.name,
2022-09-15 13:34:45 +00:00
SUBSTR(SPLIT(p.name, ":./-", 0), 0, 8) AS short_name,
SUBSTR(SPLIT(p.name, ":./-", 0), 0, 8) AS short_filename,
2022-09-09 16:51:52 +00:00
f.filename,
p.path,
p.cmdline
FROM processes p
JOIN file f ON p.path = f.path
2022-09-15 13:34:45 +00:00
WHERE short_filename != short_name
2022-09-12 10:52:28 +00:00
AND NOT (p.name='gnome-character' AND filename='gjs-console')
2022-09-09 16:51:52 +00:00
AND NOT (p.name='mysqld' AND filename='mariadbd')
AND NOT (p.name='systemd-udevd' AND filename='udevadm')
2022-09-15 13:34:45 +00:00
AND NOT (p.short_name = 'npm' AND filename='node')
2022-09-10 11:24:17 +00:00
AND NOT (p.name='GUI Thread' AND filename='resolve')
2022-09-09 16:51:52 +00:00
AND NOT (p.name='X' AND filename='Xorg')
AND NOT p.path LIKE '/nix/store/%/bin/bash'
AND NOT p.path LIKE '/usr/bin/python3%'
AND NOT filename IN (
2022-09-11 19:07:54 +00:00
'bash',
'chrome',
2022-09-09 16:51:52 +00:00
'dash',
'electron',
'firefox',
2022-09-11 19:07:54 +00:00
'ruby',
'sh',
'slack',
2022-09-09 16:51:52 +00:00
'systemd',
2022-09-14 11:54:39 +00:00
'busybox',
2022-09-11 19:07:54 +00:00
'thunderbird'
2022-09-09 16:51:52 +00:00
)