Skip to content
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

Check for exposed password during password change #4604

Closed
MrPetovan opened this issue Mar 16, 2018 · 8 comments
Closed

Check for exposed password during password change #4604

MrPetovan opened this issue Mar 16, 2018 · 8 comments

Comments

@MrPetovan
Copy link
Collaborator

Today I stumbled on https://github.com/DivineOmega/password_exposed, a library that exposes a handy function to check if a given password has been part of the leaks recorded by https://haveibeenpwned.com

I believe it would be a better check than any password length or string complexity requirement.

Last but not least, the library requirements (PHP >= 5.6) nicely matches Friendica's.

@annando
Copy link
Collaborator

annando commented Mar 16, 2018

I'm always unsure about this functionality. I hope that the people on the other side are good people - but if not, then we would fill their password lists with our passwords.

@MrPetovan
Copy link
Collaborator Author

The search is done on a range of SHA1 hashes. Meaning you don't submit your plaintext password to haveibeenpwned, you submit the first 5 characters of the SHA1 hash of the intended plaintext password, and it returns all exposed passwords hashes starting by those 5 characters. The library then locally check if any hash matches.

I had the same question as you, so I digged into the library code before opening this issue.

@Andi-K
Copy link

Andi-K commented Mar 19, 2018

Hm I don't quite understand the benefit. Of course, it's not good to use very often used passwords or always the same PW/email combination. But if you forbid all (That's more than half a billion!) leaked passwords, you just tell the attackers which they can skip.

In case the attackers can access the database, it is not good to have hashes that occur in a rainbow table. But Friendica now uses a good algorithms (I hope) and there will always be another hash from one password. This also means that the hash can not be backtracked to the password. Right?

Moreover, users will probably go crazy if they are not allowed to use so many passwords and stay with those generated by Friendica.

the idea is good, but too much of the good. I'm only in favour of blocking the most popular passwords.

@MrPetovan
Copy link
Collaborator Author

When a password has been exposed, it means it's available in plaintext in a datadump that haveibeenpwned got a hold of. I know a former password of mine has been exposed as such in a data dump from the Electronic Arts Origin service for example. As a result I don't use it any more anywhere. But what if you don't check haveibeenpwned regularly?

This isn't about hash strength in database (which is now ensured by PHP native password_hash() function), but about someone trying an existing email address/password couple from such a data dump.

This isn't about bruteforce attacks either because this service won't mitigate this issue. Although even with half a billion passwords unavailable, the attack surface still is incredibly vast. The raw number of passwords combinations with just 6 characters from latin lowercase letters, latin uppercase letters and numbers is 56,800,235,584. Half a billion passwords is an insignificant part of it, and that's just 6 characters with no special ones.

The goal of using this library is to force a would-be hacker to go the hardest route, the longest one. To make illegally accessing accounts on Friendica more expensive than softer targets. Database breach can be mitigated by strong hashes. Man-In-The-Middle attacks can be mitigated by HTTPS. Bruteforce logins can be handled with firewall settings, but someone else having your email and password from another service data breach can't be mitigated, except by using this service.

@Andi-K
Copy link

Andi-K commented Mar 19, 2018

The raw number of passwords combinations with just 6 characters from latin lowercase letters, latin uppercase letters and numbers is 56,800,235,584. Half a billion passwords is an insignificant part of it, and that's just 6 characters with no special ones.

You're right, it's not as much as it sounds.
My fear was that too much is excluded.

@MrPetovan
Copy link
Collaborator Author

It gets even better with more characters:

  • 7 characters: 3,521,614,606,208 total combinations
  • 8 characters: 218,340,105,584,896 total combinations

If it isn't dizzying enough, you can even add the number of combinations from different number of characters. This is why password dumps and password dictionaries are very useful, anything that can help reduce the attack surface is valuable.

By preventing users to use already exposed passwords, it actually increases the attack surface by limiting it to the vast space of uncommon and/or unexposed passwords.

@Andi-K
Copy link

Andi-K commented Mar 19, 2018

You already cleared up my doubts.

@MrPetovan
Copy link
Collaborator Author

I’m glad I could, thanks for the question!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants