[v6] Randomise v4 and v5 signatures via custom notation, add config.nonDeterministicSignaturesViaNotation to disable feature#1737
Merged
larabr merged 4 commits intoopenpgpjs:v6from Apr 2, 2024
Conversation
….nonDeterministicEdDSASignaturesViaNotation` to disable feature EdDSA is known to be vulnerable to fault attacks which can lead to secret key extraction if two signatures over the same data can be collected. Randomly occurring bitflips in specific parts of the computation might in principle result in vulnerable faulty signatures being generated. To protect signatures generated using v4 and v5 keys from this possibility, we randomise each signature by adding a custom notation with a random value, functioning as a salt. v6 signatures do not need to rely on this, as they are non-deterministic by design. While this notation solution is interoperable, it will reveal that the signature has been generated using OpenPGP.js, which may not be desirable in some cases. For this reason, the option `config.nonDeterministicEdDSASignaturesViaNotation` (defaulting to true) has been added to turn off the feature.
Member
|
Perhaps we can just do this for all algorithms, not just EdDSA? I believe Sequoia does so also as a precaution against vulnerabilities in the hash algorithm, for example. And, while that's unlikely to be an issue for SHA2 anytime soon, it'd simplify the code (and security analyses, in the sense that then all signature hashes are salted, regardless of algorithm and signature version), and doesn't cost most. |
config.nonDeterministicEdDSASignaturesViaNotation to disable featureconfig.nonDeterministicSignaturesViaNotation to disable feature
twiss
approved these changes
Apr 2, 2024
With the new salt notation, the original input array was mutated, which is undesirable, but it also led to an error when signing with multiple keys, since duplicate salt notations were detected.
63993d8 to
7982713
Compare
657af92 to
4e73f3e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EdDSA is known to be vulnerable to fault attacks which can lead to secret key extraction if two signatures over the same data can be collected. Randomly occurring bitflips in specific parts of the computation might in principle result in vulnerable faulty signatures being generated.
To protect signatures generated using v4 and v5 keys from this possibility, we randomise each signature by adding a custom notation with a random value, functioning as a salt.
For simplicity, we add the salt to all algos, not just EdDSA, as it may also serve as protection in case of weaknesses in the hash algo, potentially hindering e.g. some chosen-prefix attacks.
v6 signatures do not need to rely on this, as they are non-deterministic by design.
While this notation solution is interoperable, it will reveal that the signature has been generated using OpenPGP.js, which may not be desirable in some cases.
For this reason, the option
config.nonDeterministicSignaturesViaNotation(defaulting to true) has been added to turn off the feature.