NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/59644: bozohttpd logs wrong port number under inetd with tls



>Number:         59644
>Category:       bin
>Synopsis:       bozohttpd logs wrong port number under inetd with tls
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 09 00:10:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, ...
>Organization:
The NetBozo Foundaport
>Environment:
>Description:
Sep  9 00:01:33 morden httpd[28064]: got request ``GET /pub/pkgsrc/current/pkgsrc/x11/xpmicons/index.html HTTP/1.1'' from host 157.52.96.54 to port 443

This was almost certainly actually sent over port 4433.

But:

    370 	if (!httpd->bindport)
    371 		httpd->bindport = bozostrdup(httpd, NULL, BOZO_HTTPS_PORT);

https://nxr.netbsd.org/xref/src/libexec/httpd/ssl-bozo.c?r=1.34#370

    672 	port = NULL;
    673 	if (httpd->bindport) {
    674 		if (strcmp(httpd->bindport, BOZO_HTTP_PORT) != 0)
    675 			port = httpd->bindport;
    676 	} else if (getsockname(0, (struct sockaddr *)(void *)&ss, &slen) == 0 &&
    677 		   getnameinfo((struct sockaddr *)(void *)&ss, slen, NULL, 0,
    678 			       bufport, sizeof bufport, NI_NUMERICSERV) == 0)
    679 		port = bufport;
    680 	if (port != NULL)
    681 		request->hr_serverport = bozostrdup(httpd, request, port);
...
    740 			bozowarn(httpd,
    741 				  "got request ``%s'' from host %s to port %s",
    742 				  str,
    743 				  host ? host : addr ? addr : "<local>",
    744 				  port ? port : "<stdin>");

https://nxr.netbsd.org/xref/src/libexec/httpd/bozohttpd.c?r=1.149#672

Under inetd, bindport never gets set for actual binding, but ssl-bozo.c sets bindport=443 (BOZO_HTTPS_PORT), so this bypasses the getpeername branch.
>How-To-Repeat:
run httpd with tls under inetd
>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index