2022-10-14 18:19:13 +00:00
|
|
|
-- Unexpected /etc/hosts entries
|
|
|
|
--
|
|
|
|
-- false positives:
|
|
|
|
-- * developers adding entries for their own use
|
|
|
|
--
|
2022-10-19 20:56:32 +00:00
|
|
|
-- references:
|
|
|
|
-- * https://attack.mitre.org/techniques/T1565/001/ (Data Manipulation: Stored Data Manipulation)
|
|
|
|
--
|
2022-10-14 18:19:13 +00:00
|
|
|
-- tags: persistent seldom filesystem net
|
2022-09-24 15:12:23 +00:00
|
|
|
SELECT
|
|
|
|
*
|
|
|
|
FROM
|
|
|
|
etc_hosts
|
|
|
|
WHERE
|
|
|
|
hostnames NOT IN (
|
2022-10-13 18:59:32 +00:00
|
|
|
'localhost',
|
|
|
|
'localhost ip6-localhost ip6-loopback',
|
2022-10-13 22:08:03 +00:00
|
|
|
'localhost localhost.localdomain localhost4 localhost4.localdomain4',
|
2022-10-13 18:59:32 +00:00
|
|
|
'ip6-allnodes',
|
|
|
|
'ip6-allrouters',
|
|
|
|
'kubernetes'
|
2022-09-24 15:12:23 +00:00
|
|
|
)
|
|
|
|
AND address NOT IN (
|
2022-10-13 18:59:32 +00:00
|
|
|
'::1',
|
|
|
|
'ff02::1',
|
|
|
|
'ff02::2',
|
|
|
|
'255.255.255.255',
|
|
|
|
'fe00::0',
|
|
|
|
'ff00::0'
|
2022-09-24 15:12:23 +00:00
|
|
|
)
|
2022-10-21 21:49:12 +00:00
|
|
|
AND address NOT LIKE '127.%'
|
2022-09-24 15:12:23 +00:00
|
|
|
AND hostnames NOT LIKE 'localhost.%'
|
|
|
|
AND hostnames NOT LIKE '%.svc'
|
2022-10-13 21:58:29 +00:00
|
|
|
AND hostnames NOT LIKE '%.%-%.%.dev'
|
2022-10-13 22:06:07 +00:00
|
|
|
AND hostnames NOT LIKE '%.wtf'
|
2022-09-24 15:12:23 +00:00
|
|
|
AND hostnames NOT LIKE '%.test'
|
|
|
|
AND hostnames NOT LIKE '%.internal'
|
|
|
|
AND hostnames NOT LIKE '%.local'
|
|
|
|
AND hostnames NOT LIKE 'ip6-%'
|