A DNS query is 40–60 bytes; a reply to an ANY query for a suitable domain is several kilobytes. The attacker sends
queries with the victim’s address spoofed, and an open DNS resolver floods the victim with replies. Scanners find a
router with port 53 open within hours.
/ip dns print
# servers:
# dynamic-servers: 198.51.100.53
# allow-remote-requests: yes
# cache-size: 2048KiB
allow-remote-requests=yes isn’t a mistake by itself: that’s how the router caches DNS for the home and serves its
static records (/ip dns static). The mistake is having no deny from outside. You don’t need a separate rule for
port 53 if the factory “drop all not coming from LAN” is in place. If the firewall is your own, make sure 53 over UDP
and TCP from WAN is closed explicitly:
/ip firewall filter add chain=input in-interface-list=WAN protocol=udp dst-port=53 \
action=drop comment="no DNS from outside" place-before=0
/ip firewall filter add chain=input in-interface-list=WAN protocol=tcp dst-port=53 \
action=drop comment="no DNS from outside" place-before=0
If it doesn’t work
The internet got slow, the router CPU is at 100%, and torch on ether1 shows thousands of requests to UDP 53
- Cause
- The router’s DNS answers queries from the internet: foreign addresses get replies tens of times larger than the query — the router works as an attack amplifier.
- Fix
- Put “drop all not coming from LAN” back at the end of
input(MikroTik firewall). While you sort it out:/ip dns set allow-remote-requests=no; computers then get DNS from the ISP or1.1.1.1in the DHCP settings.
How to check
From another server, outside:
dig @198.51.100.27 example.org +time=2 +tries=1
# ;; communications error to 198.51.100.27#53: timed out
# ;; no servers could be reached
A timeout is correct. If an answer with an address comes back, the DNS is open.