Update standard-query-library.yml to detect Log4J (#3367)

Added query to detect Log4j in response to CVE-2021–44228 on macOS and Linux
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
This commit is contained in:
Tony Gauda 2021-12-14 17:54:11 -05:00 committed by GitHub
parent 0cc57bd294
commit 00ccdfdce8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -556,3 +556,50 @@ spec:
query: SELECT * FROM last WHERE username = "root" AND time > (( SELECT unix_time FROM time ) - 86400 );
purpose: Informational
contributors: DominusKelvin
---
apiVersion: v1
kind: query
spec:
name: Detect active processes with Log4j running
platforms: macOS, Linux
description: Returns a list of active processes and the Jar paths which are using Log4j. Version numbers are usually within the Jar filename.
query: |
WITH target_jars AS (
SELECT DISTINCT path
FROM (
WITH split(word, str) AS(
SELECT '', cmdline || ' '
FROM processes
UNION ALL
SELECT substr(str, 0, instr(str, ' ')), substr(str, instr(str, ' ') + 1)
FROM split
WHERE str != '')
SELECT word AS path
FROM split
WHERE word LIKE '%.jar'
UNION ALL
SELECT path
FROM process_open_files
WHERE path LIKE '%.jar'
)
)
SELECT path, matches
FROM yara
WHERE path IN (SELECT path FROM target_jars)
AND count > 0
AND sigrule IN (
'rule log4jJndiLookup {
strings:
$jndilookup = "JndiLookup"
condition:
$jndilookup
}',
'rule log4jJavaClass {
strings:
$javaclass = "org/apache/logging/log4j"
condition:
$javaclass
}'
);
purpose: Detection
contributors: zwass,tgauda