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',
|
2023-01-09 20:10:48 +00:00
|
|
|
'/etc/acpi/actions',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/alternatives',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/apcupsd',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/apm/resume.d',
|
|
|
|
'/etc/apm/scripts.d',
|
|
|
|
'/etc/apm/suspend.d',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/avahi',
|
|
|
|
'/etc/bash_completion.d',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/brltty/Contraction',
|
2022-12-15 21:51:58 +00:00
|
|
|
'/etc/ca-certificates/update.d',
|
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-12-15 21:51:58 +00:00
|
|
|
'/etc/initramfs/post-update.d',
|
2022-11-10 17:14:18 +00:00
|
|
|
'/etc/kde/shutdown',
|
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',
|
2022-12-15 21:51:58 +00:00
|
|
|
'/etc/localtime',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/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-11-10 17:14:18 +00:00
|
|
|
'/etc/nix/result',
|
|
|
|
'/etc/nix/result/sw/bin',
|
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-12-15 21:51:58 +00:00
|
|
|
'/etc/pop-os/update-motd.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',
|
2022-11-10 17:14:18 +00:00
|
|
|
'/etc/redhat-lsb',
|
2022-12-15 21:51:58 +00:00
|
|
|
'/etc/resolvconf/update.d',
|
2023-02-21 00:10:12 +00:00
|
|
|
'/etc/needrestart/notify.d',
|
|
|
|
'/etc/needrestart/hook.d',
|
|
|
|
'/etc/needrestart/restart.d',
|
|
|
|
'/etc/sysconfig/network-scripts',
|
2022-10-14 18:36:41 +00:00
|
|
|
'/etc/security',
|
|
|
|
'/etc/skel',
|
2023-02-23 15:33:10 +00:00
|
|
|
'/etc/network',
|
2023-02-21 00:10:12 +00:00
|
|
|
'/etc/pki/tls/misc',
|
2023-01-09 20:10:48 +00:00
|
|
|
'/etc/smartmontools',
|
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-12-15 21:51:58 +00:00
|
|
|
'/etc/udev/rules.d',
|
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',
|
2023-02-23 15:33:10 +00:00
|
|
|
'/etc/sv/ssh/run',
|
|
|
|
'/etc/sv/ssh/finish',
|
|
|
|
'/etc/libpaper.d/texlive-base',
|
2023-03-30 22:44:01 +00:00
|
|
|
'/etc/vpl/vars.sh',
|
2022-10-14 18:19:32 +00:00
|
|
|
'/etc/rmt',
|
2022-11-22 14:21:03 +00:00
|
|
|
'/etc/grub2.cfg',
|
2023-02-21 00:10:12 +00:00
|
|
|
'/etc/pki/tls/certs/renew-dummy-cert',
|
|
|
|
'/etc/pki/tls/certs/make-dummy-cert',
|
2023-01-16 17:56:39 +00:00
|
|
|
'/etc/shutdown.sh',
|
|
|
|
'/etc/pwrstatd.conf',
|
|
|
|
'/etc/hibernate.sh',
|
2022-11-22 14:21:03 +00:00
|
|
|
'/etc/grub2-efi.cfg',
|
2022-10-21 15:37:55 +00:00
|
|
|
'/etc/paths.d/100-rvictl',
|
|
|
|
'/etc/profile',
|
2023-01-13 19:10:43 +00:00
|
|
|
'/etc/sudoers.d/lima',
|
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/%'
|
2023-01-09 20:10:48 +00:00
|
|
|
AND file.path NOT LIKE '/etc/pwrstatd-%.sh'
|
|
|
|
AND file.path NOT LIKE '/etc/pwrstatd-%.sh'
|