First comment:
Simply dropping all fragments is bad practice. You're more likely to break legitimate stuff with this rule than you are to protect the mikrotik from a 'sploit. (imagine a website that allows packet fragmentation, and sits beyond a low-mtu link on the Internet. You won't be able to use it)
Second comment:
If you want to do all kinds of attack signature inspection, you should set up a snort server and give it an API link to add naughty sources to a blacklist, and keep the firewall rules simple.
However, if you want to do some failure rate auto-blocking to block hosts that do port scans....
Fail2ban Behavior:
Create two IP address lists: unbannable and blacklist.
The unbannable list is a list of hosts that should never get auto-blocked.
If someone realizes you have a fail2ban like this, they could start sending spoofed packets "from" some important sites (like your DNS servers) to random ports until your rule auto-blocks the DNS servers. (Yikes!)
blacklist = obvious. Make these the very first rules in their respective filter chains:
chain=input src-address-list=blacklist action=drop
chain=output dst-address-list=blacklist action=drop
chain=forward dst-address-list=blacklist action=drop
chain=forward src-address-list=blacklist action=drop
If you decide to set up a snort server, then stop here, and set up a way for the snort server to put addresses in the blacklist. (unbannable list would do nothing in this case, so delete it)
And now the hook - after your "accept connection-state=established,related" rule in the input chain, add these rules:
action=accept in-interface=!wan
action=jump jump-target=allowed-services connection-state=new limit=10,5
action=drop connection-state=invalid limit=5,2
action=drop src-address-list=unbannable
action=add-src-to-address-list address-list=blacklist log=yes log-prefix="blacklisting new host:"
action=drop
Notice the jump rule to jump to a new chain called "allowed-services"
This should be a chain of rules that match the ports you want to open services on (if any)
The last rule of this chain should be just "drop all"
example allowed-services chain:
action=accept chain=allowed-services protocol=tcp dst-port=80,443,8080,10000-11000
action=accept chain=allowed-services protocol=tcp dst-port=25 src-address-list=spamfilters
action=accept chain=allowed-service protocol=udp dst-port=53 src-address=1.2.3.4
...
action=drop chain=allowed-services
Syn floods:
There is an option that is off by default, called syncookies - You might want to read up on that to see if it's a good option for you.
Honestly, I wouldn't go this deep into packet rules.