NetBSD Problem Report #60878
From riastradh@netbsd.org Wed Oct 14 18:45:56 2026
Return-Path: <riastradh@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 9E35E1A923B
for <gnats-bugs@gnats.NetBSD.org>; Wed, 14 Oct 2026 18:45:56 +0000 (UTC)
Message-Id: <20261014184556.5A16984D58@mail.netbsd.org>
Date: Wed, 14 Oct 2026 18:45:56 +0000 (UTC)
From: Taylor R Campbell <riastradh@NetBSD.org>
Reply-To: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org
Subject: libfetch: missing peer hostname check
X-Send-Pr-Version: 3.95
X-From4GNATS: "Taylor R Campbell via gnats" <gnats-admin@NetBSD.org>
>Number: 60878
>Notify-List: pkgsrc-releng@NetBSD.org, pkgsrc-security@NetBSD.org, releng@NetBSD.org, security-team@NetBSD.org
>Category: lib
>Synopsis: libfetch: missing peer hostname check
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: riastradh@NetBSD.org
>State: pending-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 14 18:50:00 +0000 2026
>Closed-Date:
>Last-Modified: Tue Oct 20 20:04:45 +0000 2026
>Originator: Taylor R Campbell
>Release: current, 11, 10
>Organization:
The NameBSD Verification
>Environment:
>Description:
When I taught libfetch to check peer certificates for HTTPS
URLs a few years ago, I neglected to add the part where it also
checks whether any of the certificate's hostnames matches the
URL's hostname.
Noticed by Richard Yao.
>How-To-Repeat:
$ pkg_add https://wrong.host.badssl.com/test-1.2.tar.gz
pkg_add: no pkg found for 'https://wrong.host.badssl.com/test-1.2.tar.gz', sorry.
pkg_add: 1 package addition failed
>Fix:
SSL_set1_host(conn->ssl, URL->host);
>Release-Note:
>Audit-Trail:
From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: pkgsrc-releng@NetBSD.org, pkgsrc-security@NetBSD.org,
releng@NetBSD.org, security-team@NetBSD.org
Subject: Re: lib/60878: libfetch: missing peer hostname check
Date: Wed, 14 Oct 2026 19:09:37 +0000
This is a multi-part message in MIME format.
--=_rFLsIlDMAmZS54PhaM3eE2ii5a8qA3Zz
> Date: Wed, 14 Oct 2026 18:50:00 +0000 (UTC)
> From: gnats-admin@netbsd.org
>
> >Category: lib
> >Responsible: lib-bug-people
> >Synopsis: libfetch: missing peer hostname check
> >Arrival-Date: Wed Oct 14 18:50:00 +0000 2026
One-liner for base attached.
--=_rFLsIlDMAmZS54PhaM3eE2ii5a8qA3Zz
Content-Type: text/plain; charset="ISO-8859-1"; name="pr60878-libfetchpeerhostnamecheck-base"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="pr60878-libfetchpeerhostnamecheck-base.patch"
# HG changeset patch
# User Taylor R Campbell <riastradh@NetBSD.org>
# Date 1791993054 0
# Wed Oct 14 15:50:54 2026 +0000
# Branch trunk
# Node ID f31a70ee5f0841357ccbe8c4c96b6bc4f4e57216
# Parent 8fabf8640a9ac16011ccfe817764973287f81e77
# EXP-Topic riastradh-pr60878-libfetchpeerhostnamecheck
libfetch: Fix missing SSL_set1_host call.
PR lib/60878: libfetch: missing SSL_set1_host call
diff -r 8fabf8640a9a -r f31a70ee5f08 external/bsd/fetch/dist/libfetch/commo=
n.c
--- a/external/bsd/fetch/dist/libfetch/common.c Thu Oct 08 00:06:04 2026 +0=
000
+++ b/external/bsd/fetch/dist/libfetch/common.c Wed Oct 14 15:50:54 2026 +0=
000
@@ -473,6 +473,7 @@ fetch_ssl(conn_t *conn, const struct url
}
conn->buf_events =3D 0;
SSL_set_fd(conn->ssl, conn->sd);
+ SSL_set1_host(conn->ssl, URL->host);
#if OPENSSL_VERSION_NUMBER >=3D 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
if (!SSL_set_tlsext_host_name(conn->ssl, (char *)(uintptr_t)URL->host)) {
fprintf(stderr,
--=_rFLsIlDMAmZS54PhaM3eE2ii5a8qA3Zz--
From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: pkgsrc-releng@NetBSD.org, pkgsrc-security@NetBSD.org,
releng@NetBSD.org, security-team@NetBSD.org
Subject: Re: lib/60878: libfetch: missing peer hostname check
Date: Wed, 14 Oct 2026 19:11:12 +0000
This is a multi-part message in MIME format.
--=_3LM3Qr5snjR6jwWdKR2eeC80vJ4rOpBA
Content-Transfer-Encoding: quoted-printable
> Date: Wed, 14 Oct 2026 18:50:00 +0000 (UTC)
> From: gnats-admin@netbsd.org
>=20
> >Category: lib
> >Responsible: lib-bug-people
> >Synopsis: libfetch: missing peer hostname check
> >Arrival-Date: Wed Oct 14 18:50:00 +0000 2026
One-liner (plus revbump) fix for pkgsrc attached.
Test case:
$ pkg_add https://wrong.host.badssl.com/test-1.2.tar.gz
0048AA63C37B0000:error:0A000086:SSL routines:tls_post_process_server_certif=
icate:certificate verify failed:/home/riastradh/netbsd/current/src/crypto/e=
xternal/apache2/openssl/dist/ssl/statem/statem_clnt.c:2124:
0048AA63C37B0000:error:0A000086:SSL routines:tls_post_process_server_certif=
icate:certificate verify failed:/home/riastradh/netbsd/current/src/crypto/e=
xternal/apache2/openssl/dist/ssl/statem/statem_clnt.c:2124:
pkg_add: Can't process https://wrong.host.badssl.com:443//test-1*: Authenti=
cation error
pkg_add: no pkg found for 'https://wrong.host.badssl.com/test-1.2.tar.gz', =
sorry.
pkg_add: 1 package addition failed
If you don't have the `certificate verify failed' lines, you're
vulnerable.
--=_3LM3Qr5snjR6jwWdKR2eeC80vJ4rOpBA
Content-Type: text/plain; charset="ISO-8859-1"; name="pr60878-libfetchpeerhostnamecheck-pkgsrc"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="pr60878-libfetchpeerhostnamecheck-pkgsrc.patch"
>From 01757bbb38934cb5ed5145160f6d6084133c6992 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastradh@NetBSD.org>
Date: Wed, 14 Oct 2026 15:48:13 +0000
Subject: [PATCH] libfetch: Fix missing SSL_set1_host call.
PR lib/60878: libfetch: missing peer hostname check
---
net/libfetch/Makefile | 2 +-
net/libfetch/files/common.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/libfetch/Makefile b/net/libfetch/Makefile
index 67590b1c5499..96083127e1d7 100644
--- a/net/libfetch/Makefile
+++ b/net/libfetch/Makefile
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.70 2026/04/16 10:16:29 wiz Exp $
=20
DISTNAME=3D libfetch-2.40
-PKGREVISION=3D 5
+PKGREVISION=3D 6
CATEGORIES=3D net
MASTER_SITES=3D # empty
DISTFILES=3D # empty
diff --git a/net/libfetch/files/common.c b/net/libfetch/files/common.c
index c583873d60dd..a77eb3738137 100644
--- a/net/libfetch/files/common.c
+++ b/net/libfetch/files/common.c
@@ -473,6 +473,7 @@ fetch_ssl(conn_t *conn, const struct url *URL, int verb=
ose)
}
conn->buf_events =3D 0;
SSL_set_fd(conn->ssl, conn->sd);
+ SSL_set1_host(conn->ssl, URL->host);
#if OPENSSL_VERSION_NUMBER >=3D 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
if (!SSL_set_tlsext_host_name(conn->ssl, (char *)(uintptr_t)URL->host)) {
fprintf(stderr,
--=_3LM3Qr5snjR6jwWdKR2eeC80vJ4rOpBA--
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 20 Oct 2026 17:44:14 +0000
State-Changed-Why:
fixed in HEAD, src and pkgsrc alike
needs pullup-11, pullup-10, pullup-pkgsrc
Responsible-Changed-From-To: lib-bug-people->riastradh@NetBSD.org
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Tue, 20 Oct 2026 17:46:03 +0000
Responsible-Changed-Why:
fixed in HEAD, in src and pkgsrc
needs pullup-11, pullup-10, pullup-pkgsrc
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60878 CVS commit: src/external/bsd/fetch/dist/libfetch
Date: Tue, 20 Oct 2026 17:43:41 +0000
Module Name: src
Committed By: riastradh
Date: Tue Oct 20 17:43:40 UTC 2026
Modified Files:
src/external/bsd/fetch/dist/libfetch: common.c
Log Message:
libfetch: Fix missing SSL_set1_host call.
PR lib/60878: libfetch: missing SSL_set1_host call
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/fetch/dist/libfetch/common.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60878 CVS commit: pkgsrc/net/libfetch
Date: Tue, 20 Oct 2026 17:43:31 +0000
Module Name: pkgsrc
Committed By: riastradh
Date: Tue Oct 20 17:43:31 UTC 2026
Modified Files:
pkgsrc/net/libfetch: Makefile
pkgsrc/net/libfetch/files: common.c
Log Message:
libfetch: Fix missing SSL_set1_host call.
PR lib/60878: libfetch: missing peer hostname check
To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 pkgsrc/net/libfetch/Makefile
cvs rdiff -u -r1.38 -r1.39 pkgsrc/net/libfetch/files/common.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 20 Oct 2026 18:08:29 +0000
State-Changed-Why:
pullup-11 #536
pullup-10 #1382
pullup-pkgsrc #7299
From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60878 CVS commit: [pkgsrc-2026Q3] pkgsrc/net/libfetch
Date: Tue, 20 Oct 2026 18:13:48 +0000
Module Name: pkgsrc
Committed By: maya
Date: Tue Oct 20 18:13:48 UTC 2026
Modified Files:
pkgsrc/net/libfetch [pkgsrc-2026Q3]: Makefile
pkgsrc/net/libfetch/files [pkgsrc-2026Q3]: common.c
Log Message:
Pullup ticket #7299 - requested by riastradh
net/libfetch: Security fix
Revisions pulled up:
- net/libfetch/Makefile 1.71
- net/libfetch/files/common.c 1.39
---
Module Name: pkgsrc
Committed By: riastradh
Date: Tue Oct 20 17:43:31 UTC 2026
Modified Files:
pkgsrc/net/libfetch: Makefile
pkgsrc/net/libfetch/files: common.c
Log Message:
libfetch: Fix missing SSL_set1_host call.
PR lib/60878: libfetch: missing peer hostname check
To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.70.4.1 pkgsrc/net/libfetch/Makefile
cvs rdiff -u -r1.38 -r1.38.4.1 pkgsrc/net/libfetch/files/common.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60878 CVS commit: [netbsd-11] src/external/bsd/fetch/dist/libfetch
Date: Tue, 20 Oct 2026 19:14:08 +0000
Module Name: src
Committed By: martin
Date: Tue Oct 20 19:14:08 UTC 2026
Modified Files:
src/external/bsd/fetch/dist/libfetch [netbsd-11]: common.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #536):
external/bsd/fetch/dist/libfetch/common.c: revision 1.14
libfetch: Fix missing SSL_set1_host call.
PR lib/60878: libfetch: missing SSL_set1_host call
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/external/bsd/fetch/dist/libfetch/common.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60878 CVS commit: [netbsd-10] src/external/bsd/fetch/dist/libfetch
Date: Tue, 20 Oct 2026 19:15:12 +0000
Module Name: src
Committed By: martin
Date: Tue Oct 20 19:15:12 UTC 2026
Modified Files:
src/external/bsd/fetch/dist/libfetch [netbsd-10]: common.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1382):
external/bsd/fetch/dist/libfetch/common.c: revision 1.14
libfetch: Fix missing SSL_set1_host call.
PR lib/60878: libfetch: missing SSL_set1_host call
To generate a diff of this commit:
cvs rdiff -u -r1.2.54.3 -r1.2.54.4 \
src/external/bsd/fetch/dist/libfetch/common.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.