2023-01-18 19:10:33 +00:00
|
|
|
-- Find unexpected hidden directories in operating-system foldersbin/
|
2022-10-14 18:19:13 +00:00
|
|
|
--
|
2022-10-18 14:08:34 +00:00
|
|
|
-- references:
|
|
|
|
-- * https://themittenmac.com/what-does-apt-activity-look-like-on-macos/
|
|
|
|
--
|
2022-10-14 18:19:13 +00:00
|
|
|
-- false positives:
|
|
|
|
-- * unusual installers
|
|
|
|
--
|
2022-10-18 14:08:34 +00:00
|
|
|
-- platform: posix
|
2022-10-14 18:19:13 +00:00
|
|
|
-- tags: persistent filesystem state
|
2022-10-19 20:19:53 +00:00
|
|
|
SELECT
|
|
|
|
file.path,
|
2022-10-18 18:26:47 +00:00
|
|
|
file.directory,
|
2022-09-24 15:12:23 +00:00
|
|
|
uid,
|
|
|
|
gid,
|
|
|
|
mode,
|
|
|
|
mtime,
|
|
|
|
ctime,
|
|
|
|
type,
|
|
|
|
size,
|
|
|
|
hash.sha256,
|
|
|
|
magic.data
|
2022-10-19 20:19:53 +00:00
|
|
|
FROM
|
|
|
|
file
|
2022-09-24 15:12:23 +00:00
|
|
|
LEFT JOIN hash ON file.path = hash.path
|
|
|
|
LEFT JOIN magic ON file.path = magic.path
|
2022-10-19 20:19:53 +00:00
|
|
|
WHERE
|
|
|
|
(
|
2022-10-13 18:59:32 +00:00
|
|
|
file.path LIKE '/lib/.%'
|
|
|
|
OR file.path LIKE '/.%'
|
|
|
|
OR file.path LIKE '/bin/%/.%'
|
2022-10-18 18:26:47 +00:00
|
|
|
OR file.path LIKE '/dev/.%'
|
|
|
|
OR file.path LIKE '/etc/.%'
|
|
|
|
OR file.path LIKE '/etc/%/.%'
|
2022-10-13 18:59:32 +00:00
|
|
|
OR file.path LIKE '/lib/%/.%'
|
|
|
|
OR file.path LIKE '/libexec/.%'
|
|
|
|
OR file.path LIKE '/Library/.%'
|
|
|
|
OR file.path LIKE '/sbin/.%'
|
|
|
|
OR file.path LIKE '/sbin/%/.%'
|
|
|
|
OR file.path LIKE '/tmp/.%'
|
|
|
|
OR file.path LIKE '/usr/bin/.%'
|
|
|
|
OR file.path LIKE '/usr/lib/.%'
|
|
|
|
OR file.path LIKE '/usr/lib/%/.%'
|
|
|
|
OR file.path LIKE '/usr/libexec/.%'
|
|
|
|
OR file.path LIKE '/usr/local/bin/.%'
|
|
|
|
OR file.path LIKE '/usr/local/lib/.%'
|
|
|
|
OR file.path LIKE '/usr/local/lib/.%'
|
|
|
|
OR file.path LIKE '/usr/local/libexec/.%'
|
|
|
|
OR file.path LIKE '/usr/local/sbin/.%'
|
|
|
|
OR file.path LIKE '/usr/sbin/.%'
|
|
|
|
OR file.path LIKE '/var/.%'
|
|
|
|
OR file.path LIKE '/var/lib/.%'
|
|
|
|
OR file.path LIKE '/var/tmp/.%'
|
2022-10-18 18:26:47 +00:00
|
|
|
) -- Avoid mentioning extremely temporary files
|
2022-10-13 18:59:32 +00:00
|
|
|
AND strftime('%s', 'now') - file.ctime > 20
|
2022-09-24 15:12:23 +00:00
|
|
|
AND file.path NOT IN (
|
2022-10-13 18:59:32 +00:00
|
|
|
'/.autorelabel',
|
|
|
|
'/dev/.mdadm/',
|
2022-10-18 18:26:47 +00:00
|
|
|
'/etc/.clean',
|
2022-10-19 19:26:03 +00:00
|
|
|
'/etc/.java/',
|
|
|
|
'/etc/selinux/.config_backup',
|
|
|
|
'/etc/skel/.mozilla/',
|
2022-10-18 18:26:47 +00:00
|
|
|
'/.file',
|
2022-10-13 18:59:32 +00:00
|
|
|
'/tmp/../',
|
|
|
|
'/tmp/./',
|
2022-11-03 18:24:40 +00:00
|
|
|
'/tmp/.DS_Store',
|
2022-10-13 18:59:32 +00:00
|
|
|
'/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress',
|
2022-10-18 18:26:47 +00:00
|
|
|
'/tmp/._contentbarrier_installed',
|
2022-10-13 18:59:32 +00:00
|
|
|
'/tmp/.dotnet/',
|
2022-10-18 18:26:47 +00:00
|
|
|
'/tmp/.dracula-tmux-data',
|
|
|
|
'/tmp/.dracula-tmux-weather.lock',
|
2022-10-13 18:59:32 +00:00
|
|
|
'/tmp/.font-unix/',
|
|
|
|
'/tmp/.ICE-unix/',
|
|
|
|
'/tmp/.Test-unix/',
|
2022-10-18 18:26:47 +00:00
|
|
|
'/tmp/.vbox-t-ipc/',
|
2022-10-13 18:59:32 +00:00
|
|
|
'/tmp/.X0-lock',
|
2023-01-09 14:04:38 +00:00
|
|
|
'/tmp/.X1-lock',
|
|
|
|
'/tmp/.X2-lock',
|
2022-10-13 18:59:32 +00:00
|
|
|
'/tmp/.X11-unix/',
|
2022-10-18 18:26:47 +00:00
|
|
|
'/tmp/.X1-lock',
|
2022-10-13 18:59:32 +00:00
|
|
|
'/tmp/.XIM-unix/',
|
|
|
|
'/var/.ntw_cache',
|
|
|
|
'/var/.Parallels_swap/',
|
2022-10-18 18:26:47 +00:00
|
|
|
'/var/.pwd_cache',
|
2023-01-04 16:03:38 +00:00
|
|
|
'/etc/.resolv.conf.systemd-resolved.bak',
|
2022-10-18 18:26:47 +00:00
|
|
|
'/.vol/',
|
|
|
|
'/.VolumeIcon.icns'
|
2022-09-24 15:12:23 +00:00
|
|
|
)
|
2022-10-18 18:26:47 +00:00
|
|
|
AND file.directory NOT IN ('/etc/skel', '/etc/skel/.config')
|
|
|
|
AND file.path NOT LIKE '/%bin/bootstrapping/.default_components'
|
2022-10-13 18:59:32 +00:00
|
|
|
AND file.path NOT LIKE '/tmp/.#%'
|
2023-01-13 20:24:18 +00:00
|
|
|
AND file.path NOT LIKE '/tmp/.wine-%'
|
2022-10-18 18:26:47 +00:00
|
|
|
AND file.path NOT LIKE '/tmp/.%.gcode'
|
2022-10-19 19:26:03 +00:00
|
|
|
AND file.path NOT LIKE '/tmp/.vbox-%-ipc/'
|
2023-01-18 19:10:33 +00:00
|
|
|
AND file.path NOT LIKE '/tmp/.io.nwjs.%'
|
2022-10-13 18:59:32 +00:00
|
|
|
AND file.path NOT LIKE '/tmp/.com.google.Chrome.%'
|
|
|
|
AND file.path NOT LIKE '/tmp/.org.chromium.Chromium%'
|
|
|
|
AND file.path NOT LIKE '/tmp/.X1%-lock'
|
|
|
|
AND file.path NOT LIKE '/usr/local/%/.keepme'
|
|
|
|
AND file.path NOT LIKE '%/../'
|
|
|
|
AND file.path NOT LIKE '%/./'
|
|
|
|
AND file.path NOT LIKE '%/.build-id/'
|
|
|
|
AND file.path NOT LIKE '%/.dwz/'
|
|
|
|
AND file.path NOT LIKE '%/.updated'
|
|
|
|
AND file.path NOT LIKE '%/google-cloud-sdk/.install/'
|
2022-09-24 15:12:23 +00:00
|
|
|
AND NOT (
|
2022-10-13 18:59:32 +00:00
|
|
|
type = 'regular'
|
2022-09-24 15:12:23 +00:00
|
|
|
AND (
|
2022-10-13 18:59:32 +00:00
|
|
|
filename LIKE '%.swp'
|
2022-09-24 15:12:23 +00:00
|
|
|
OR size < 2
|
2022-08-31 18:34:42 +00:00
|
|
|
)
|
2022-09-24 15:12:23 +00:00
|
|
|
)
|
2022-10-18 18:26:47 +00:00
|
|
|
AND NOT (
|
|
|
|
type = 'regular'
|
|
|
|
AND filename = '.placeholder'
|
2023-01-09 14:34:20 +00:00
|
|
|
) -- A curious addition seen on NixOS and Fedora machines
|
2022-09-29 19:42:27 +00:00
|
|
|
AND NOT (
|
2022-10-13 18:59:32 +00:00
|
|
|
file.path = '/.cache/'
|
2022-09-29 19:42:27 +00:00
|
|
|
AND file.uid = 0
|
|
|
|
AND file.gid = 0
|
2023-01-09 14:34:20 +00:00
|
|
|
AND file.mode IN ('0755', '0700')
|
|
|
|
AND file.size < 4
|
2022-09-29 19:42:27 +00:00
|
|
|
)
|
|
|
|
AND NOT (
|
2022-10-13 18:59:32 +00:00
|
|
|
file.path = '/.config/'
|
2022-09-29 19:42:27 +00:00
|
|
|
AND file.uid = 0
|
|
|
|
AND file.gid = 0
|
2022-10-13 18:59:32 +00:00
|
|
|
AND file.mode IN ('0755', '0700')
|
2022-09-29 19:42:27 +00:00
|
|
|
AND file.size = 4
|
2022-10-19 20:19:53 +00:00
|
|
|
)
|
2023-01-09 14:04:38 +00:00
|
|
|
AND NOT (
|
|
|
|
file.path LIKE '/tmp/.java_pid%'
|
|
|
|
AND file.type = 'socket'
|
|
|
|
AND file.size = 0
|
|
|
|
)
|