Hi Julian,
Sorry for the late response, been busy with exams. Firstly, I only run the logtest from the UI because I cannot paste strings from external source into the manager's CLI.
This is the full log that triggered the Log4j rule:
This is the output of the logtest of the log above:
**Phase 2: Completed decoding.
name: 'web-accesslog'
id: '404'
protocol: 'GET'
srcip: '192.168.36.1'
url: '/favicon.ico'
**Phase 3: Completed filtering (rules).
id: '110003'
level: '12'
description: 'Log4j RCE attack attempt detected.'
groups: '["log4j"," attack"]'
firedtimes: '1'
mail: 'true'
mitre.id: '["T1190","T1210","T1211"]'
mitre.tactic: '["Initial Access","Lateral Movement","Defense Evasion"]'
mitre.technique: '["Exploit Public-Facing Application","Exploitation of Remote Services","Exploitation for Defense Evasion"]'
**Alert to be generated.
This is the decoder in 0375-web-accesslog_decoders.xml that matched with the log:
<decoder name="web-accesslog">
<type>web-log</type>
<program_name>nginx|apache</program_name>
</decoder>
<decoder name="web-accesslog">
<type>web-log</type>
<prematch>^\S+ \S+ \S+ \.*[\S+ \S\d+] "\w+ \S+ HTTP\S+" </prematch>
</decoder>
<decoder name="web-accesslog-domain">
<type>web-log</type>
<parent>web-accesslog</parent>
<prematch>^\S+.\D+</prematch>
<regex>^\S+ (\S+) \S+ \.*[\S+ \S\d+] "(\w+) (\S+) HTTP\S+" (\d+) </regex>
<order>srcip, protocol, url, id</order>
</decoder>
<decoder name="web-accesslog-ip-ip">
<type>web-log</type>
<parent>web-accesslog</parent>
<prematch>^\S+ \S+.\S+ |^\S+ \S+:\S+ </prematch>
<regex>^(\S+) (\S+) \S+ \.*[\S+ \S\d+] "(\w+) (\S+) HTTP\S+" (\d+) </regex>
<order>srcip2, srcip, protocol, url, id</order>
</decoder>
<decoder name="web-accesslog-ip">
<type>web-log</type>
<parent>web-accesslog</parent>
<regex>^(\S+) \S+ \S+ \.*[\S+ \S\d+] "(\w+) (\S+) HTTP\S+" (\d+) </regex>
<order>srcip, protocol, url, id</order>
</decoder>
<decoder name="web-accesslog-glpi">
<type>web-log</type>
<parent>web-accesslog</parent>
<prematch>^\S+ - - [\d+/\w+/\d+:\d+:\d+:\d+ +\d+] "\S+ \S+ HTTP/\.+"</prematch>
<regex>^(\S+) - - [(\d+/\w+/\d+:\d+:\d+:\d+) +\d+] "(\S+) (\S+) HTTP/(\.+)" (\d+) (\S+) "(\.+)" "(\.+)"</regex>
<order>srcip,timestamp,operation, route, http_version, rcode, rsize, url, browser</order>
</decoder>
Meanwhile, the full log below is a log4j exploit which is successful because remote code execution was carried out but the rule was not triggered:
This is the full log that did not trigger the rule:
This is the output of the logtest of the log above:
**Messages:
WARNING: (7003): '507fa2da' token expires
INFO: (7202): Session initialized with token '2da14981'
**Phase 2: Completed decoding.
name: 'docker_log_decoder'
date: '2022-12-18'
srcip: '192.168.36.129'
time: '09:54:00'
This is the decoder written in local_decoder.xml that matched with the full log but did not trigger the rule:
<decoder name="docker_log_decoder">
<program_name>^docker</program_name>
</decoder>
<decoder name="docker_log_decoder_2">
<parent>docker_log_decoder</parent>
<regex offset="after_parent">(\d*.\d*.\d*.\d*)</regex>
<order>srcip</order>
</decoder>
<decoder name="docker_log_decoder_2">
<parent>docker_log_decoder</parent>
<regex offset="after_parent">(\d+-\w+-\d+)</regex>
<order>date</order>
</decoder>
<decoder name="docker_log_decoder_2">
<parent>docker_log_decoder</parent>
<regex offset="after_parent">(\d*:\d*:\d*)</regex>
<order>time</order>
</decoder>
<decoder name="docker_log_decoder_2">
<parent>docker_log_decoder</parent>
<regex offset="after_parent">("\w*\s/\s\w*/\d.\d"\s\d*)</regex>
<order>web_action</order>
</decoder>
This is the rule written in local_rules.xml that triggered the exploit on webserver but not on the docker container:
<group name="log4j, attack,">
<rule id="110002" level="7">
<if_group>web|accesslog|attack</if_group>
<regex type="pcre2">(?i)(((\$|24)\S*)((\{|7B)\S*)((\S*j\S*n\S*d\S*i))|JHtqbmRp)</regex>
<description>Possible Log4j RCE attack attempt detected.</description>
<mitre>
<id>T1190</id>
<id>T1210</id>
<id>T1211</id>
</mitre>
</rule>
<rule id="110003" level="12">
<if_sid>110002</if_sid>
<regex type="pcre2">ldap[s]?|rmi|dns|nis|iiop|corba|nds|http|lower|upper|(\$\{\S*\w\}\S*)+</regex>
<description>Log4j RCE attack attempt detected.</description>
<mitre>
<id>T1190</id>
<id>T1210</id>
<id>T1211</id>
</mitre>
</rule>
</group>
Regards,