2023-05-16 20:31:31 +00:00
|
|
|
-- Find unexpected world readable run locks
|
|
|
|
--
|
|
|
|
-- false positives:
|
|
|
|
-- * none known
|
|
|
|
--
|
|
|
|
-- references:
|
|
|
|
-- * https://www.deepinstinct.com/blog/bpfdoor-malware-evolves-stealthy-sniffing-backdoor-ups-its-game
|
|
|
|
--
|
2023-06-08 22:26:57 +00:00
|
|
|
-- tags: persistent filesystem state seldom
|
2023-05-16 20:31:31 +00:00
|
|
|
-- platform: posix
|
2023-08-15 22:29:27 +00:00
|
|
|
SELECT
|
|
|
|
*,
|
|
|
|
CONCAT (
|
|
|
|
MIN(file.uid, 500),
|
|
|
|
",",
|
|
|
|
file.gid,
|
|
|
|
",",
|
|
|
|
file.path,
|
|
|
|
",",
|
|
|
|
file.type,
|
|
|
|
',',
|
|
|
|
mode
|
|
|
|
) AS exception_key
|
|
|
|
FROM
|
|
|
|
file
|
|
|
|
WHERE
|
|
|
|
(
|
2025-01-22 21:28:09 +00:00
|
|
|
path LIKE "/dev/mqueue/.%.lock"
|
2023-08-15 22:29:27 +00:00
|
|
|
OR path LIKE "/dev/mqueue/%.lock"
|
2025-01-22 21:28:09 +00:00
|
|
|
OR path LIKE "/dev/shm/.%.lock"
|
|
|
|
OR path LIKE "/dev/shm/%.lock"
|
2023-08-15 22:29:27 +00:00
|
|
|
OR path LIKE "/tmp/.%.lock"
|
2025-01-22 21:28:09 +00:00
|
|
|
OR path LIKE "/tmp/%.lock"
|
2023-08-15 22:29:27 +00:00
|
|
|
OR path LIKE "/var/run/.%.lock"
|
2025-01-22 21:28:09 +00:00
|
|
|
OR path LIKE "/var/run/%.lock"
|
2023-08-15 22:29:27 +00:00
|
|
|
OR path LIKE "/var/tmp/.%.lock"
|
2025-01-22 21:28:09 +00:00
|
|
|
OR path LIKE "/var/tmp/%.lock"
|
2023-08-15 22:29:27 +00:00
|
|
|
)
|
|
|
|
AND exception_key NOT IN (
|
2024-06-27 13:23:52 +00:00
|
|
|
'0,0,/var/run/apport.lock,regular,0600',
|
|
|
|
'0,0,/var/run/dnf-metadata.lock,regular,0644',
|
|
|
|
'0,0,/var/run/ublue-update.lock,regular,0755',
|
|
|
|
'0,0,/var/run/ufw.lock,regular,0644',
|
2023-08-15 22:29:27 +00:00
|
|
|
'0,0,/var/run/unattended-upgrades.lock,regular,0640',
|
2024-06-27 13:23:52 +00:00
|
|
|
'0,0,/var/run/xtables.lock,regular,0600',
|
2025-01-17 20:43:01 +00:00
|
|
|
'0,1,/var/run/prl_desktop_services_foreground.lock,regular,0644',
|
|
|
|
'0,1,/var/run/prl_desktop_services.lock,regular,0644',
|
2024-06-27 13:23:52 +00:00
|
|
|
'0,1,/var/run/VMware Fusion Services.lock,regular,0600',
|
2025-01-17 20:43:01 +00:00
|
|
|
'0,1,/var/run/xv-update-resolv-conf.lock,regular,0600',
|
2025-01-22 21:28:09 +00:00
|
|
|
'0,1001,/var/run/keyd.socket.lock,regular,0600',
|
2023-08-15 22:29:27 +00:00
|
|
|
'500,0,/tmp/mysql.sock.lock,regular,0600',
|
|
|
|
'500,0,/tmp/mysqlx.sock.lock,regular,0600',
|
2025-01-17 20:43:01 +00:00
|
|
|
'500,0,/tmp/write.lock,regular,0644',
|
2024-06-27 13:23:52 +00:00
|
|
|
'500,1000,/tmp/golangci-lint.lock,regular,0600',
|
|
|
|
'500,1001,/tmp/nwg-dock.lock,regular,0600',
|
2023-08-15 22:29:27 +00:00
|
|
|
'74,0,/tmp/mysql.sock.lock,regular,0600',
|
2025-01-17 20:43:01 +00:00
|
|
|
'74,0,/tmp/mysqlx.sock.lock,regular,0600'
|
2023-08-15 22:29:27 +00:00
|
|
|
)
|
2025-01-22 21:28:09 +00:00
|
|
|
AND NOT exception_key LIKE '500,0,/tmp/.s.PGSQL.%.lock,regular,0600'
|
2024-07-26 17:26:37 +00:00
|
|
|
AND NOT exception_key LIKE '500,1000,/tmp/keepassxc-%.lock,regular,0644'
|
2024-08-27 22:40:43 +00:00
|
|
|
AND NOT exception_key LIKE '500,1000,/tmp/keepassxc-%.lock,regular,0664'
|
2025-01-17 20:43:01 +00:00
|
|
|
AND NOT exception_key LIKE '500,1000,/tmp/vscode-remote-ssh-%-install.lock,regular,0664'
|