Add setxid-cmdline-overflow-attempt.sql

This commit is contained in:
Thomas Stromberg 2022-10-29 19:58:59 -04:00
parent 79c8136aad
commit c1b7829797
Failed to extract signature
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
-- Find setuid events with large cmdlines
--
-- platform: posix
-- interval: 60
SELECT
p.pid AS child_pid,
p.path AS child_path,
REGEX_MATCH (RTRIM(file.path, '/'), '.*/(.*?)$', 1) AS child_name,
p.cmdline AS child_cmdline,
p.auid AS child_auid,
p.euid AS child_euid,
file.mode AS child_mode,
p.parent AS parent_pid,
pp.cmdline AS parent_cmdline,
p.cmdline_size
FROM
process_events p
JOIN processes pp ON p.parent = pp.pid
LEFT JOIN file ON p.path = file.path
LEFT JOIN hash ON p.path = hash.path
LEFT JOIN file AS pfile ON pp.path = pfile.path
LEFT JOIN hash AS phash ON pp.path = phash.path
WHERE
p.time > (strftime('%s', 'now') -60)
AND file.mode NOT LIKE '0%'
AND p.cmdline_size > 1024