r/programming • • Jun 02 '17

Hacker, Hack Thyself | Coding Horror

https://blog.codinghorror.com/hacker-hack-thyself/
1.1k Upvotes

205 comments sorted by

View all comments

247

u/[deleted] Jun 02 '17

I'm ashamed to admit that until now I haven't considered a brute force attack as credible because I hadn't considered a 'nation-state' level of computing power. But the math is undeniable. Certainly something to think about and taking an arrogant "won't happen to us" approach seems unwise.

153

u/Ajedi32 Jun 02 '17

I hadn't considered a 'nation-state' level of computing power.

Worth noting that in this article Discourse is using a relatively secure (i.e. slow) hashing function. If you're hashing your passwords with something faster like SHA-256, attackers aren't going to need anywhere near nation-state level resources to brute force most of the passwords in your DB. Brute-force attacks absolutely should be part of the threat model you consider when choosing your hashing function.

28

u/[deleted] Jun 02 '17

I had considered that. As a MS dev, PBKDF2 is obviously useful as it is natively supported in .NET. But yes, you certainly make a notable point.

→ More replies (18)

43

u/danweber Jun 02 '17 edited Jun 02 '17

The best hashing algorithm in the world won't help if your password is "passw0rd".

Even a crappy crypt() hash of a password will be enough if your password is generated by 5 6 Diceware words.

A good hashing algorithm is about protecting the middle group of people who pick not-great but not-bad passwords.

0

u/[deleted] Jun 02 '17

[deleted]

19

u/theOdysseyEffect Jun 02 '17

Haha good thing we don't use those anymore right? right?

21

u/asdfkjasdhkasd Jun 02 '17

no, in the php world we have moved on to the brand new state of the art unbreakable md5() function

0

u/[deleted] Jun 02 '17

[deleted]

→ More replies (1)

13

u/zhaoz Jun 02 '17

Oh course, my password is much more secure. It's Passw0rd1!

8

u/eflat123 Jun 02 '17

Yours, too?!! I better change one of those 's' to '$'.

3

u/Lurking_Grue Jun 02 '17

Mines *******

2

u/AlmennDulnefni Jun 03 '17

All I see is hunter2.

8

u/redalastor Jun 02 '17

I use zxcvbn to test for entropy.

21

u/solatic Jun 02 '17

Of note when thinking about protecting against nation-state level attacks: Atwood points out that the ceiling on the number of iterations you pick for your hash function is an unintentional DDoS caused by legitimate users all trying to slowly log in at once.

For modern web security, DDoS protection is just as critical, if not more so, than password security. As an end-user, you can protect yourself from bad password storage policies through the use of a password manager, but if a website you need now is unavailable, you don't really have a recourse.

1

u/vattenpuss Jun 03 '17

There are incredibly few websites a person needs at any given time. The companies running the sites probably need the users to be able to use it though.

5

u/[deleted] Jun 02 '17

You need to decide what level you stop caring about.

Most places Ive run Ive specifically said we arent protecting against state level actors. A few needes that level of protection.

Its a business requirement, and cost-benefit decision.

4

u/somedaypilot Jun 02 '17

If I were an admin or a netsec, APTs would be what kept me up at night.

3

u/HonestRepairMan Jun 02 '17

What I do in my apps (and someone please tell me if this is terribly wrong) is I set a server secret in the app config somewhere, and give the sysadmin the ability to set their own secret. Then I append or prepend the secret to the password and store that in the database. So even if you had the database you would need the app config file to effectively brute force the hash and reveal a plain-speech password.

5

u/[deleted] Jun 03 '17 edited Jul 11 '24

4

u/rebelcan Jun 02 '17

In most cases, wouldn't they have access to both anyways?

4

u/HonestRepairMan Jun 02 '17

If you only have access to an SQL injection point then maybe not. You would export the database to a hosted location, download the file, and make off with the goods. In these cases the attacker would likely have to understand the source code for the app in question to retrieve the correct variable or output the correct config file. Or so I'm hoping.

But yeah, if someone has tunneled into your server via SSL you're fucked no matter what, unless the attacker is 12.