Re: [openpgp] Should signatures be rejected if the embedded hash prefix does not match?

Daniel Kahn Gillmor <dkg@fifthhorseman.net> Thu, 02 March 2023 14:09 UTC

Return-Path: <dkg@fifthhorseman.net>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 426EAC152F1A for <openpgp@ietfa.amsl.com>; Thu, 2 Mar 2023 06:09:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.303
X-Spam-Level:
X-Spam-Status: No, score=-1.303 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=neutral reason="invalid (unsupported algorithm ed25519-sha256)" header.d=fifthhorseman.net header.b="dXPQ1S/G"; dkim=pass (2048-bit key) header.d=fifthhorseman.net header.b="lTo9F3Fh"
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id woFHEX2UviJ4 for <openpgp@ietfa.amsl.com>; Thu, 2 Mar 2023 06:09:14 -0800 (PST)
Received: from che.mayfirst.org (unknown [162.247.75.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0020FC152F16 for <openpgp@ietf.org>; Thu, 2 Mar 2023 06:09:13 -0800 (PST)
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019; t=1677766150; h=from : to : subject : in-reply-to : references : date : message-id : mime-version : content-type : from; bh=PCj/bQg4yAt/lfIqD4scATHvCKJQQSxGynsoYZk4cqo=; b=dXPQ1S/GmwoYoX/DY9C7HGlpJBSPhe1cXuZHVhJLWMhbm3RcVvgZ6Rbtfvwq0jEjgBEWT BENuZIvFn4HG10pCA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019rsa; t=1677766150; h=from : to : subject : in-reply-to : references : date : message-id : mime-version : content-type : from; bh=PCj/bQg4yAt/lfIqD4scATHvCKJQQSxGynsoYZk4cqo=; b=lTo9F3Fh0ChsOnG7PVZxvhz0Y66EJ3qnNBf4Qz44I+vHxe/418mPbW4ibBvdCEiubgShr E31mowDN/7KHEp1QxW7+3pGliPF5bGNresv/ryN95U2S/mxI8B9vND3A51Bf15ZJEIsFT+i XEv9PA6yxq+4QIHs/WpuGgyfjauT92wQ7ykIw4vl1cD+snST7EoGjTy2hOuba5KYK3qLKdH JIh9y1p8Y4k1/ooJ0JjhzkBXcLl+7/D76R2IXe2iG3zsPi0B80BUNJ0Zz3Pxn4uDY1cy4YY FeXNVTPLIYe3GVIuW5RdlRLRyZf1rM1VbSJ9muxjjFuiOkCJGiaEc1KA6ahA==
Received: from fifthhorseman.net (lair.fifthhorseman.net [108.58.6.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by che.mayfirst.org (Postfix) with ESMTPSA id AA121F9B4 for <openpgp@ietf.org>; Thu, 2 Mar 2023 09:09:10 -0500 (EST)
Received: by fifthhorseman.net (Postfix, from userid 1000) id 55297204F2; Wed, 1 Mar 2023 17:01:02 -0500 (EST)
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: openpgp@ietf.org
In-Reply-To: <fb3a9276-f948-73dc-af81-46dfa9b02209@andrewg.com>
References: <87lekkts65.fsf@fifthhorseman.net> <d759691a-c447-f66d-b839-f1b87e6b89af@andrewg.com> <87y1oj5ltj.fsf@europ.lan> <edeb91b0-6e7e-fa35-c571-d16dff433871@andrewg.com> <87v8jn5e4k.fsf@europ.lan> <55c56429-e1b1-97d3-5ad3-c54a69428143@andrewg.com> <87sfer588g.fsf@europ.lan> <b2a78baa-4636-9353-e079-232d580806a0@andrewg.com> <87o7pe69m6.fsf@europ.lan> <6lLcuziqTC31StjVfWBQYzemBHmXkVQG_LV6cIQ1lQU7qtOTr-HKCRHzxSY5LXsFU_BnnElSN0zry-RGK8TtC5cM_Ab4KsuWSPON8-82ZOM=@protonmail.com> <ebd88ec4-787b-fea7-f822-e6b514343dba@andrewg.com> <87wn41ru96.fsf@fifthhorseman.net> <87cz5sbsv3.fsf@europ.lan> <2ae335f9-b36a-f5e1-8668-b94a805b709e@andrewg.com> <87lekgs64c.fsf@fifthhorseman.net> <fb3a9276-f948-73dc-af81-46dfa9b02209@andrewg.com>
Autocrypt: addr=dkg@fifthhorseman.net; prefer-encrypt=mutual; keydata= mDMEX+i03xYJKwYBBAHaRw8BAQdACA4xvL/xI5dHedcnkfViyq84doe8zFRid9jW7CC9XBiI0QQf FgoAgwWCX+i03wWJBZ+mAAMLCQcJEOCS6zpcoQ26RxQAAAAAAB4AIHNhbHRAbm90YXRpb25zLnNl cXVvaWEtcGdwLm9yZ/tr8E9NA10HvcAVlSxnox6z62KXCInWjZaiBIlgX6O5AxUKCAKbAQIeARYh BMKfigwB81402BaqXOCS6zpcoQ26AADZHQD/Zx9nc3N2kj13AUsKMr/7zekBtgfSIGB3hRCU74Su G44A/34Yp6IAkndewLxb1WdRSokycnaCVyrk0nb4imeAYyoPtBc8ZGtnQGZpZnRoaG9yc2VtYW4u bmV0PojRBBMWCgCDBYJf6LTfBYkFn6YAAwsJBwkQ4JLrOlyhD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figwB81402BaqXOCS6zpcoQ26AAAX mwD8CWmukxwskU82RZLMk5fm1wCgMB5z8dA50KLw3rgsCykBAKg1w/Y7XpBS3SlXEegIg1K1e6dR fRxL7Z37WZXoH8AH
Date: Wed, 01 Mar 2023 17:01:01 -0500
Message-ID: <87a60wrv1e.fsf@fifthhorseman.net>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-="; micalg="pgp-sha256"; protocol="application/pgp-signature"
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/Ae89qC8yicr5NQrf4gJA8G9-mOA>
Subject: Re: [openpgp] Should signatures be rejected if the embedded hash prefix does not match?
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 02 Mar 2023 14:09:18 -0000

On Wed 2023-03-01 19:47:24 +0000, Andrew Gallagher wrote:
> Because in a distributed system you don't know that a signature is not 
> the subject of a countersignature or digest somewhere else. We can 
> easily construct a case where a signature is stored on some central 
> system (e.g. a keyserver), and also distributed to a third party (or 
> parties) for countersignature. When a countersig comes back, what 
> happens if the original sig has been fixed up in the meantime? Does the 
> keyserver refuse to process the countersig (being invalid) or does it 
> revert to the previous (malformed) version? What if one third party 
> countersigs the malformed sig and another countersigs the fixed-up copy?

(no hats on here)

hm, i can see these concerns, but i guess i'm not particularly troubled
by them.  the original signer could even realize their mistake and
re-issue the signature with the exact same data -- there are now
basically two signatures: one well-formed and not countersigned, and one
not-well-formed and countersigned.

If anything, this discussion is moving me in the direction that being
strict is really the only way to go, though i do understand the
reluctance to retroactively declare all the signatures made by github to
be incorrect.

> This is a can of worms that should be nailed firmly shut IMO.

I just don't see how this nails it shut, though, since non-compliant
implementations can still distribute copies of transformed signatures,
and compliant implementations will still have to decide how to deal with
them.  Maybe forbidding accepting signatures with a malformed hash
prefix would nail it shut, but most of these steps just seem like we
would be committing to additional breakage :(

Thanks for the discusison here!

           --dkg