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
|
|
|
|
(
|
|
|
|
path LIKE "/tmp/%.lock"
|
|
|
|
OR path LIKE "/var/run/%.lock"
|
|
|
|
OR path LIKE "/var/tmp/%.lock"
|
|
|
|
OR path LIKE "/dev/shm/%.lock"
|
|
|
|
OR path LIKE "/dev/mqueue/%.lock"
|
|
|
|
OR path LIKE "/tmp/.%.lock"
|
|
|
|
OR path LIKE "/var/run/.%.lock"
|
|
|
|
OR path LIKE "/var/tmp/.%.lock"
|
|
|
|
OR path LIKE "/dev/shm/.%.lock"
|
|
|
|
OR path LIKE "/dev/mqueue/.%.lock"
|
|
|
|
)
|
|
|
|
AND exception_key NOT IN (
|
|
|
|
'0,0,/var/run/unattended-upgrades.lock,regular,0640',
|
|
|
|
'500,0,/tmp/mysql.sock.lock,regular,0600',
|
|
|
|
'500,0,/tmp/mysqlx.sock.lock,regular,0600',
|
|
|
|
'0,0,/var/run/xtables.lock,regular,0600',
|
|
|
|
'0,0,/var/run/dnf-metadata.lock,regular,0644',
|
|
|
|
'0,0,/var/run/ufw.lock,regular,0644',
|
|
|
|
'0,0,/var/run/apport.lock,regular,0600',
|
|
|
|
'74,0,/tmp/mysql.sock.lock,regular,0600',
|
|
|
|
'74,0,/tmp/mysqlx.sock.lock,regular,0600',
|
|
|
|
'500,1001,/tmp/nwg-dock.lock,regular,0600'
|
|
|
|
)
|