Executables From The Future
osquery
Programs which claim to be from the future, based on (btime,ctime,mtime)
Description
ODK (osquery-defense-kit) is unique in that the queries are designed to be used as part of a production detection & response pipeline. The detection queries are formulated to return zero rows during normal expected behavior, so that they may be configured to generate alerts when rows are returned.
Query
-- Programs which claim to be from the future, based on (btime,ctime,mtime)
--
-- references:
-- * https://attack.mitre.org/techniques/T1070/006/ (Indicator Removal on Host: Timestomp)
--
-- false positives:
-- * Badly distributed software
--
-- tags: persistent state process
SELECT
p.pid,
p.path,
p.name,
p.cmdline,
p.cwd,
p.euid,parent,
p.
f.ctime,
f.btime,
f.mtime,
p.start_time,> (strftime('%s', 'now') + 43200) AS mtime_newer,
f.mtime > (strftime('%s', 'now') + 43200) AS ctime_newer,
f.ctime > (strftime('%s', 'now') + 43200) AS btime_newer,
f.btime - strftime('%s', 'now') AS mtime_diff,
f.mtime - strftime('%s', 'now') AS ctime_diff,
f.ctime - strftime('%s', 'now') AS btime_diff,
f.btime '%s', 'now') AS now_ts,
strftime(hash.sha256 AS child_hash256,
AS parent_path,
pp.path AS parent_cmd,
pp.cmdline AS parent_cwd,
pp.cwd hash.sha256 AS parent_sha256
FROM
processes pLEFT 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
WHERE
(== 1
mtime_newer OR ctime_newer == 1
OR btime_newer == 1
)AND NOT p.path LIKE '/Applications/Signal.app%'
AND NOT p.path LIKE '/private/var/db/com.apple.xpc.roleaccountd.staging/%'
-- 2038
AND NOT f.mtime > 2153484373
tags: SStagSS