What is multicast DNS (mDNS) ?
The mDNS protocol is meant to resolve host names to IP addresses within small networks that do not include a local name server. The mDNS service can be contacted using UDP queries over port 5353.
The mDNS protocol is published as RFC6762 and implemented by the Apple Bonjour and avahi-daemon services.
If your mDNS service is exposed to the Internet, querying the service would allows hackers to collect information about your server (such as the MAC address information of the device, or services running on the machine) that could be used to prepare an attack.
Also, since mDNS is based on UDP, the mDNS query can be exploited to perform amplification attacks (the attacker can spoof his target IP address to saturate it with mDNS replies from your server):
How to verify if your server is vulnerable?
Use the following command from a remote machine, as root, to query the mDNS service:
# nmap -Pn -sU -p5353 --script=dns-service-discovery <Your-server-IP>
PORT STATE SERVICE
5353/udp open zeroconf
| 9/tcp workstation
| 22/tcp udisks-ssh
If the command returns a time-out, the service might already be filtered.
Multicast DNS is designed for use within a local network. This means that usually it is not a good idea to expose this service directly to the Internet or, in general, to an environment where untrusted clients can directly access this service.
Different options are available to mitigate this issue and protect your server:
- Disable mDNS (Apple Bonjour or avahi-daemon) service if you are not using it. Is the easiest and the most effective solution.
- Configure your firewall to filter inbound connections to your server UDP/5353, and only allow the trusted network IPs/hosts that need to contact your mDNS service to access it.