2022-10-18 12:52:05 +00:00
|
|
|
-- Surface webmail downloads of an unexpected sort
|
|
|
|
--
|
|
|
|
-- false positives:
|
|
|
|
-- * Files without an extension or extensions not explicitly added to the allow list
|
|
|
|
--
|
2022-10-19 20:56:32 +00:00
|
|
|
-- references:
|
|
|
|
-- * https://attack.mitre.org/techniques/T1566/001/ (Phishing: Spearphishing Attachment)
|
|
|
|
--
|
2022-10-18 12:52:05 +00:00
|
|
|
-- platform: darwin
|
|
|
|
-- tags: persistent filesystem spotlight
|
2022-10-19 20:19:53 +00:00
|
|
|
SELECT
|
|
|
|
file.path,
|
|
|
|
file.size,
|
|
|
|
datetime(file.btime, 'unixepoch') AS file_created,
|
|
|
|
magic.data,
|
|
|
|
hash.sha256,
|
|
|
|
LOWER(
|
|
|
|
REGEX_MATCH (RTRIM(file.path, '/'), '.*\.(.*?)$', 1)
|
|
|
|
) AS extension
|
|
|
|
FROM
|
|
|
|
mdfind
|
|
|
|
LEFT JOIN file ON mdfind.path = file.path
|
|
|
|
LEFT JOIN magic ON file.path = magic.path
|
|
|
|
LEFT JOIN hash ON file.path = hash.path
|
|
|
|
WHERE
|
|
|
|
mdfind.query = 'kMDItemWhereFroms == ''*https://mail.google.com/*'''
|
|
|
|
AND file.btime > (strftime('%s', 'now') -86400)
|
|
|
|
-- Extensions that would not normally raise suspicion if sent by e-mail (excludes dmg, iso, lnk, exe)
|
|
|
|
AND extension NOT IN (
|
|
|
|
'cer',
|
|
|
|
'csv',
|
|
|
|
'doc',
|
|
|
|
'docx',
|
|
|
|
'eml',
|
|
|
|
'gif',
|
|
|
|
'htm',
|
|
|
|
'html',
|
|
|
|
'icloud',
|
2022-10-27 20:26:43 +00:00
|
|
|
'jfif',
|
2022-10-19 20:19:53 +00:00
|
|
|
'jpeg',
|
|
|
|
'jpg',
|
2022-10-21 18:13:29 +00:00
|
|
|
'mov',
|
2022-10-19 20:19:53 +00:00
|
|
|
'mp3',
|
|
|
|
'mp4',
|
|
|
|
'mpeg',
|
|
|
|
'mpg',
|
|
|
|
'ods',
|
|
|
|
'odt',
|
|
|
|
'pdf',
|
|
|
|
'pem',
|
|
|
|
'pgp',
|
|
|
|
'png',
|
|
|
|
'ppt',
|
|
|
|
'pptx',
|
|
|
|
'pub',
|
|
|
|
'tif',
|
|
|
|
'tiff',
|
|
|
|
'txt',
|
|
|
|
'wav',
|
|
|
|
'xls',
|
|
|
|
'xlsm',
|
|
|
|
'xlsx',
|
2022-10-27 20:26:43 +00:00
|
|
|
'zip'
|
2022-10-19 20:19:53 +00:00
|
|
|
)
|