2022-10-04 13:37:40 +00:00
|
|
|
-- Programs which were spawned by an executable containing a matching ctime & mtime, which
|
2022-10-13 18:59:32 +00:00
|
|
|
-- on Linux only generally occurs occurs if you run 'touch <bin>'
|
2022-10-14 18:19:13 +00:00
|
|
|
--
|
|
|
|
-- references:
|
2022-10-19 20:56:32 +00:00
|
|
|
-- * https://attack.mitre.org/techniques/T1070/006/ (Timestomping)
|
2022-10-14 18:19:13 +00:00
|
|
|
--
|
|
|
|
-- tags: transient process state
|
|
|
|
-- platform: linux
|
2022-10-12 01:53:36 +00:00
|
|
|
SELECT
|
|
|
|
p.pid,
|
2022-10-04 13:37:40 +00:00
|
|
|
p.path,
|
|
|
|
p.name,
|
|
|
|
p.cmdline,
|
|
|
|
p.cwd,
|
|
|
|
p.euid,
|
|
|
|
p.parent,
|
|
|
|
f.ctime,
|
|
|
|
f.btime,
|
|
|
|
f.mtime,
|
|
|
|
p.start_time,
|
|
|
|
pp.path AS parent_path,
|
|
|
|
pp.cmdline AS parent_cmd,
|
|
|
|
pp.cwd AS parent_cwd,
|
|
|
|
hash.sha256 AS sha256
|
2022-10-12 01:53:36 +00:00
|
|
|
FROM
|
|
|
|
processes p
|
2022-10-04 13:37:40 +00:00
|
|
|
LEFT JOIN file f ON p.path = f.path
|
|
|
|
LEFT JOIN processes pp ON p.parent = pp.pid
|
|
|
|
LEFT JOIN hash ON p.path = hash.path
|
2022-10-12 01:53:36 +00:00
|
|
|
WHERE
|
|
|
|
f.ctime = f.mtime
|
2022-10-19 19:26:03 +00:00
|
|
|
AND p.path != '/'
|
2023-07-12 21:38:26 +00:00
|
|
|
AND f.path NOT IN (
|
|
|
|
'/opt/google/endpoint-verification/bin/apihelper',
|
|
|
|
'/usr/bin/melange'
|
|
|
|
)
|
2022-10-17 23:01:16 +00:00
|
|
|
AND f.path NOT LIKE '/home/%'
|
2022-12-19 23:06:06 +00:00
|
|
|
AND f.path NOT LIKE '/snap/%'
|
2023-07-13 23:43:35 +00:00
|
|
|
AND f.path NOT LIKE '/tmp/%go-build%/exe/%'
|
2022-12-19 23:06:06 +00:00
|
|
|
AND f.path NOT LIKE '/usr/local/bin/%'
|
2023-01-03 13:50:19 +00:00
|
|
|
AND f.path NOT LIKE '/usr/local/aws-cli/%/dist/aws'
|
2022-12-19 23:06:06 +00:00
|
|
|
AND f.path NOT LIKE '/usr/local/kolide-k2/bin/%-updates/%'
|
2023-02-24 21:30:17 +00:00
|
|
|
AND f.path NOT LIKE '/tmp/go-build%'
|
2023-02-21 00:10:12 +00:00
|
|
|
AND p.name != 'osqtool'
|
2022-10-12 01:53:36 +00:00
|
|
|
GROUP by
|
|
|
|
p.pid
|