Open 1082008 opened 7 years ago
please lets use a name for the "magic cookie" that actually makes sense. What is it? Is it the ephemeral private key encrypted back to a symmetric key that the server only knows?
One thing that concerns me here is that A and B both send C in the clear, which means C could be replayed.
Can you describe the situation you are imagining where this DoS happens? what sort of application are you imagening deploying this to?
I mean, I guess, if we are gonna talk about mitigating DoS, how do we model this? currently, the security properties we claim about shs are all things you can verify cryptographically - but this kind of DoS depends on the implementation, so what is our model of DoS that we are defending against?
Yes, "magic cookie" contains the ephemeral private key (I used bpsecret for notation but maybe bs is more appropriate) encrypted back to a symmetric key that only the server knows. That cookie doesn't only contain bs but also ap therefore the cookie is bound to this actual handshake. An attacker can replay the cookie but is useless because he doesn't know as, he is unable to create a valid auth message with a replayed cookie.
I think the name cookie is a descriptive one because the "magic cookie" described here is very much like HTTP cookies. Server sends a cookie which must be included in the next request of the client. This is a client side state storage. In this case the cookie must be encrypted because only the server should be able to read its content. I guess that's why its called magic cookie in CurveCP but we can call it simply cookie. What it contains is the same as the minimal amount of information the server would need to store after received client challenge and sent server challenge.
The DoS situation where C is useful is very easy to trigger. In case of TCP transport every client connection causes memory use in the server's network stack and also in the server application with the current implementation. That means some attacker can open unbounded number of connections and send a client challenge message on each of them, triggering memory allocations on the server side. Memory will be exhausted and legitimate clients won't be able to initiate connections to the server under attack. The attack doesn't have to be a distributed one, only one evil host can take down the whole service.
There is not much we can do while staying on TCP because its relatively high per connection resource use at the level of network stack. Magic cookies can help on the server application but not on the network stack. For a real protection UDP should be used instead of TCP. That way there would be no overhead caused by connections because UDP is a connectionless protocol. A new client won't cause any memory use in the OS network stack. But it will cause some memory use in the server application without using cookies. (A secret K can provide the same protection but K cannot be secret in some cases.)
SHS is a very nice protocol if used over TCP but what if I need to use it over UDP? If
K
is kept in secret than it can be enough to prevent DoS attacks but what ifK
is public? WithK
an attacker can send large amount of challenge messages to the server, easily exhausing its memory. A DDoS attack also can exhaust CPU resources which could be mitigated somehow.My ideas are:
Without the proof-of-work mechanism the modified protocol may look like this:
where:
Note that using magic cookie B doesn't need to allocate any memory until step 3, when A authenticated herself for him.
@dominictarr please review