2022-10-19 20:56:43 +00:00
|
|
|
-- Programs which are writing an unusually large amount of data
|
|
|
|
--
|
|
|
|
-- Can be used to detect ransomware
|
|
|
|
--
|
|
|
|
-- false positives:
|
|
|
|
-- * Package managers
|
|
|
|
-- * Backup software
|
|
|
|
--
|
|
|
|
-- references:
|
|
|
|
-- * https://attack.mitre.org/tactics/TA0009/ (Collection)
|
|
|
|
--
|
|
|
|
-- tags: transient process
|
|
|
|
SELECT
|
|
|
|
p.name,
|
2022-11-22 14:21:03 +00:00
|
|
|
p.cgroup_path,
|
2022-10-19 20:56:43 +00:00
|
|
|
p.path,
|
|
|
|
p.pid,
|
|
|
|
p.cmdline,
|
|
|
|
p.on_disk,
|
|
|
|
p.parent,
|
|
|
|
p.start_time,
|
|
|
|
hash.sha256,
|
|
|
|
p.disk_bytes_written,
|
|
|
|
p.cwd,
|
|
|
|
(strftime('%s', 'now') - start_time) AS age,
|
|
|
|
disk_bytes_written / (strftime('%s', 'now') - start_time) AS bytes_per_second
|
|
|
|
FROM
|
|
|
|
processes p
|
|
|
|
LEFT JOIN hash ON p.path = hash.path
|
|
|
|
WHERE
|
2023-01-18 14:49:56 +00:00
|
|
|
bytes_per_second > 6500000
|
|
|
|
AND age > 30
|
2022-10-19 20:56:43 +00:00
|
|
|
AND pid > 2
|
|
|
|
AND p.path NOT IN (
|
|
|
|
'/bin/bash',
|
2022-11-22 14:21:03 +00:00
|
|
|
'/bin-busybox',
|
2022-10-19 20:56:43 +00:00
|
|
|
'/opt/homebrew/bin/qemu-system-aarch64',
|
2022-10-27 14:23:15 +00:00
|
|
|
'/usr/bin/apt',
|
2022-10-19 20:56:43 +00:00
|
|
|
'/usr/bin/aptd',
|
2023-01-04 16:03:38 +00:00
|
|
|
'/usr/bin/pacman',
|
2023-01-18 14:49:56 +00:00
|
|
|
'/usr/bin/git',
|
2022-10-19 20:56:43 +00:00
|
|
|
'/usr/bin/bash',
|
2022-12-15 21:51:58 +00:00
|
|
|
'/usr/lib/baloo_file_extractor',
|
2022-10-19 20:56:43 +00:00
|
|
|
'/usr/bin/bwrap',
|
|
|
|
'/usr/bin/curl',
|
2022-10-25 15:39:51 +00:00
|
|
|
'/usr/bin/darktable',
|
2022-10-19 20:56:43 +00:00
|
|
|
'/usr/bin/dockerd',
|
|
|
|
'/usr/bin/fish',
|
|
|
|
'/usr/bin/gnome-shell',
|
2022-10-27 14:23:15 +00:00
|
|
|
'/usr/bin/gnome-software',
|
2022-10-19 20:56:43 +00:00
|
|
|
'/usr/bin/make',
|
|
|
|
'/usr/bin/melange',
|
|
|
|
'/usr/bin/qemu-system-x86_64',
|
|
|
|
'/usr/bin/yay',
|
|
|
|
'/usr/bin/zsh',
|
|
|
|
'/usr/lib64/thunderbird/thunderbird',
|
|
|
|
'/usr/libexec/coreduetd',
|
2022-11-04 12:08:26 +00:00
|
|
|
'/usr/share/spotify-client/spotify',
|
2022-12-15 21:51:58 +00:00
|
|
|
'/Library/Application Support/Adobe/Adobe Desktop Common/HDBox/Setup',
|
2022-10-20 17:16:33 +00:00
|
|
|
'/usr/libexec/flatpak-system-helper',
|
2022-10-28 23:24:00 +00:00
|
|
|
'/usr/libexec/logd_helper',
|
2022-10-19 20:56:43 +00:00
|
|
|
'/usr/libexec/packagekitd',
|
|
|
|
'/usr/libexec/rosetta/oahd',
|
|
|
|
'/usr/libexec/secd',
|
|
|
|
'/usr/libexec/sharingd',
|
|
|
|
'/usr/lib/flatpak-system-helper',
|
|
|
|
'/usr/lib/systemd/systemd',
|
|
|
|
'/usr/lib/systemd/systemd-journald',
|
|
|
|
'/usr/sbin/screencapture'
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name LIKE 'jbd%/dm-%'
|
|
|
|
AND on_disk = -1
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'bindfs'
|
|
|
|
AND cmdline LIKE 'bindfs -f -o fsname=%'
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'btrfs-transaction'
|
|
|
|
AND on_disk = -1
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'kernel_task'
|
|
|
|
AND p.path = ''
|
|
|
|
AND parent IN (0, 1)
|
|
|
|
AND on_disk = -1
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'launchd'
|
|
|
|
AND p.path = '/sbin/launchd'
|
|
|
|
AND parent = 0
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'logd'
|
|
|
|
AND cmdline = '/usr/libexec/logd'
|
|
|
|
AND parent = 1
|
|
|
|
)
|
|
|
|
AND NOT (
|
|
|
|
name = 'aptd'
|
|
|
|
AND cmdline = '/usr/bin/python3 /usr/sbin/aptd'
|
|
|
|
)
|
|
|
|
AND NOT name IN (
|
2022-12-15 21:51:58 +00:00
|
|
|
'baloo_file_extr',
|
|
|
|
'bwrap',
|
|
|
|
'cargo',
|
2022-10-19 20:56:43 +00:00
|
|
|
'chrome',
|
|
|
|
'com.apple.MobileSoftwareUpdate.UpdateBrainService',
|
2022-11-08 19:32:38 +00:00
|
|
|
'com.apple.NRD.UpdateBrainService',
|
2022-10-19 20:56:43 +00:00
|
|
|
'containerd',
|
2023-01-09 20:10:48 +00:00
|
|
|
'containerd-',
|
|
|
|
'containerd-shim',
|
2023-01-20 22:55:48 +00:00
|
|
|
'Cisco WebEx Start',
|
2022-11-01 11:15:10 +00:00
|
|
|
'darkfiles',
|
2023-01-09 20:10:48 +00:00
|
|
|
'dnf',
|
2022-12-15 21:51:58 +00:00
|
|
|
'esbuild',
|
2022-10-19 20:56:43 +00:00
|
|
|
'firefox',
|
2022-10-27 14:23:15 +00:00
|
|
|
'fsdaemon',
|
2023-01-18 14:49:56 +00:00
|
|
|
'docker-index',
|
2022-10-19 20:56:43 +00:00
|
|
|
'go',
|
|
|
|
'goland',
|
2023-01-13 19:10:43 +00:00
|
|
|
'node',
|
2022-12-15 21:51:58 +00:00
|
|
|
'golangci-lint-v',
|
2022-10-19 20:56:43 +00:00
|
|
|
'gopls',
|
2022-10-27 14:23:15 +00:00
|
|
|
'grype',
|
|
|
|
'java',
|
2022-10-19 20:56:43 +00:00
|
|
|
'jetbrains-toolb',
|
2022-10-27 14:23:15 +00:00
|
|
|
'launcher',
|
2023-01-06 15:18:19 +00:00
|
|
|
'limactl',
|
2023-01-09 20:10:48 +00:00
|
|
|
'nessusd',
|
2022-12-15 21:51:58 +00:00
|
|
|
'ninja',
|
2022-12-19 23:06:06 +00:00
|
|
|
'photorec',
|
2022-12-15 21:51:58 +00:00
|
|
|
'qemu-system-aarch64',
|
2023-01-14 13:19:26 +00:00
|
|
|
'qemu-system-x86_64',
|
2022-10-19 20:56:43 +00:00
|
|
|
'slack',
|
2022-12-15 21:51:58 +00:00
|
|
|
'snyk',
|
2022-10-30 14:19:33 +00:00
|
|
|
'steam',
|
2023-01-09 20:10:48 +00:00
|
|
|
'syft',
|
2022-10-19 20:56:43 +00:00
|
|
|
'wineserver'
|
|
|
|
)
|
|
|
|
AND p.path NOT LIKE '/Applications/%.app/Contents/%'
|
|
|
|
AND p.path NOT LIKE '/home/%/.local/share/Steam'
|
|
|
|
AND p.path NOT LIKE '/nix/store/%/bin/%sh'
|
|
|
|
AND p.path NOT LIKE '/nix/store/%/bin/nix'
|
|
|
|
AND p.path NOT LIKE '/System/Applications/%'
|
|
|
|
AND p.path NOT LIKE '/System/Library/%'
|
|
|
|
AND p.path NOT LIKE '/usr/local/kolide-k2/bin/osqueryd-updates/%/osqueryd'
|
|
|
|
AND p.path NOT LIKE '/nix/store/%kolide-launcher-%/bin/launcher'
|
2023-01-19 16:52:31 +00:00
|
|
|
AND NOT cmdline LIKE '%/lib/gcloud.py components update'
|
2023-01-06 15:36:48 +00:00
|
|
|
AND NOT cgroup_path LIKE '/system.slice/docker-%'
|