-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RNP claims Paul Wouter's key 7754c9b4b6b15364ca4a88183b132d4dbbae5d31 is invalid. #2191
Comments
@kaie That's because self-signatures on the key contains wrong lbits value (forced to 0x0001), which by RFC 4880 is |
Is it correct to reject this key, or is that a bug in RNP? |
Paul, which software did you use to generate this key with invalid values? |
It's not a bug but decision (which could be changed in case of need) as standard doesn't directly say how to behave in this case. I believe there were some discussion in openpgp mailing list regarding this case, but right now I don't get an idea how to properly search for that thread. |
I don't remember, but it seems 99.9999% likely that I just used gnupg. |
https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-13.html#name-notes-on-signatures says:
IIRC, we argued for a while about whether we should be explicit about handling this for v4 signatures, and ultimately decided that since implementer behavior has been ambiguous and undefined for decades in v4, we were not likely to be able to fix this ambiguity in this update, but we could resolve it going forward (that is, for v6 signatures). You can see this behavior tested in the interop test suite and see that the implementations appear to be split. |
See also MR !213 and issue #143. |
But why does the key contain those different bytes? Do you think a buggy implementation produced that key? Or do you think that the key data might have been corrupted? I took the key from DNS. Maybe it's possible that @paulwouters made a mistake when converting the key into a key record, or I made a mistake when converting the key back from DNS into a key file? Paul, are you able to export your key to a file and attach it? Maybe this way we could check whether the same problem happens with your original key. |
Could it be that some key server strips/changes this data as GnuPG doesn't seem to behave in this way? |
Attached an export and export-minimal |
(github really does not like copy pasting base64) |
Using hash-slinger's openpgpkey command to --create the DNS OPENPGPKEY record, and the output of the openpgpkey --fetch command. |
Every one of the samples that @paulwouters posted has the two digest prefix octets set to |
Given that I didn't see any GnuPG-generated keys with such behaviour (and slight difference in default options, like absence of BZip2 compression) I guess this key was generated by some other implementation, but I cannot insist on it. Anyway, the thing is not to find out who's guilty but how to resolve this case correctly :) It would be easy to update RNP to ignore this check, but should we actually do that? |
I don't have an opinion yet what RNP should do. Could we try to gather some more evidence? I don't recall any other report from users who claimed they haven't been able to import their keys. Would it make sense to ask on a gnupg developer's mailing list, whether they are aware if any past version of GnuPG may have had a bug that produced this kind of key? |
Apparently open-keychain once had a bug to produce that incorrect data. |
No |
I've looked at a collection of about 1000 public keys, and in 5 of them I see a signature with 0x0001 lbits. None of the signatures is for a binding signature, they are all in user ID certifications (web of trust). |
I've just noted that some future @ni4 i agree with your underlying question. The specification suggests that what RNP is currently doing is the right thing for v6 signatures. I wouldn't want you to remove the check completely, as that would make it non-compliant for v6 signatures. Arguably, this hash prefix field is not a great thing. But if we're going to have it, implementations should populate it correctly, and should indeed produce an error for the signature if it's wrong (otherwise we end up in a situation like this one, where we have different perspectives from different implementations). One reason given for keeping this field at all is that it makes it easy and relatively cheap for implementations to normalize certificates by sort signatures in certificates where the OpenPGP certifications, self-sigs, and binding signatures have been reordered, before the asymmetric part of the verification process has happened. But (a) i'm not sure how many implementations actually do this, (b) if the field isn't correctly populated, this kind of operation isn't possible anyway, and normalizing implementations would need to fall back to the expensive asymmetric operations anyway, and (c) i'm not sure whether this marginal use case is worth the hassle. Here is a copy of Paul's certificate with the pair of hash prefix octets corrected (done by hand with PGPy via
and here is the corrected DANE record (exported via
|
@kaie wrote:
Thanks for doing this research, Kai. By random chance we'd expect 1 in 65336 OpenPGP signatures to have the two left-most octets of hash match 0x0001. @andrewgdotcom maybe you can do a more thorough review of certifications in the hockeypuck network? It would be good to know whether there are any patterns to which specific keys are issuing such a certification; maybe that would let us find someone who is actively using the non-conformant tool. |
Thanks Daniel, this allowed me to import Paul's key and send him encrypted email. |
In my sample set of 1000 keys I have ~ 187000 sigs |
you have a mean of 187 signatures on each certificate‽ that seems quite high to me. |
yes. I once ran a script to fetch signer keys, for the signatures found in the keys of my contacts. This might have been before the keyserver spam incident, so I probably have some spam signatures in there. |
Note I participated in Fosdem keysigning events twice. If a key has multiple user IDs, and many party people have signed all user IDs, this also can quickly result in a bigger number of signatures. |
In a set of 187000 randomly generated sigs one would expect to see ~3 sigs with any given hash prefix. So the reported 5 instances of a 0x0001 hash prefix is slightly high, but comsistent with a random distribution given the small sample size. |
A quick and dirty audit on a sample subset of the last pre-flooding SKS dump (not so many spammy keys) shows that digest prefixes of 0x1 are an order of magnitude more prevalent than any other prefix.
|
And from eyeballing a selection, it would appear that the offending sigs started appearing in August 2015. |
This should not be a problem as yet we do not insist on v6 compatibility and support, just have some chunks of code which were needed for Thunderbird-PQC. Given that crypto-rerfresh is still seem to be updated, as well as draft-wussler, that would not be an issue for a while. As for me it is better to allow user to use such key(s) (probably in configurable way) instead of taking him in trouble. |
On Thu, 15 Feb 2024, Nickolay Olshevsky wrote:
Given that crypto-rerfresh is still seem to be updated
It is in the RFC Editor queue, so there shouldn't be any changes
other then editorial/readability.
|
The offending digest prefixes appear in signatures using both SHA1 and SHA256, so this issue cannot be related to the openkeychain one linked above (which was caused by an unsafe reuse/reinit of a hash algo and therefore would not emit 0x0001 in all cases). |
The vast majority of the offending digests that I see in the SKS dataset are in default-config keys, i.e. ones that have one userid with one selfsig and one encryption subkey with one selfsig only. In such cases both selfsigs have the broken digest. |
First thought about this as possible explanation: singpolyma/openpgp-php#120 (comment), but it doesn't seem to apply, as should place value which differs from 0x0001 in this case. |
@ni4 Yes, the openpgp-php issue used the first two octets of the signed data instead of the unsigned digest - but that wouldn't produce this behaviour. |
I fetched Paul's key from DNS (@letoams)
I will attach it as a file.
Importing that key into Thunderbird fails. The key isn't revoked, function rnp_key_valid_till64 reports zero, which means "the key was never valid".
Importing into an empty keyring reports the following:
@ni4 I don't understand why the key isn't accepted. Do you understand in which way this key is broken? Thanks in advance
paul-exported.txt
The text was updated successfully, but these errors were encountered: