-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add check for Key Degradation Attack #12
base: master
Are you sure you want to change the base?
Conversation
5ca5603
to
cdedf88
Compare
Strange, the python 3.3 build always fails... guess it has nothing to do with my PR... |
Hey, thanks for looking into this.. sorry it's taken me so long to follow up. It sounds like a reasonable patch to make. The py3.3 build was problematic for other reasons.. we've removed it (and py34 too), so if you were to rebase your patch to current trunk, I think it would pass. I'd like to understand the attack properly. If I understand it correctly:
This implementation follows the SPAKE2 advice/spec and hashes the entire transcript (including the received message) to build the session key ( If we weren't including the messages in the transcript, then both session keys would be the same (and known to the attacker), which means out-of-band comparison would not reveal the attack. This patch would then prevent the password-knowing MitM attacker from pulling off an undiscoverable attack, leaving them the expected ability to pull off a discoverable attack. Any attacker who knows the secret password and can get in the middle of the conversation can pull off a discoverable attack without any special math, they just execute the protocol normally with Alice (producing an Alice-Attacker key), and again with Bob (producing a Bob-Attacker key), and decrypt/reencrypt all the messages going through. But since the keys are different, an out-of-band comparison could reveal it. Being able to force the key to a known value would thwart this comparison check, but only if the key depends just on K and not also on the protocol transcript. Does that seem right? |
Hi warner, Beside you considerations, without the patch, it is also possible to force K to 0 just from a malicious Alice: If she sets her ephemeral key to 0, this will also force K to 0. But it (luckily) does not harm PFS, as the transcript will add Bobs ephemeral key in form of his sent Y key. But there may exist other attacks using this method that we did not consider, who knows... I think it regardless makes sense, to prevent manipulated X/Y values to remove the ephemeral/PFS part of the key exchange (producing K). |
cb5a1c1
to
60b00f4
Compare
CI still fails... |
Found out, that the SPAKE2-implementation is missing an important check for key degradation, where an attacker is able to degrade the keys to identitiy (zero element), when he gets to know the password. (see https://moderncrypto.org/mail-archive/curves/2015/000427.html)
This is critical, because, it would destroy PFS on the channel, and makes MiM much more easier.
@todo: just added a small check for zero element, but had no time to really test it.@todo: didn't check the relevance for SPAKE2+
Regards, Mike