2
$\begingroup$

I have an application where it would be advantageous for an attacker to have to spend a long time generating public keys.

To do this, I require that the hash of the public key be less than a certain number. That way a typical user will take 1 second to generate a public key, and an attacker who is trying to DOS public resources will also have to spend more resources to do so than it costs for us to detect.

There are two mechanisms proposed:

  1. Take a public key, hash it many times with an incrementing salt, and require the result to be less than a certain number.

  2. Generate a public key, hash it once, and if the result is not less than a certain number, add one to the private key and add the generator to the public key.

The first mechanism helps mitigate DOS and spam attacks. The second mechanism helps mitigate some MITM attacks as well.

I like the features of the second, except for some drawbacks:

  1. This reduces the number of valid public keys that exist, and could reduce search space for an attacker attempting in the process of brute forcing public keys. Since we're using a secure hash, it seems the DLP remains equally hard with or without this hash.
  2. This relies on the point addition algorithm being highly efficient, and assumes an attacker may not have some new and better way to perform this operation. But this is as opposed to assuming efficient hashing, an equal assumption?
  3. It's possible that an unprivileged attacker observing the initial POW generation could determine some information about the key. Not a huge deal since these keys are not frequently generated, but perhaps not.

Are there other things I should be thinking about? Is there a standard out there in the wild I haven't found?

$\endgroup$
4
$\begingroup$

I like the features of the second, except for some drawbacks:

I don't believe the drawbacks are as bad as you think.

1.This reduces the number of valid public keys that exist, and could reduce search space for an attacker attempting in the process of brute forcing public keys.

It doesn't help the attacker; if the attacker sees the public key, the knowledge that the hash is small doesn't help him (as he sees the exact value). And the additional hashing requirement doesn't help Pollard Rho or Big-Step-Little-Step (two algorithms for computing discrete logs)

2.This relies on the point addition algorithm being highly efficient, and assumes an attacker may not have some new and better way to perform this operation.

I believe that's a fairly safe assumption; it's hard to see how someone could generate $(x, xG)$ pairs in a manner that is significantly more efficient than your algorithm. In any case, the most significant threat is an attacker with a bot or DSP farm; that would allow him to generate a number of public keys considerably faster than an honest user.

3.It's possible that an unprivileged attacker observing the initial POW generation could determine some information about the key.

With your algorithm, the attacker has no knowledge of where you started the search. If he learns that you took a while, he can deduce that a $(x - \delta)G$ doesn't meet the hashing criteria for a number of $\delta$s, however, as he can see the value $xG$, he could verify that directly if he wanted to, and so it doesn't actually leak any information about the private key.

So, it looks safe; my only concern is that it might not provide as much DoS protection as you hoped (of course, I don't know how much protection you're looking for, and what assumptions you are willing to make about attacker capabilities...)

$\endgroup$
  • $\begingroup$ Thanks! Right now it takes about 4 million times longer to create a key on most of the devices we've compile it on ... vs verification. Suppose I release a pubk and the remote user verifies the hash over the phone mapped to 4 easy to remember english words (2048 possible words). An MITM would have to generate more than a quadrillion valid keys to find a collision key. With the POW added in... this makes his job 1 million times harder. Of course, we can always add more words for verification, but the POW is nicer. $\endgroup$ – Erik Aronesty Jan 7 at 23:33
  • $\begingroup$ Also, during certain kinds of DDOS attacks, we can ban a particular pubkey... but an attacker can roll a new one. This makes new pubkey about a million times harder to create. (And the user can choose how much POW they want to protect their public network). $\endgroup$ – Erik Aronesty Jan 7 at 23:34
  • $\begingroup$ @ErikAronesty: don't forget to include some ephemerial data (e.g. initial cookies from both sides) in with the hash you use; otherwise, the attacker could construct a rainbow table to speed up the lookup from English words to public keys $\endgroup$ – poncho Jan 8 at 0:17
  • $\begingroup$ yes, we roll a random number used during the initial/vulnerable exchange. after that, we don't salt it... because we want the words corresponding to identity to remain "familiar" over time. $\endgroup$ – Erik Aronesty Jan 8 at 14:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.