I noticed many brute force password attempts on my routers and servers. Also a number of port scans. After adding this to my firewall I noticed they were sweeping my whole network as well.
add chain=forward in-interface=internet protocol=tcp dst-port=21-23 tcp-flags=syn action=log log-prefix=“ssh_ftp_sync”
comment=“” disabled=no
Wandered if there was a way to stop it to an extent so I created this experimental configuration. Use it at your own risk.
First create a list of trusted IP’s. Add IP’s you trust here and your own IP pools.
/ ip firewall address-list
add list=trusted-ips address=12.0.1.0/23 comment=“” disabled=no
add list=trusted-ips address=12.0.0.0/24 comment=“” disabled=no
add list=trusted-ips address=20.0.127.0/24 comment=“” disabled=no
Now create a list of trap IP’s. These are IP’s that no one has any business connecting too but are in your IP pool. Preferably in the lower end of your IP pool. Perhaps assign one or two as an addition to your router.
/ ip firewall address-list
add list=trap-ips address=12.0.0.2 comment=“” disabled=no
Now we need to creat the firewall rules to catch the hack attempts.
/ ip firewall filter
add chain=probe protocol=tcp dst-port=20-23 src-address-list=!trusted-ips dst-address-list=trap-ips
action=add-src-to-address-list address-list=banned-ips address-list-timeout=2w comment=“” disabled=no
add chain=probe protocol=tcp dst-port=25 src-address-list=!trusted-ips dst-address-list=trap-ips
action=add-src-to-address-list address-list=banned-ips address-list-timeout=2w comment=“” disabled=no
add chain=probe protocol=tcp dst-port=135-139 src-address-list=!trusted-ips dst-address-list=trap-ips
action=add-src-to-address-list address-list=banned-ips address-list-timeout=2w comment=“” disabled=no
add chain=probe protocol=udp dst-port=135-139 src-address-list=!trusted-ips dst-address-list=trap-ips
action=add-src-to-address-list address-list=banned-ips address-list-timeout=2w comment=“” disabled=no
add chain=probe protocol=tcp dst-port=445 src-address-list=!trusted-ips dst-address-list=trap-ips
action=add-src-to-address-list address-list=banned-ips address-list-timeout=2w comment=“” disabled=no
add chain=probe protocol=tcp dst-port=1080 src-address-list=!trusted-ips dst-address-list=trap-ips
action=add-src-to-address-list address-list=banned-ips address-list-timeout=2w comment=“” disabled=no
add chain=probe protocol=tcp dst-port=3128 src-address-list=!trusted-ips dst-address-list=trap-ips
action=add-src-to-address-list address-list=banned-ips address-list-timeout=2w comment=“” disabled=no
add chain=probe protocol=tcp dst-port=8080 src-address-list=!trusted-ips dst-address-list=trap-ips
action=add-src-to-address-list address-list=banned-ips address-list-timeout=2w comment=“” disabled=no
add chain=probe src-address-list=banned-ips action=log log-prefix=“banned_ip” comment=“” disabled=no
add chain=probe src-address-list=banned-ips action=drop comment=“” disabled=no
Now create rules to jump to this new chain.
/ ip firewall filter
add chain=forward action=jump jump-target=probe comment=“Probe Check” disabled=no
add chain=input action=jump jump-target=probe comment=“Probe Check” disabled=no
Think thats it. Please don’t try this unless your familiar with firewall rules. What it does is any IP that tries to connect to say SSH on one of your trap IP’s will be added to banned-ips list for 2 weeks and all traffic will be dropped from that IP to your entire network. Usually these are open proxies being used by hackers to hack other systems or find more open proxies. Perhaps this is a bad idea but I am going to try it for a while. Anyone else that tries it might tell how it works for them.
Matt