Hi everyone from Wazuh community,
I'm a small user of Wazuh and I would like some assistance if possible) to check if my "build" complies with a good setup to protect my servers from Log4j attacks.
I receive 20 requests a day and even with no java installed in my systems. I wish to be sure of what I've done to protect myself.
I succeed to create new rules to detect Log4j attacks using the blog article from Wazuh website (nice one) and create an active response with firewall-drop:
<group name="log4j, attack,">
<rule id="100005" level="12">
<if_group>web|accesslog|attack</if_group>
<match>${jndi:|/$%7Bjndi:</match>
<regex type="pcre2">:ldap[s]?:|:rmi:|:dns:|:nis:|:iiop:|:corba:|:nds:|:http:</regex>
<description>Log4j RCE attack attempt detected.</description>
<mitre>
<id>T1190</id>
<id>T1210</id>
<id>T1211</id>
</mitre>
</rule>
</group>
In order to improve my security, I also wish to deny access to the exfiltration IP present in log4j attacks such as:
- [Fri Jan X XX:XX:XX.XXXXXX XXXX] [proxy:error] [pid X]
[client XXX.XXX.XXX.XXX:XXXXX] AH00898: Max-Forwards request
header could not be parsed returned by /, referer: ${jndi:ldap://XXX.XXX.XXX.XXX:XXXXX/a}
I have created a set of decoders to extract the ip:
<decoder name="log4j-attack">
<prematch>jndi:ldap://\d+.\d+.\d+.\d+</prematch>
</decoder>
<decoder name="log4j-attack1">
<parent>log4j-attack</parent>
<regex>jndi:ldap://(\d+.\d+.\d+.\d+)</regex>
<order>exfiltrationip</order>
</decoder>
And added the decoder in my previous rule:
<group name="log4j, attack,">
<rule id="100005" level="12">
<if_group>web|accesslog|attack</if_group>
<match>${jndi:|/$%7Bjndi:</match>
<regex type="pcre2">:ldap[s]?:|:rmi:|:dns:|:nis:|:iiop:|:corba:|:nds:|:http:</regex>
<decoded_as>log4j-attack</decoded_as>
<description>Log4j RCE attack attempt detected.</description>
<mitre>
<id>T1190</id>
<id>T1210</id>
<id>T1211</id>
</mitre>
</rule>
</group>
I've created a new command from firewall-drop in order to use the new extracted field:
<command>
<name>firewall-drop-exfiltration-ip</name>
<executable>firewall-drop.sh</executable>
<extra_args>exfiltrationip</extra_args>
<timeout_allowed>yes</timeout_allowed>
</command>
And I've added a new AR to my existing one:
<active-response>
<command>firewall-drop-exfiltration-ip</command>
<location>local</location>
<rules_id>100005</rules_id>
<timeout>36000</timeout>
</active-response>
My question is: is it enough or I need something more powerful to prevent exfiltration?
Could someone can confirm that is a good solution or a terrible one ?
Have a nice day.
Best regards,