8000 [v6] Randomise v4 and v5 signatures via custom notation, add `config.nonDeterministicSignaturesViaNotation` to disable feature by larabr · Pull Request #1737 · openpgpjs/openpgpjs · GitHub
[go: up one dir, main page]

Skip to content

Conversation

larabr
Copy link
Collaborator
@larabr larabr commented Mar 26, 2024

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.

….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.
@twiss
Copy link
Member
twiss commented Mar 27, 2024

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.

@larabr larabr changed the title [v6] Randomise v4 and v5 EdDSA signatures via custom notation, add config.nonDeterministicEdDSASignaturesViaNotation to disable feature [v6] Randomise v4 and v5 signatures via custom notation, add config.nonDeterministicSignaturesViaNotation to disable feature Mar 28, 2024
larabr added 2 commits April 2, 2024 13:51
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.
@larabr larabr force-pushed the v6-random-v4-eddsa-signatures branch from 63993d8 to 7982713 Compare April 2, 2024 11:53
@larabr larabr force-pushed the v6-random-v4-eddsa-signatures branch from 657af92 to 4e73f3e Compare April 2, 2024 15:24
@larabr larabr merged commit c68bd96 into openpgpjs:v6 Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0