News for hackers. Stuff that matters.
Re:Okta Bcrypt incident lessons for designing better APIs by coolgoose on Wednesday February 05, 2025 @04:37PM (#42955554)
I am curious why bcrypt was used for hashing in the first place and not something like sha-512

Is there a reason I might be missing?

Re:Okta Bcrypt incident lessons for designing better APIs by stavros on Wednesday February 05, 2025 @04:41PM (#42955603)
Yes, the hashed payload contained a password, so presumably they didn't want to just SHA it.
Re:Okta Bcrypt incident lessons for designing better APIs by tptacek on Wednesday February 05, 2025 @04:59PM (#42955858)
Begs the question of why the payload contained a password, right?
Re:Okta Bcrypt incident lessons for designing better APIs by benmmurphy on Wednesday February 05, 2025 @06:59PM (#42957165)
They wanted the cache entry to be invalidated when the password changed. Just using username as the key and storing the bcrypt password inside the cache entry and checking the password on load seems like a better solution if it was possible.
Re:Okta Bcrypt incident lessons for designing better APIs by tveita on Wednesday February 05, 2025 @09:27PM (#42958274)
Storing the bcrypt password in the entry would make a dump of the cache almost as good as a dump of the password database. At least this way a dump of the cache makes the key opaque and requires you to guess both the username/id and password together, assuming they're not repeated in the cache value.

According to the security advisory this cache was for AD/LDAP delegated authentication, so they don't have their own password database with a version field or similar for sensible invalidation.

I guess the requirements could be something like:

  - different username/password combinations must have separately cached results

  - mitigate a potential data leak by putting all the entropy we have available together with the password material and using a slow password hashing function
Re:Okta Bcrypt incident lessons for designing better APIs by coolgoose on Wednesday February 05, 2025 @04:56PM (#42955830)
But why not bcrypt the password, but sha the cache key on top?
Re:Okta Bcrypt incident lessons for designing better APIs by stavros on Wednesday February 05, 2025 @04:58PM (#42955853)
I guess because they didn't anticipate this flaw.
Re:Okta Bcrypt incident lessons for designing better APIs by masklinn on Wednesday February 05, 2025 @05:03PM (#42955921)
Also prehashing opens you up to an other bcrypt flaw you need to be aware of: it stops at the first NUL byte, so you need to use some sort of binary-to-text encoding on top of the hash to ensure you don't have any of those in the data you ultimately hand off to bcrypt.
Re:Okta Bcrypt incident lessons for designing better APIs by Dylan16807 on Wednesday February 05, 2025 @05:25PM (#42956191)
It's astounding how bad the default API for Bcrypt is.
Re:Okta Bcrypt incident lessons for designing better APIs by coolgoose on Wednesday February 05, 2025 @05:18PM (#42956105)
Thank you
Re:Okta Bcrypt incident lessons for designing better APIs by n0rdy on Wednesday February 05, 2025 @04:43PM (#42955637)
There is a discussion about that on the security stackexchange (https://security.stackexchange.com/questions/133239/what-is-...). The TLDR:

> SHA-2 family of hashes was designed to be fast. BCrypt was designed to be slow.

Slow == harder to brute-force == more secure.

Re:Okta Bcrypt incident lessons for designing better APIs by progmetaldev on Wednesday February 05, 2025 @05:53PM (#42956525)
Yes, and you can increase the work factor to make it slower to generate, specifically to fight against brute-force.
Re:Okta Bcrypt incident lessons for designing better APIs by Zamicol on Thursday February 06, 2025 @04:29AM (#42960657)
Password hash functions are designed to be slow, are designed to be use with salts, and may have low entropy inputs.

Hash functions themselves are general purpose and don't protect against low entropy inputs (low entropy passwords). They also don't protect against rainbow tables (pre-calculated digests for common or popular passwords). For password hashing you want something slow and something with unique entropy for each user's password to prevent rainbow attacks.

It doesn't solve the problem of weak passwords, but it's the best that can be done with weak passwords. The only improvement is to enforce strong passwords.