Hi,
Based on your requirement, I have made a small update to your rule 111745, and I have tested it from my end. It is working fine for me. I have attached a screenshot of my testing for your reference.
<group name="firewall,fortianalyzer,syslog,">
<rule id="111700" level="4">
<decoded_as>fortianalyzer</decoded_as>
<description>Fortianalyzer: Messages grouped.</description>
</rule>
<rule id="111710" level="3">
<if_sid>111700</if_sid>
<field name="event_category">^traffic$</field>
<description>Fortianalyzer: Traffic logs.</description>
</rule>
<rule id="111742" level="4">
<if_sid>111710</if_sid>
<list field="srcip" lookup="address_match_key">etc/lists/private-ip</list>
<list field="dstip" lookup="address_match_key">etc/lists/private-ip</list>
<description>Fortianalyzer: Internal traffic.</description>
</rule>
<rule id="111745" level="14" frequency="5" timeframe="300">
<if_matched_sid>111742</if_matched_sid>
<same_srcip/>
<same_dstport/>
<different_dstip/>
<dstport negate="yes" type="osregex">^53$|^123$</dstport>
<description>Fortianalyzer: LAN2LAN horizontal scanning detected from a single host to multiple destinations.</description>
</rule>
</group>
Changes I made:
In your custom rule
111745, you had used regex in the
<dstport> tag but did not add the option
type="osregex". When using regex in the <dstport> tag, you need to specify the type in that tag. You can refer to the
Wazuh rule syntax documentation for this.
The sample log I used for testing:
Jan 09 10:09:43 AA-FIU1-FGTFW CEF:0|Fortinet|FortiGate-60F|7.4.4,build2662 (GA)|0000000013|forward traffic server-rst|5|start=Jan 09 2025 10:09:43 logver=704042662 deviceExternalId=FGT60FAJZ dvchost=AA-FIU1-FGTFW vd=root eventtime=1736402984774088220 tz=+0400 logid=0000000013 cat=traffic subtype=forward deviceSeverity=notice src=10.6.128.117 spt=433 deviceInboundInterface=HHHH srcintfrole=undefined dst=10.6.1.101 dpt=389 deviceOutboundInterface=KKK dstintfrole=undefined replysrcintf=MMMMMM srccountry=Reserved dstcountry=Reserved externalID=14115 proto=6 act=server-rst policyid=1 policytype=policy poluuid=92017e-51ef-8b1e-1fae8e136399 policyname=KKK to JDDJ duser=AAAAA.BBBB authserver=ASASASA app=LDAP trandisp=noop duration=5 out=2545 in=677 sentpkt=7 rcvdpkt=5 vpntype=ipsecvpn vwlid=1 vwlquality=ASASHBDN alive selected vwlname=DDDDDDD appcat=unscanned tz="+0400"
Jan 09 10:09:43 AA-FIU1-FGTFW CEF:0|Fortinet|FortiGate-60F|7.4.4,build2662 (GA)|0000000013|forward traffic server-rst|5|start=Jan 09 2025 10:09:43 logver=704042662 deviceExternalId=FGT60FAJZ dvchost=AA-FIU1-FGTFW vd=root eventtime=1736402984774088220 tz=+0400 logid=0000000013 cat=traffic subtype=forward deviceSeverity=notice src=10.6.128.117 spt=433 deviceInboundInterface=HHHH srcintfrole=undefined dst=10.6.1.102 dpt=389 deviceOutboundInterface=KKK dstintfrole=undefined replysrcintf=MMMMMM srccountry=Reserved dstcountry=Reserved externalID=14115 proto=6 act=server-rst policyid=1 policytype=policy poluuid=92017e-51ef-8b1e-1fae8e136399 policyname=KKK to JDDJ duser=AAAAA.BBBB authserver=ASASASA app=LDAP trandisp=noop duration=5 out=2545 in=677 sentpkt=7 rcvdpkt=5 vpntype=ipsecvpn vwlid=1 vwlquality=ASASHBDN alive selected vwlname=DDDDDDD appcat=unscanned tz="+0400"
Jan 09 10:09:43 AA-FIU1-FGTFW CEF:0|Fortinet|FortiGate-60F|7.4.4,build2662 (GA)|0000000013|forward traffic server-rst|5|start=Jan 09 2025 10:09:43 logver=704042662 deviceExternalId=FGT60FAJZ dvchost=AA-FIU1-FGTFW vd=root eventtime=1736402984774088220 tz=+0400 logid=0000000013 cat=traffic subtype=forward deviceSeverity=notice src=10.6.128.117 spt=433 deviceInboundInterface=HHHH srcintfrole=undefined dst=10.6.1.103 dpt=389 deviceOutboundInterface=KKK dstintfrole=undefined replysrcintf=MMMMMM srccountry=Reserved dstcountry=Reserved externalID=14115 proto=6 act=server-rst policyid=1 policytype=policy poluuid=92017e-51ef-8b1e-1fae8e136399 policyname=KKK to JDDJ duser=AAAAA.BBBB authserver=ASASASA app=LDAP trandisp=noop duration=5 out=2545 in=677 sentpkt=7 rcvdpkt=5 vpntype=ipsecvpn vwlid=1 vwlquality=ASASHBDN alive selected vwlname=DDDDDDD appcat=unscanned tz="+0400"
Jan 09 10:09:43 AA-FIU1-FGTFW CEF:0|Fortinet|FortiGate-60F|7.4.4,build2662 (GA)|0000000013|forward traffic server-rst|5|start=Jan 09 2025 10:09:43 logver=704042662 deviceExternalId=FGT60FAJZ dvchost=AA-FIU1-FGTFW vd=root eventtime=1736402984774088220 tz=+0400 logid=0000000013 cat=traffic subtype=forward deviceSeverity=notice src=10.6.128.117 spt=433 deviceInboundInterface=HHHH srcintfrole=undefined dst=10.6.1.104 dpt=389 deviceOutboundInterface=KKK dstintfrole=undefined replysrcintf=MMMMMM srccountry=Reserved dstcountry=Reserved externalID=14115 proto=6 act=server-rst policyid=1 policytype=policy poluuid=92017e-51ef-8b1e-1fae8e136399 policyname=KKK to JDDJ duser=AAAAA.BBBB authserver=ASASASA app=LDAP trandisp=noop duration=5 out=2545 in=677 sentpkt=7 rcvdpkt=5 vpntype=ipsecvpn vwlid=1 vwlquality=ASASHBDN alive selected vwlname=DDDDDDD appcat=unscanned tz="+0400"
Jan 09 10:09:43 AA-FIU1-FGTFW CEF:0|Fortinet|FortiGate-60F|7.4.4,build2662 (GA)|0000000013|forward traffic server-rst|5|start=Jan 09 2025 10:09:43 logver=704042662 deviceExternalId=FGT60FAJZ dvchost=AA-FIU1-FGTFW vd=root eventtime=1736402984774088220 tz=+0400 logid=0000000013 cat=traffic subtype=forward deviceSeverity=notice src=10.6.128.117 spt=433 deviceInboundInterface=HHHH srcintfrole=undefined dst=10.6.1.105 dpt=389 deviceOutboundInterface=KKK dstintfrole=undefined replysrcintf=MMMMMM srccountry=Reserved dstcountry=Reserved externalID=14115 proto=6 act=server-rst policyid=1 policytype=policy poluuid=92017e-51ef-8b1e-1fae8e136399 policyname=KKK to JDDJ duser=AAAAA.BBBB authserver=ASASASA app=LDAP trandisp=noop duration=5 out=2545 in=677 sentpkt=7 rcvdpkt=5 vpntype=ipsecvpn vwlid=1 vwlquality=ASASHBDN alive selected vwlname=DDDDDDD appcat=unscanned tz="+0400"
Each log has a different dstIP such as: 10.6.1.101, 10.6.1.102, 10.6.1.103, 10.6.1.104, 10.6.1.105
I have created a CDB list called private-ip and added the above IPs along with the srcip from the logs to trigger rule ID 111742.
Here is the screenshot of my testing: