-
-
Notifications
You must be signed in to change notification settings - Fork 680
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
Cryptography - suggested verification of Diffie-Hellman points #2501
Comments
It is indeed important that the code verifies that the DH points are valid. I think the wording should be instead:
About "the point P", should this requirement apply to FFDH as well (i.e. the point should not be the generator)? |
See RFC 2631 for some validation of Finite Field Diffie-Hellman public keys. |
I defer to @danielcuthbert |
This is a very valid point, but totally dependent on whether they are writing their own curve code (which might raise other red flags if they aren't a large conglomerate or defence prime). But avoiding p-1, {p,0}, and 1 are very important things to do for ECDH - I'm not sure how often developers using libraries can make this kind of error though. |
Yes, the vulnerability could be in dependencies as well, though. |
@randomstuff do you think this is generally relevant enough to include, it sounds like a very specific case... |
@tghost, I am not sure whether this is relevant enough to include in ASVS (or too low-level and not much a consideration in practice for people writing general application code). I think this might apply for example if you use JWA/JKW/JWE/JWT (with ECDH-ES)? Would you have to take care of this case? Also the current requirement is about "Diffie-Hellman and Elliptic Curve Diffie-Hellman". Would such a requirement apply as well to other EC uses such as signatures (ECDSA) for example? I think we would have to review the impact on this kind of situation (JWE with ECDH-ES for example) from application code. |
Can you think of a case where the developer would be doing that themselves and not getting a library to do it... |
@randomstuff ping :) |
@tghosth, I agree that application developer would be expected to use a high level library which takes care of this (… and I don't want to check that my TLS library actually does the right thing for me) however the same might be said of other crypto requirements such as:
I'm not sure where to draw the line between things which are too low-level (and we do not expect application code developers to have to touch without going through a library) vs. things which are not. Some cases where the application developer might end up try to have to care about the validation of group elements (without claiming that these are good ideas):
|
Are we talking about "writing their own curve point computation and signature validation code" (which indeed is quite a read flag) or are we talking about "writing their own crypto code on top of existing ECDH/ECDSA library code" which might be more prevalent. (For example, OpenSSL has |
To me, each of those requirements are less detailed than specific/specific DH curves. My overall feeling from reading through this thread is that this topic is probably too detailed so I think I would be inclined to skip this recommendation or push it to an appendix discussion. Do you have any strong objections @randomstuff ? |
@tghosth, I'd say it's OK for me to skip this requirement.
I am not sure how well it would fit in the appendix section however but why not. |
Ok so I will leave this issue open as a potential item to consider for the appendix but not for the v6 chapter itself, thanks! |
Suggested recuirement from Bart Preneel:
The text was updated successfully, but these errors were encountered: