Package: wsdd2 Version: 1.8.7+dfsg-1.2 Severity: important Tags: security upstream fixed-upstream X-Debbugs-Cc: [email protected]
Dear Maintainer, this is a remotely triggerable crash in wsdd2, separate from #1145007 and not fixed by the two patches attached there. I reported it to the security team first; they asked me to file it publicly now. It is already fixed in the most recent upstream fork (see "Fixed upstream" below). Affected -------- - wsdd2 1.8.7+dfsg-1.2 (trixie, sid): crash reproduced with the official amd64 binary from the archive. - wsdd2 1.8.7+dfsg-1.1 (bookworm): same upstream tarball and code; not run. The crash --------- wsd.c, wsd_parse_http_header(), TCP port 3702 (WSD metadata exchange over HTTP). When the header is incomplete after the first recv(), the function moves the unparsed rest to the start of the buffer, reads more data and jumps back to "again:", but it does not reset the parse pointer p to buf. On the next pass "len -= (p - buf)" underflows and memmove() is called with a huge size on the 10000-byte buffer. With the Debian build, _FORTIFY_SOURCE turns this into "*** buffer overflow detected ***: terminated" (SIGABRT). I see no path to code execution, but the daemon is gone until restarted. Trigger: two TCP segments to port 3702, e.g. 1. "POST /<endpoint-uuid> HTTP/1.1\r\n" 2. "Content-Type: application/soap+xml\r\n" The endpoint UUID is not a secret (it is in every Hello multicast and in the XAddrs of every ProbeMatch reply). No authentication is involved. A legitimate client that happens to send its header in more than one segment crashes the daemon as well; I reproduced that with a well-formed WS-Transfer Get request split into three segments. Reproducer (Python 3, against a test instance at $IP): import socket, re, time ip = "$IP" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.settimeout(2) s.sendto(b"<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe" b"</wsa:Action><wsa:MessageID>x</wsa:MessageID>", (ip, 3702)) path = re.search(rb"<wsd:XAddrs>http://[^/]+(/[^<]+)<", s.recvfrom(65535)[0]).group(1) c = socket.create_connection((ip, 3702)) c.sendall(b"POST " + path + b" HTTP/1.1\r\n"); time.sleep(0.3) c.sendall(b"Content-Type: application/soap+xml\r\n"); time.sleep(0.5) Fixed upstream -------------- Fixed in the fork github.com/pesa1234/wsdd2, commit "Fix fragmented HTTP header buffer compaction" (2026-08-22), released in 1.9.2. That fix resets the parse pointer after the memmove, additionally guards the length underflow (returns 400 on an inconsistent header state) and caps the header size. The minimal equivalent is a one-line change: --- a/wsd.c +++ b/wsd.c @@ -955,6 +955,7 @@ memmove(buf, p, len -= (p - buf)); buf[len] = '\0'; + p = buf; if (!eoh) { /* Have not reached end of header. */ ssize_t len2 = recv(fd, buf + len, bsize - len - 1, 0); The same fork also already contains the two #1145007 fixes and a rework of the WSD TCP handling, so moving the Debian package to it would address this bug along with #1145007. Workaround until a fixed package is available: run wsdd2 with "-w" and restrict ports 3702/tcp and 3702/udp to the local network (firewall or a systemd drop-in with IPAddressAllow=), and let systemd restart the service (Restart=always). This limits exposure but does not prevent the crash from inside the LAN. Method: Debian source 1.8.7+dfsg-1.2 (checksums verified against the .dsc), built with -fsanitize=address,undefined and run as an unprivileged user; the crash was also confirmed with the unmodified binary from the wsdd2_1.8.7+dfsg-1.2_amd64.deb package. I can provide the test harness. Regards Sven

