40

Some services (for instance ProtonMail) claim to store hashes of phone numbers, instead of phone numbers themselves (while they don't say how they hash it). Now, given that the number of potentially valid phone numbers is very small (about 26 bits worth of information in an 8-digit phone numbers), it should be quite easy to recover a phone number from its hash.

So what's the point?

7
  • 20
    did you take into account the likelihood of salt and pepper?
    – TheHidden
    Commented Mar 15, 2018 at 14:44
  • 7
    I think the hashing should be seen more as obfuscation in this context. Not irreversible, but still better than nothing.
    – Anders
    Commented Mar 15, 2018 at 15:06
  • 27
    what gives you the idea its 8 digit? phone numbers can have between 3 and 15 digits source E.164 and thats even without the Country code and international prefix ('+'). having 18 digits would yield a lot more than 26 bits of information
    – LvB
    Commented Mar 15, 2018 at 15:44
  • 19
    @TheHidden All the salts and peppers in the world won't change the fact that a 26-bit key space is easily brute forced (in about 67mln hashes). Using a slow hash function helps against brute force; salts and peppers do not (and are not designed to).
    – marcelm
    Commented Mar 15, 2018 at 19:12
  • 1
    Other than preventing employees from taking a quick look at phone numbers, the purpose here is rather marketing than security. But you can’t really blame them, there is no easy solution to this problem. Given what they want to do, this is still (a little bit) better than storing in plaintext.
    – caw
    Commented Mar 15, 2018 at 23:08

4 Answers 4

61

ProtonMail may request your phone number to perform a human check:

  • ProtonMail detects that you're attempting to create several accounts.
  • It requests you a phone number, to send you a token via SMS.
  • You must send that token to ProtonMail to prove you're the phone number owner.

Then, ProtonMail doesn't need your phone number anymore, but it still need to use it to prevent spammers to create multiple accounts.

Hashing the phone number allows it to not store the original number and to prevent someone to use the same number twice.

From their FAQ:

However, using the same phone number will result in obtaining the same cryptographic hash, so by comparing hashes, we can detect re-use of phone number or email addresses for human verification.

Thus ProtonMail doesn't seem to use unique salts.

We also know thanks to a tweet from Bart Butler (ProtonMail CTO) that:

  • ProtonMail regularly flushes stored hashes.
  • Stored hashes aren't linked to any account.

Bart Butler also tweeted:

We use a slow password hash (With a salt) and flush the list and rotate the salt at irregular intervals.

In conclusion: brute-forcing them is possible, but it's neither practical nor useful.

0
10

The hash is useful as an indirect map, even if it's not as secure as a typical hashing setup. One of the biggest benefits is purely social. Hashing (even a weak hash) draws a clear line in the sand for an employee about what is acceptable to view. Putting up any barriers to viewing the real phone number will help keep honest people honest.

it should be quite easy to recover a phone number from its hash

Easy is a relative term. True, this hashing setup may not help much against a determined attacker who is willing to perform hash cracking. But you also have to think of the 99% of other employees with access to the data who don't even know what a hash really is, let alone how to crack them.

2
  • 2
    That's a good point: even if it only adds a minor technical barrier for someone knowledgeable, it is enough of a social deterrent to be useful. Kind of like a (regular) fence. Commented Mar 17, 2018 at 0:09
  • 3
    @BlenderBender: Indeed! And that's a really important point. We hear here over and over again how security by obfuscation is useless to the point of being better omitted, yet everybody I know has a thin slice of wood around their garden. It's trivial to see over it, and provides no real privacy, and certainly no real security. But it does send a message: "this is my space and if you enter it you must have willfully violated my terms". Hashing a phone number, while maybe cryptographically useless does the same thing in the context of employees glancing at the DB. That is not entirely useless. Commented Mar 18, 2018 at 4:25
6

The point is to not store them in plaintext.

That is probably pretty much it. As D.W. pointed out in his comments, that Benoit's answer, tells you their reason why they store phone numbers and that they hash them. ProtonMail does not tell you why they hash them. We all can only speculate about this, until an employee of ProtonMail tells us the exact reason.

The most probable reason is (in my opinion) is the following:

ProtonMail is a company whose whole business model is founded on secure products and protecting a customer's privacy. If they told you, that they saved phone numbers in plaintext, that would be pretty weird. Hashing them makes much more sense in that regard, don't you think?
On the other hand, ProtonMail doesn't link phone number hashes to user profiles, they flush the hashes regularly and as you stated yourself, there's not much to gain from a phone number.

Hashing phone numbers if they have to store them is better than not hashing them. That's why they do it.
Does it strengthen security much? No.
Is it better than storing them in plaintext? Yes.

1

There are two reasons for storing hashed phone numbers, one is useful the other one is not:

1) Allow to verify the user. Here a salted slow hash is useful. While brute-forcing a phone number is faster than a password, it still provides added security.

2) Pretend to provide a more safe lookup (i.e. in several of whatsapp competitors). Here you cannot salt the hash, because you would not be able to search for the hash when only knowing the phone number. This means a rainbow table is easy to create as the search space of unsalted hashes is really small.

Note that 1) still provides an easy proof of existence when you have the database. Hash your phone number with all the salts used in the database and look it up. If it is stored in there, you will find it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .