Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 28 |
Nodes: | 6 (0 / 6) |
Uptime: | 44:11:24 |
Calls: | 422 |
Calls today: | 1 |
Files: | 1,024 |
Messages: | 90,216 |
Since https://salsa.debian.org/debian/gnupg2/-/blob/debian/unstable/debian/patches / freepg/0019-Disallow-compressed-signatures-and-certificates.patch? ref_type=heads#L188
This change also breaks the part of Poppler's CI system that is based off randomly regenerated Debian containers. (and they were very recent regenerated)
The signature blob is a detached signature packet followed by a finite
length comment packet.
On Thursday, May 15, 2025 2:04:43 PM CEST Sune Stolborg Vuorela wrote:
The signature blob is a detached signature packet followed by a finite
length comment packet.
A comment package here is what GnuPG calls PKT_COMMENT, it has
datavalue 61. And in most/all openpgp (and librepgp) specs this is in
the private / experimental range, so they should not be rejected 'just because'.
This was btw introduces in GnuPG in 1998 and has been in use for
things ever since.
Looking at your sample PDF (thanks for the link!) it appears that it is
a comment packet of length 0x24d4 containing all zeros. What is the
purpose of this packet? Why is it being included?
Rather than increasing the attack surface of GnuPG, maybe whatever implementation is producing this thing shouldn't emit a
private/experimental packet sequence.
In addition, a Marker packet (Section 5.8) and a Padding packet
(Section 5.14) can appear anywhere in the sequence.
It looks like this was added very recently, well after RFC 9580 came
out, and injects these arbitrary private/experimental packets, strictly
for padding purposes.
Why is padding needed in this case?
If padding is what's needed here, i recommend using standardized padding
that any compliant OpenPGP implementation will accept. Presumably the
goal is for arbitrary OpenPGP consumers to be able to verify the
signature of the PDF, right?
Alternately, if you want to pad a signature packet, you can also inject arbitrary non-critical subpackets into the unhashed subpacket area of
the signature itself; those subpackets should be ignored by every
OpenPGP implementation i'm aware of.
I'm not sure why all of this matters; there are others that expects gnupg in Debian to validate and fail things in a similar way to gnupg-from-upstream and
gnupg-in-other distributions.
Having [padding packets] in the protocol is a problem because
applications taking care not to leak too much information will need
to reject such messages and inform the user about a possible
problem.
And poppler is released, used by others. Not only in Debian, but also
in other places, and it generates these documents. We should not
reject them just because we can.
Note that it is using GpgME to talk to GnuPG, not to do RFC9580 which GnuPG does not support, so all references to RFC9580 is not relevant here.
And these private packets are fully compliant. It is in the spec after
all.
And as I wrote, these packets have been around since 1998, which is at least way before I heard of GnuPG, let alone co-maintained it in Debian.
In a the signed part of a PDF file, it is described that the signature is stored in a specific part of a PDF file (The signature covers bytes A to B and C
to D (and the signature needs to be stored between B and C)), so there this hole that contains the signature, but given the location in the file needs to
be specified before signing the data, it must be bigger than the expected signature size.
Given that there already is a battle tested package parser in GnuPG
Currently, the goal is for users to be able to sign and validate documents without having a properly issued (likely governmental) S/Mime certificate on multiple operating systems.
But that would require understanding the packets rather than just passing it on to the underlying implementation, thus complicating the code and increase complexity of poppler.
A packet parser alone would likely double the amount of code needed in Poppler
for this feature.
Hi Sune--
Thanks for following up here.
What is - to you - the purpose of the reserved packet space around
61-63 in any of the pgp related standards?
What's the purpose of X-foo headers in emails? of X-foo http headers?
This is not about poppler or rfc9580 or any other things. This is about GnuPG-
in-debian adding a patch that was rejected upstream for likely breaking things.
I consider this in the same family as if an email server started to reject emails with a X-foo header, a http client refusing to continue downloading after a X-foo header.
potentially any future versions of GnuPG that decide to limit exposure
to their message parser in a detached signature context.