2022-10-14 18:19:13 +00:00
|
|
|
-- Programs which are reading an unusually large amount of data
|
|
|
|
--
|
|
|
|
-- Can be used to detect exfiltration
|
|
|
|
--
|
|
|
|
-- false positives:
|
|
|
|
-- * Virtual Machine managers
|
|
|
|
-- * Backup software
|
|
|
|
--
|
2022-10-19 20:56:32 +00:00
|
|
|
-- references:
|
|
|
|
-- * https://attack.mitre.org/tactics/TA0010/ (Exfiltration)
|
|
|
|
--
|
2022-10-14 18:19:13 +00:00
|
|
|
-- tags: transient process
|
2022-10-17 23:06:17 +00:00
|
|
|
SELECT
|
|
|
|
p.name,
|
2022-09-24 15:12:23 +00:00
|
|
|
p.path,
|
|
|
|
p.cmdline,
|
|
|
|
p.on_disk,
|
|
|
|
p.parent,
|
|
|
|
p.start_time,
|
|
|
|
hash.sha256,
|
|
|
|
p.disk_bytes_read,
|
|
|
|
p.cwd,
|
|
|
|
(strftime('%s', 'now') - start_time) AS age,
|
|
|
|
disk_bytes_read / (strftime('%s', 'now') - start_time) AS bytes_per_second
|
2022-10-17 23:06:17 +00:00
|
|
|
FROM
|
|
|
|
processes p
|
2022-09-24 15:12:23 +00:00
|
|
|
LEFT JOIN hash ON p.path = hash.path
|
2022-10-17 23:06:17 +00:00
|
|
|
WHERE
|
2022-10-31 21:40:37 +00:00
|
|
|
bytes_per_second > 3000000
|
2022-09-24 15:12:23 +00:00
|
|
|
AND age > 180
|
|
|
|
AND p.path NOT LIKE '/Applications/%.app/Contents/%'
|
|
|
|
AND p.path NOT LIKE '/System/Library/%'
|
|
|
|
AND p.path NOT LIKE '/System/Applications/%'
|
|
|
|
AND p.path NOT LIKE '/Library/Apple/System/Library/%'
|
2022-10-30 14:19:33 +00:00
|
|
|
AND p.path NOT LIKE '/home/%/.local/share/Steam/steamapps/%'
|
2022-09-24 15:12:23 +00:00
|
|
|
AND name NOT IN (
|
2022-09-20 21:46:47 +00:00
|
|
|
'bash',
|
2022-10-19 19:26:03 +00:00
|
|
|
'bwrap',
|
2022-10-17 21:31:47 +00:00
|
|
|
'chrome',
|
2022-09-30 19:42:10 +00:00
|
|
|
'emacs',
|
2022-09-20 21:46:47 +00:00
|
|
|
'firefox',
|
|
|
|
'fish',
|
2022-10-27 14:23:15 +00:00
|
|
|
'fleet_backend',
|
|
|
|
'fsdaemon',
|
2022-09-20 21:46:47 +00:00
|
|
|
'GoogleSoftwareUpdateAgent',
|
2022-10-17 21:31:47 +00:00
|
|
|
'gopls',
|
2022-10-31 21:40:37 +00:00
|
|
|
'grype',
|
2022-10-17 21:31:47 +00:00
|
|
|
'java',
|
|
|
|
'launcher',
|
|
|
|
'LogiFacecamService',
|
2022-09-20 21:46:47 +00:00
|
|
|
'nautilus',
|
2022-10-19 19:26:03 +00:00
|
|
|
'nessusd',
|
2022-10-17 21:31:47 +00:00
|
|
|
'nix',
|
|
|
|
'osqueryd',
|
2022-10-19 19:26:03 +00:00
|
|
|
'qemu-system-aarch64',
|
2022-09-20 21:46:47 +00:00
|
|
|
'qemu-system-x86',
|
2022-10-17 21:31:47 +00:00
|
|
|
'qemu-system-x86-64',
|
2022-09-20 21:46:47 +00:00
|
|
|
'slack',
|
2022-10-30 14:19:33 +00:00
|
|
|
'steam',
|
2022-10-31 21:40:37 +00:00
|
|
|
'thunderbird',
|
2022-10-27 14:23:15 +00:00
|
|
|
'systemd',
|
2022-09-20 21:46:47 +00:00
|
|
|
'wineserver',
|
|
|
|
'ykman-gui',
|
|
|
|
'zsh'
|
2022-09-24 15:12:23 +00:00
|
|
|
)
|
2022-10-17 21:31:47 +00:00
|
|
|
AND NOT p.path IN (
|
2022-10-27 14:23:15 +00:00
|
|
|
'/usr/bin/apt',
|
2022-10-25 15:39:51 +00:00
|
|
|
'/usr/bin/darktable',
|
2022-10-17 23:01:16 +00:00
|
|
|
'/usr/bin/dockerd',
|
2022-10-17 21:31:47 +00:00
|
|
|
'/usr/bin/gnome-shell',
|
|
|
|
'/usr/bin/udevadm',
|
|
|
|
'/usr/libexec/aned',
|
2022-10-25 15:39:51 +00:00
|
|
|
'/usr/libexec/coreduetd',
|
2022-10-27 14:23:15 +00:00
|
|
|
'/usr/libexec/flatpak-system-helper',
|
2022-10-17 21:31:47 +00:00
|
|
|
'/usr/libexec/logd',
|
2022-10-27 14:23:15 +00:00
|
|
|
'/usr/libexec/logd_helper',
|
2022-10-17 21:31:47 +00:00
|
|
|
'/usr/libexec/packagekitd',
|
|
|
|
'/usr/libexec/PerfPowerServices',
|
|
|
|
'/usr/libexec/signpost_reporter',
|
|
|
|
'/usr/libexec/syspolicyd',
|
|
|
|
'/usr/lib/systemd/systemd',
|
|
|
|
'/usr/sbin/spindump',
|
|
|
|
'/usr/sbin/systemstats'
|
2022-09-24 15:12:23 +00:00
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'bindfs'
|
2022-10-18 00:37:44 +00:00
|
|
|
AND cmdline LIKE 'bindfs%-o fsname=%'
|
2022-09-24 15:12:23 +00:00
|
|
|
)
|
2022-10-12 01:53:36 +00:00
|
|
|
AND NOT (
|
|
|
|
name = 'jetbrains-toolb'
|
|
|
|
AND p.path LIKE '/tmp/.mount_jet%/jetbrains-toolbox'
|
|
|
|
)
|
2022-09-24 15:12:23 +00:00
|
|
|
AND NOT (
|
|
|
|
name = 'com.apple.MobileSoftwareUpdate.UpdateBrainService'
|
|
|
|
AND p.path LIKE '/private/var/db/com.apple.xpc.roleaccountd.staging/com.apple.MobileSoftwareUpdate.UpdateBrainService.%.xpc/Contents/MacOS/com.apple.MobileSoftwareUpdate.UpdateBrainService'
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'FindMy'
|
|
|
|
AND p.path = '/System/Applications/FindMy.app/Contents/MacOS/FindMy'
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'go'
|
|
|
|
AND cmdline LIKE 'go run %'
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'kernel_task'
|
|
|
|
AND p.path = ''
|
|
|
|
AND parent IN (0, 1)
|
|
|
|
AND on_disk = -1
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'node'
|
|
|
|
AND cwd LIKE '%/console-ui/app'
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'ruby'
|
|
|
|
AND cmdline LIKE '%brew.rb upgrade'
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'terraform-ls'
|
|
|
|
AND cmdline LIKE 'terraform-ls serve%'
|
|
|
|
)
|
2022-10-17 23:06:17 +00:00
|
|
|
AND NOT (p.path LIKE '/home/%/Apps/PhpStorm%/jbr/bin/java')
|