Hello Zaffar, thank you for using Wazuh!
As Aman pointed out, you can use
CDB lists for this purpose. To do that, you have to create a list with the
IPs in the
following format:
xx:xx:xx:xx:
xx:xx:xx:xx:
xx:xx:xx:xx:...
Then you have to apply the list file to your
ossec.conf
<ossec_config>
<ruleset>
<list>etc/lists/list-IP</list>
And restart the manager.
After that, you can create rules with a negative lookup to the list to trigger if the IP is not there. You can create a child rule of the original, that will be triggered only if the IP is not in the list.
For example, if you want to use it with the rule 5710, the original rule is this:
<rule id="5710" level="5">
<if_sid>5700</if_sid>
<match>illegal user|invalid user</match>
<description>sshd: Attempt to login using a non-existent user</description>
<mitre>
<id>T1110.001</id>
<id>T1021.004</id>
<id>T1078</id>
</mitre>
<group>authentication_failed,gdpr_IV_35.7.d,gdpr_IV_32.2,gpg13_7.1,hipaa_164.312.b,invalid_login,nist_800_53_AU.14,nist_800_53_AC.7,nist_800_53_AU.6,pci_dss_10.2.4,pci_dss_10.2.5,pci_dss_10.6.1,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
</rule>
And you can create this rule:
<rule id="100001" level="7">
<if_sid>5710</if_sid>
<list field="srcip" lookup="not_address_match_key">etc/lists/list-IP</list>
<description> UNKNOWN IP - sshd: Attempt to login using a non-existent user</description>
<mitre>
<id>T1110.001</id>
<id>T1021.004</id>
<id>T1078</id>
</mitre>
<group>authentication_failed,gdpr_IV_35.7.d,gdpr_IV_32.2,gpg13_7.1,hipaa_164.312.b,invalid_login,nist_800_53_AU.14,nist_800_53_AC.7,nist_800_53_AU.6,pci_dss_10.2.4,pci_dss_10.2.5,pci_dss_10.6.1,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
</rule>
This way, you will see the
5710 rule if the IP is recognized, and the higher level
100001 rule if it is not.
I hope you find this information helpful, let me know if you have any questions.
Kind regards,