2022-10-14 18:19:32 +00:00
|
|
|
-- Find unexpected executables in /etc
|
|
|
|
--
|
|
|
|
-- references:
|
|
|
|
-- * https://blog.lumen.com/chaos-is-a-go-based-swiss-army-knife-of-malware/
|
|
|
|
--
|
|
|
|
-- tags: persistent
|
|
|
|
-- platform: posix
|
2022-10-17 23:06:17 +00:00
|
|
|
SELECT
|
|
|
|
file.path,
|
2022-10-14 18:19:32 +00:00
|
|
|
file.directory,
|
|
|
|
uid,
|
|
|
|
gid,
|
|
|
|
mode,
|
|
|
|
file.mtime,
|
|
|
|
file.size,
|
|
|
|
hash.sha256,
|
|
|
|
magic.data
|
2022-10-17 23:06:17 +00:00
|
|
|
FROM
|
|
|
|
file
|
2022-10-14 18:19:32 +00:00
|
|
|
LEFT JOIN hash on file.path = hash.path
|
|
|
|
LEFT JOIN magic ON file.path = magic.path
|
2022-10-17 23:06:17 +00:00
|
|
|
WHERE
|
|
|
|
(file.path LIKE '/etc/%%')
|
2022-10-14 18:19:32 +00:00
|
|
|
AND file.type = 'regular'
|
|
|
|
AND (
|
|
|
|
file.mode LIKE '%7%'
|
|
|
|
or file.mode LIKE '%5%'
|
|
|
|
or file.mode LIKE '%1%'
|
|
|
|
)
|
|
|
|
AND file.directory NOT IN (
|
|
|
|
'/etc/acpi',
|
|
|
|
'/etc/alternatives',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/apcupsd',
|
2022-10-21 15:37:55 +00:00
|
|
|
'/etc/kde/shutdown',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/apm/resume.d',
|
|
|
|
'/etc/apm/scripts.d',
|
2022-10-21 15:37:55 +00:00
|
|
|
'/etc/nix/result',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/apm/suspend.d',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/avahi',
|
2022-10-21 15:37:55 +00:00
|
|
|
'/etc/nix/result/sw/bin',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/bash_completion.d',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/brltty/Contraction',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/chromium/native-messaging-hosts',
|
|
|
|
'/etc/cifs-utils',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/console-setup',
|
|
|
|
'/etc/cron.daily',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/cron.hourly',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/cron.monthly',
|
|
|
|
'/etc/cron.weekly',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/dhcp/dhclient.d',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/dhcp/dhclient-enter-hooks.d',
|
|
|
|
'/etc/dhcp/dhclient-exit-hooks.d',
|
|
|
|
'/etc/dkms',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/flatpak/remotes.d',
|
|
|
|
'/etc/gdm',
|
|
|
|
'/etc/gdm3',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/gdm3/Init',
|
|
|
|
'/etc/gdm3/PostLogin',
|
|
|
|
'/etc/gdm3/PostSession',
|
|
|
|
'/etc/gdm3/PreSession',
|
|
|
|
'/etc/gdm3/Prime',
|
|
|
|
'/etc/gdm3/PrimeOff',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/gdm/Init',
|
|
|
|
'/etc/gdm/PostLogin',
|
|
|
|
'/etc/gdm/PostSession',
|
|
|
|
'/etc/gdm/PreSession',
|
|
|
|
'/etc/grub.d',
|
|
|
|
'/etc/httpd/modules',
|
|
|
|
'/etc/ifplugd',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/ifplugd/action.d',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/init.d',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/kernel/header_postinst.d',
|
|
|
|
'/etc/kernel/install.d',
|
|
|
|
'/etc/kernel/postinst.d',
|
|
|
|
'/etc/kernel/postrm.d',
|
|
|
|
'/etc/kernel/preinst.d',
|
|
|
|
'/etc/kernel/prerm.d',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/lightdm',
|
|
|
|
'/etc/mcelog/triggers',
|
|
|
|
'/etc/menu-methods',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/network/if-down.d',
|
|
|
|
'/etc/network/if-post-down.d',
|
|
|
|
'/etc/network/if-pre-up.d',
|
|
|
|
'/etc/network/if-up.d',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/NetworkManager/dispatcher.d',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/openvpn',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/periodic/daily',
|
|
|
|
'/etc/periodic/monthly',
|
|
|
|
'/etc/periodic/weekly',
|
|
|
|
'/etc/pinentry',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/pm/sleep.d',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/ppp',
|
|
|
|
'/etc/ppp/ip-down.d',
|
|
|
|
'/etc/ppp/ip-up.d',
|
|
|
|
'/etc/ppp/ipv6-up.d',
|
|
|
|
'/etc/profile.d',
|
|
|
|
'/etc/qemu-ga',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/rc0.d',
|
|
|
|
'/etc/rc1.d',
|
|
|
|
'/etc/rc2.d',
|
|
|
|
'/etc/rc3.d',
|
|
|
|
'/etc/rc4.d',
|
|
|
|
'/etc/rc5.d',
|
|
|
|
'/etc/rc6.d',
|
|
|
|
'/etc/rc.d/init.d',
|
|
|
|
'/etc/rc.d/rc0.d',
|
|
|
|
'/etc/rc.d/rc1.d',
|
|
|
|
'/etc/rc.d/rc2.d',
|
|
|
|
'/etc/rc.d/rc3.d',
|
|
|
|
'/etc/rc.d/rc4.d',
|
|
|
|
'/etc/rc.d/rc5.d',
|
|
|
|
'/etc/rc.d/rc6.d',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/rcS.d',
|
|
|
|
'/etc/rdnssd',
|
|
|
|
'/etc/security',
|
|
|
|
'/etc/skel',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/ssl/certs',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/ssl/misc',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/ssl/trust-source',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/systemd/system',
|
|
|
|
'/etc/systemd/system/graphical.target.wants',
|
2022-10-14 19:14:24 +00:00
|
|
|
'/etc/systemd/system-shutdown',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/update-motd.d',
|
|
|
|
'/etc/vmware-tools',
|
|
|
|
'/etc/vpnc',
|
|
|
|
'/etc/wpa_supplicant',
|
|
|
|
'/etc/X11',
|
|
|
|
'/etc/X11/xinit',
|
|
|
|
'/etc/X11/xinit/xinitrc.d',
|
|
|
|
'/etc/xdg/Xwayland-session.d',
|
|
|
|
'/etc/zfs-fuse',
|
|
|
|
'/etc/zfs/zed.d',
|
2022-10-14 19:14:24 +00:00
|
|
|
'/etc/zfs/zpool.d'
|
2022-10-14 18:19:32 +00:00
|
|
|
)
|
|
|
|
AND file.path NOT IN (
|
|
|
|
'/etc/nftables.conf',
|
|
|
|
'/etc/rmt',
|
2022-10-21 15:37:55 +00:00
|
|
|
'/etc/paths.d/100-rvictl',
|
|
|
|
'/etc/profile',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/qemu-ifdown',
|
|
|
|
'/etc/qemu-ifup',
|
|
|
|
'/etc/opt/chrome/native-messaging-hosts/com.google.endpoint_verification.api_helper.json'
|
2022-10-17 23:06:17 +00:00
|
|
|
)
|
2022-10-21 15:37:55 +00:00
|
|
|
-- Nix (on macOS) -- actually a symbolic link
|
|
|
|
AND file.path NOT LIKE '/etc/profiles/per-user/%/bin/%'
|