You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multisig: Invalid signatures cause (possibly) wrong verification result #3872
Early testing of the multi-signature feature (done by @Jakuje and the team) has revealed some possible issues/bugs related the overall verification result when one or more signature is faulty, namely:
Corrupted signatures (inverted byte in the middle of the signature area) currently do not cause the whole verification to fail if there is another signature that is OK
Signatures done by algorithms forbidden in crypto-policies currently do cause the whole verification to fail, even if there is another signature that is OK
It seems like these two cases should actually result in the exact opposites, i.e. the former (a corrupt signature) should result in a negative verification whereas the latter (a forbidden or disabled algo) should result in a positive one. This is especially true in the context of the original requirements captured in #3385, which says:
verification will:
ignore unknown algorithms
require all known (and enabled) signatures to pass for a positive verification
where the current cryptographic backend does not really provide any lints nor hints to the calling function/application how to handle this particular error. I think the first thing to fix would be rpm-sequoia reporting some more information through the lints:
But it would not fix the issue (maybe make it just more verbose) as the rpm continues checking the next signatures and then hides the failure with the following code:
I am not sure here what is the alternative here though as I only see the sequoia being invoked twice (once for each signature). Does it mean "there is at least one other RPMv6 signature that verified ok", ignore any failure of other RPM signatures?
It's been a while, but there aren't supposed to be any alternatives in the signature land, that's only for payload digests and their ALT versions. But that code predates multiple signatures by many years so maybe it trips up in an unexpected way someplace. The code around this is pretty fishy anyway.
Looking at getAlt() and its surroundings, it seems getAlt() should be looking at sinfo->alt instead of sinfo->id for matching. And, none of this should get invoked for signatures at all.
I went ahead to test the signatures that are not allowed by crypto policies. This makes rpm-sequoia to return RPMRC_NOTTRUSTED, which makes the verification of the whole RPM fail. This is in comparison with the generic error RPMRC_FAIL returned in case of corrupted signature.
This is the second part of question, if this behavior is expected or not.
The third option what can happen is that one of the keys is not imported, where we got from rpm-sequoia the RPMRC_NOKEY and which is likely ok to fail the whole verification as it would open an attack vector of not importing the key (or somehow blocking) the key the attacker can not break and leaving the verification only on the one that could be broken.
Actually, the last option (untested by Standa yet) would be the unknown algorithm. That is something I can try with the fedora rawhide stock rpm-sequoia (without PQC support) and PQC signature on RPM. This is now behaving the same way as the case of malformed signature:
pgp_verify_signature: Checking signature b91c created at Tue Aug 5 08:25:16 2025 using SHA512 with E926E88BF36FB8BDE503BF48C231FC3A413D7AF44897F3FEC1EB4DE547A16DB5 / 318C3716254627D597FA882432C4AE1D4E2BEEE1DFEE755E46D21742DD65AED8
_pgpVerifySignature2: Lints: Verifying a signature using certificate E926E88BF36FB8BDE503BF48C231FC3A413D7AF44897F3FEC1EB4DE547A16DB5 (MLDSA-SIGN):
1. Certificate E926E88BF36FB8BD invalid: policy violation
because: No binding signature at time 2025-08-05T08:25:16Z
2. Certificate E926E88BF36FB8BD invalid: policy violation
because: No binding signature at time 2025-08-05T13:59:35Z
_pgpVerifySignature2: -> error: Failure: No binding signature at time 2025-08-05T08:25:16Z
error: Verifying a signature using certificate E926E88BF36FB8BDE503BF48C231FC3A413D7AF44897F3FEC1EB4DE547A16DB5 (MLDSA-SIGN):
1. Certificate E926E88BF36FB8BD invalid: policy violation
because: No binding signature at time 2025-08-05T08:25:16Z
2. Certificate E926E88BF36FB8BD invalid: policy violation
because: No binding signature at time 2025-08-05T13:59:35Z
The logs are a bit more verbose, but sequoia is unable to understand this algorithm so from what I see, it returns the generic error which is being hidden in RPM (I believe by the same code path as in the previous case).
As for the NOKEY and NOTTRUSTED special flakes:
NOTTRUSTED is needed to keep installed packages with expired signatures accessible - whether through actual date passing, crypto-policy update or such. Similar story for NOKEY.
In the context of 'rpmkeys -K' with enforcing signature policy (eg the way dnf calls it), the result must be a failure if anything returns non-OK.
A new binary rpm is ok as long as it's small. Fuzzing existing stuff in the test-suite is kinda preferrable, if easily doable (I realize it often is not)
Activity
Jakuje commentedon Aug 5, 2025
Checking how we go around the corrupted signatures, it looks like partially rpm-sequoia fault. I think we are getting the error from here:
https://github.com/rpm-software-management/rpm-sequoia/blob/cd090b02119565c6d171fa9a892790c966cf10ef/src/lib.rs#L943
which explodes inside of OpenSSL:
where the current cryptographic backend does not really provide any lints nor hints to the calling function/application how to handle this particular error. I think the first thing to fix would be rpm-sequoia reporting some more information through the lints:
rpm-software-management/rpm-sequoia#98
But it would not fix the issue (maybe make it just more verbose) as the rpm continues checking the next signatures and then hides the failure with the following code:
rpm/lib/rpmvs.cc
Lines 581 to 585 in 4537a6a
I am not sure here what is the alternative here though as I only see the sequoia being invoked twice (once for each signature). Does it mean "there is at least one other RPMv6 signature that verified ok", ignore any failure of other RPM signatures?
pmatilai commentedon Aug 5, 2025
It's been a while, but there aren't supposed to be any alternatives in the signature land, that's only for payload digests and their ALT versions. But that code predates multiple signatures by many years so maybe it trips up in an unexpected way someplace. The code around this is pretty fishy anyway.
pmatilai commentedon Aug 5, 2025
Looking at getAlt() and its surroundings, it seems getAlt() should be looking at sinfo->alt instead of sinfo->id for matching. And, none of this should get invoked for signatures at all.
Jakuje commentedon Aug 5, 2025
I went ahead to test the signatures that are not allowed by crypto policies. This makes rpm-sequoia to return
RPMRC_NOTTRUSTED, which makes the verification of the whole RPM fail. This is in comparison with the generic errorRPMRC_FAILreturned in case of corrupted signature.This is the second part of question, if this behavior is expected or not.
The third option what can happen is that one of the keys is not imported, where we got from rpm-sequoia the
RPMRC_NOKEYand which is likely ok to fail the whole verification as it would open an attack vector of not importing the key (or somehow blocking) the key the attacker can not break and leaving the verification only on the one that could be broken.Actually, the last option (untested by Standa yet) would be the unknown algorithm. That is something I can try with the fedora rawhide stock rpm-sequoia (without PQC support) and PQC signature on RPM. This is now behaving the same way as the case of malformed signature:
The logs are a bit more verbose, but sequoia is unable to understand this algorithm so from what I see, it returns the generic error which is being hidden in RPM (I believe by the same code path as in the previous case).
Any thoughts what should happen at these cases?
WIP: Fix alternatives mechanism unintentionally kicking in for signat…
pmatilai commentedon Aug 6, 2025
I think pmatilai@73bc2fd should address the issue of invalid signature passing because of the alt mechnism, but I don't yet have a reproducer here.
pmatilai commentedon Aug 6, 2025
As for the NOKEY and NOTTRUSTED special flakes:
NOTTRUSTED is needed to keep installed packages with expired signatures accessible - whether through actual date passing, crypto-policy update or such. Similar story for NOKEY.
In the context of 'rpmkeys -K' with enforcing signature policy (eg the way dnf calls it), the result must be a failure if anything returns non-OK.
Jakuje commentedon Aug 6, 2025
Thanks! What would be the best way to provide a reproducer? Get a test hello.rpm with one malformed signatured? I can provide that and open a PR.
pmatilai commentedon Aug 6, 2025
A new binary rpm is ok as long as it's small. Fuzzing existing stuff in the test-suite is kinda preferrable, if easily doable (I realize it often is not)
WIP: Fix alternatives mechanism unintentionally kicking in for signat…
Jakuje commentedon Aug 6, 2025
Did open a #3880 with the test and your change. Locally seems to work for me (while fails without the patch).
Fix alternatives mechanism unintentionally kicking in for signatures
Fix alternatives mechanism unintentionally kicking in for signatures
Fix alternatives mechanism unintentionally kicking in for signatures