News for hackers. Stuff that matters.
Re:Three things to never build yourself: auth, notifications... by kelnos on Thursday May 13, 2021 @06:17PM (#27148191)
> You can say "well that's their fault for mucking with the input to bcrypt" but I bet most people would believe that kind of operation was safe before it's explained to them why it's not.

What makes you think this foolish developer would not do the exact same thing before sending the data to an externally hosted auth service?

Re:Three things to never build yourself: auth, notifications... by GormanFletcher on Thursday May 13, 2021 @06:45PM (#27148441)
The external auth service's API would receive textual input (expecting a string read from a textbox), not binary. A hash that included null bytes would output those in hex as ASCII zeroes, which wouldn't cause the same problem when the external service received the value.
Re:Three things to never build yourself: auth, notifications... by jlokier on Thursday May 13, 2021 @08:11PM (#27149119)
And that is, in fact, how you should perform a hash before bcrypt as well.

bcrypt accepts text input, not binary.

So if you use a pre-hash, you pass the hex or base64 output from the hash to bcrypt.