NetBSD Problem Report #59936
From wiz@netbsd.org Fri Jan 23 16:00:05 2026
Return-Path: <wiz@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 "R13" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 19CE81A923E
for <gnats-bugs@gnats.NetBSD.org>; Fri, 23 Jan 2026 16:00:05 +0000 (UTC)
Message-Id: <20260123160004.A909284D96@mail.netbsd.org>
Date: Fri, 23 Jan 2026 16:58:57 +0100 (CET)
From: Thomas Klausner <wiz@NetBSD.org>
Reply-To: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Subject: netpgpverify needs big update
X-Send-Pr-Version: 3.95
X-From4GNATS: "Thomas Klausner via gnats" <gnats-admin@NetBSD.org>
>Number: 59936
>Category: bin
>Synopsis: netpgpverify needs big update
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 23 16:05:00 +0000 2026
>Last-Modified: Sat Jan 31 22:30:01 +0000 2026
>Originator: Thomas Klausner
>Release: NetBSD 11.99.4
>Organization:
>Environment:
Architecture: x86_64
Machine: amd64
>Description:
I wanted to use less ancient software to create the pkgsrc-security
key and tried creating one with gpg2 but had to find out that
netpgpverify doesn't support this. So we still have to create the keys
with gpg1 and also create the signatures with gpg1.
In addition, netpgpverify can not read gpg keyrings any longer, and reports
very weird error messages about this.
I did a couple tests with the current pkgsrc-security key (created by gpg1)
and a to-be-the-new-one (created with gpg2), both RSA 4096 keys.
I then created signed files in the same way that the signed
pkg-vulnerabilities files are created, and verified them with gpg1,
gpg2, netpgpverify from NetBSD 11.99.4 and netpgpverify from
pkgsrc-current.
netpgpverify could not read the default GPG keyring, so I had to
manually export and import the keys into a separate keyring created
with netpgpkeys. The import of the gpg2-created key failed.
>How-To-Repeat:
1. Create signed test files:
$ gpg -sta --clearsign --no-options --output=signed.old.gpg1 -u D90AFC4C78205993C7215B93F485518FD115DA12 test-input
$ gpg -sta --clearsign --no-options --output=signed.new.gpg1 -u 518DD6CC3111CB806B5C0A37185D84F136FDCB2D test-input
$ gpg2 -sta --clearsign --no-options --output=signed.old.gpg2 -u D90AFC4C78205993C7215B93F485518FD115DA12 test-input
$ gpg2 -sta --clearsign --no-options --output=signed.new.gpg2 -u 518DD6CC3111CB806B5C0A37185D84F136FDCB2D test-input
2. Test them with gpg1, gpg2 - success.
$ gpg --verify signed.old.gpg1
gpg: Signature made 23. Jänner 2026 16:21:52 CET using RSA key ID D115DA12
gpg: Good signature from "pkgsrc Security Team <pkgsrc-security@NetBSD.org>"
gpg: aka "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>"
$ gpg --verify signed.old.gpg2
gpg: Signature made 23. Jänner 2026 16:20:31 CET using RSA key ID D115DA12
gpg: Good signature from "pkgsrc Security Team <pkgsrc-security@NetBSD.org>"
gpg: aka "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>"
$ gpg --verify signed.new.gpg1
gpg: Signature made 23. Jänner 2026 16:22:37 CET using RSA key ID 36FDCB2D
gpg: Good signature from "pkgsrc Security Team <pkgsrc-security@NetBSD.org>"
gpg: aka "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>"
$ gpg --verify signed.new.gpg2
gpg: Signature made 23. Jänner 2026 16:19:13 CET using RSA key ID 36FDCB2D
gpg: Good signature from "pkgsrc Security Team <pkgsrc-security@NetBSD.org>"
gpg: aka "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>"
$ gpg2 --verify signed.old.gpg1
gpg: Signature made 23. Jänner 2026 16:21:52 CET
gpg: using RSA key F485518FD115DA12
gpg: Good signature from "pkgsrc Security Team <pkgsrc-security@NetBSD.org>" [full]
gpg: aka "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>" [full]
$ gpg2 --verify signed.old.gpg2
gpg: Signature made 23. Jänner 2026 16:20:31 CET
gpg: using RSA key D90AFC4C78205993C7215B93F485518FD115DA12
gpg: Good signature from "pkgsrc Security Team <pkgsrc-security@NetBSD.org>" [full]
gpg: aka "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>" [full]
$ gpg2 --verify signed.new.gpg1
gpg: Signature made 23. Jänner 2026 16:22:37 CET
gpg: using RSA key 185D84F136FDCB2D
gpg: Good signature from "pkgsrc Security Team <pkgsrc-security@NetBSD.org>" [ultimate]
gpg: aka "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>" [ultimate]
$ gpg2 --verify signed.new.gpg2
gpg: Signature made 23. Jänner 2026 16:19:13 CET
gpg: using RSA key 518DD6CC3111CB806B5C0A37185D84F136FDCB2D
gpg: Good signature from "pkgsrc Security Team <pkgsrc-security@NetBSD.org>" [ultimate]
gpg: aka "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>" [ultimate]
3. Try using (either) netpgpverify to do the same - FAILS because of
keyring reading problems (it reads /home/wiz/.gnupg/pubring.gpg,
verified using ktrace)
$ /usr/pkg/bin/netpgpverify signed.new.gpg2
Ignoring unusual/reserved signature subpacket 34
Ignoring unusual/reserved signature subpacket 34
weird type of sig! 22
read_sigpkt: can't read sigs, v4
can't read keyring
(doesn't matter which file, doesn't even try verifying them)
4. Create a new keyring for netpgpverify using netpgpkeys - works for
old key, fails for GPG2-create key (both exported with gpg1, just to
be sure that that is not the problem):
$ gpg --export -a D90AFC4C78205993C7215B93F485518FD115DA12 > D90AFC4C78205993C7215B93F485518FD115DA12
$ gpg --export -a 518DD6CC3111CB806B5C0A37185D84F136FDCB2D > 518DD6CC3111CB806B5C0A37185D84F136FDCB2D
$ netpgpkeys --keyring netpgp.keyring --import D90AFC4C78205993C7215B93F485518FD115DA12
1 key
pub 4096/RSA (Encrypt or Sign) f485518fd115da12 2024-12-31 [EXPIRES 2026-01-25]
Key fingerprint: d90a fc4c 7820 5993 c721 5b93 f485 518f d115 da12
uid pkgsrc Security Team <pkgsrc-security@pkgsrc.org>
uid pkgsrc Security Team <pkgsrc-security@NetBSD.org>
encryption 4096/RSA (Encrypt or Sign) a6968b63a729b32a 2024-12-31 [EXPIRES 2026-01-25]
$ netpgpkeys --keyring netpgp.keyring --import 518DD6CC3111CB806B5C0A37185D84F136FDCB2D
Can't free 546 (0x222)
Can't free 546 (0x222)
/usr/src/crypto/external/bsd/netpgp/lib/netpgp/../../dist/src/lib/packet-parse.c:1864: PGP_E_R_UNCONSUMED_DATA, Unconsumed data (5)
/usr/src/crypto/external/bsd/netpgp/lib/netpgp/../../dist/src/lib/packet-parse.c:1838: PGP_E_PROTO_UNKNOWN_SS, Unknown signature subpacket type (34)
/usr/src/crypto/external/bsd/netpgp/lib/netpgp/../../dist/src/lib/packet-parse.c:1864: PGP_E_R_UNCONSUMED_DATA, Unconsumed data (5)
/usr/src/crypto/external/bsd/netpgp/lib/netpgp/../../dist/src/lib/packet-parse.c:1838: PGP_E_PROTO_UNKNOWN_SS, Unknown signature subpacket type (34)
Cannot import key from file 518DD6CC3111CB806B5C0A37185D84F136FDCB2D
$ netpgpkeys --keyring netpgp.keyring --list-keys
1 key found
"pub" 4096/"RSA (Encrypt or Sign)" "f485518fd115da12" 2024-12-31 [EXPIRES 2026-01-25]
Key fingerprint: "d90a fc4c 7820 5993 c721 5b93 f485 518f d115 da12 "
uid "pkgsrc Security Team <pkgsrc-security@pkgsrc.org>" ""
uid "pkgsrc Security Team <pkgsrc-security@NetBSD.org>" ""
encryption 4096/"RSA (Encrypt or Sign)" "a6968b63a729b32a" 2024-12-31
encryption 4096/"RSA (Encrypt or Sign)" "a6968b63a729b32a" 2024-12-31
5. Verify signed files using netpgp and the specially created keyring
$ netpgpverify -k netpgp.keyring signed.old.gpg1
Good signature for signed.old.gpg1 made Fri Jan 23 16:21:52 2026
signature 4096/RSA (Encrypt or Sign) f485518fd115da12 2024-12-31
fingerprint d90a fc4c 7820 5993 c721 5b93 f485 518f d115 da12
uid pkgsrc Security Team <pkgsrc-security@pkgsrc.org>
uid pkgsrc Security Team <pkgsrc-security@NetBSD.org>
$ netpgpverify -k netpgp.keyring signed.old.gpg2
Signature did not match contents -- Signature key id 93c7215b93f48551 not found
$ netpgpverify -k netpgp.keyring signed.new.gpg1
Signature did not match contents -- Signature key id 185d84f136fdcb2d not found
$ netpgpverify -k netpgp.keyring signed.new.gpg2
Signature did not match contents -- Signature key id 806b5c0a37185d84 not found
Please note that the lines for the gpg2-created files show a different
key ID - comparing it to the output from gpg1/2 above you can see that
this is an earlier part of the hex string of the GPG key, so
netpgpverify seems to be parsing the wrong location for the key
"fingerprint" (last hex digits).
>Fix:
I think the following fixes are needed:
- support keys created by gpg2
- support signatures created by gpg2
- support GPG(2?) keyrings
>Audit-Trail:
From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59936: netpgpverify needs big update
Date: Fri, 23 Jan 2026 17:26:08 +0100
On Fri, Jan 23, 2026 at 04:05:01PM +0100, Thomas Klausner via gnats wrote:
> - support signatures created by gpg2
I think this particular problem might have been fixed in pkgsrc with
riastradh's commit:
--- begin ---
security/netpgpverify: Handle issuer fingerprint subpackets.
This is an extremely dodgy stop-gap measure to verify signatures
produced by gpg2. It does nothing to address pervasive problems in
netpgpverify, like PR security/57449 or PR bin/59823, or even more
narrowly scoped problems with using keyids instead of fingerprints.
I'm a little reluctant to even commit this stop-gap because the
problems are so bad, and a band-aid won't fix a spurting carotid.
--- end ---
but the other two aren't (gpg keyrings, gpg2-created keys).
Thomas
From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59936: netpgpverify needs big update
Date: Fri, 23 Jan 2026 17:26:31 +0100
Oh, and the fix hasn't made it to the base system yet.
Thomas
From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59936 CVS commit: src/tests/usr.bin/netpgpkeys
Date: Fri, 23 Jan 2026 20:57:10 +0000
Module Name: src
Committed By: wiz
Date: Fri Jan 23 20:57:10 UTC 2026
Added Files:
src/tests/usr.bin/netpgpkeys: Makefile Testspec t_netpgpkeys.sh
Log Message:
add tests for parts of PR 59936
Not hooked up yet pending review
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/netpgpkeys/Makefile \
src/tests/usr.bin/netpgpkeys/Testspec \
src/tests/usr.bin/netpgpkeys/t_netpgpkeys.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59936: netpgpverify needs big update
Date: Fri, 23 Jan 2026 21:59:28 +0100
While testing, I noticed that for the default keys generated by gpg2
(using --gen-key), netpgpkeys even dumps core during import.
$ netpgpkeys --keyring netpgp.keyring --import testkey-ec.pub
netpgp.keyring: No such file or directory
Can't read pubring netpgp.keyring
parse_pubkey: parse_pubkey_data failed
zsh: segmentation fault netpgpkeys --keyring netpgp.keyring --import testkey-ec.pub
Test case already committed.
Thomas
From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59936 CVS commit: src
Date: Fri, 30 Jan 2026 09:01:09 +0000
Module Name: src
Committed By: wiz
Date: Fri Jan 30 09:01:08 UTC 2026
Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/usr.bin: Makefile
src/tests/usr.bin/netpgpverify: Makefile t_netpgpverify.sh
Added Files:
src/tests/usr.bin/netpgpverify/data: D5B22A28.pub D5B22A28.secret
message message.keyring message.v1.asc message.v1.asc.expected
message.v1.sig message.v1.sig.expected message.v2.asc
message.v2.asc.expected message.v2.sig message.v2.sig.expected
Log Message:
add more netpgpverify tests for PR 59936
enable netpgpkeys tests
To generate a diff of this commit:
cvs rdiff -u -r1.1409 -r1.1410 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.215 -r1.216 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.44 -r1.45 src/tests/usr.bin/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/netpgpverify/Makefile
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/netpgpverify/t_netpgpverify.sh
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/netpgpverify/data/D5B22A28.pub \
src/tests/usr.bin/netpgpverify/data/D5B22A28.secret \
src/tests/usr.bin/netpgpverify/data/message \
src/tests/usr.bin/netpgpverify/data/message.keyring \
src/tests/usr.bin/netpgpverify/data/message.v1.asc \
src/tests/usr.bin/netpgpverify/data/message.v1.asc.expected \
src/tests/usr.bin/netpgpverify/data/message.v1.sig \
src/tests/usr.bin/netpgpverify/data/message.v1.sig.expected \
src/tests/usr.bin/netpgpverify/data/message.v2.asc \
src/tests/usr.bin/netpgpverify/data/message.v2.asc.expected \
src/tests/usr.bin/netpgpverify/data/message.v2.sig \
src/tests/usr.bin/netpgpverify/data/message.v2.sig.expected
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59936: netpgpverify needs big update
Date: Sat, 31 Jan 2026 23:28:07 +0100
One more thing I just noticed:
netpgpkeys --help
tries to parse the default keyring before it prints the help
output. (I noticed because it fails and prints lots of warnings.)
I think that --help should not parse the keyring.
Thomas
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.