Last poster before threadlock gets a cookie (cookie thread (Part 7)) (Part 11)

Ngl I wrote a new application at work that (among other responsibilities) is going to take over the password authentication of customer accounts, and it sucked because I wanted it to Not Suck. And while I think there are still like theoretical timing attack vectors (according to ChatGPT’s Astra anyway, but Claude thought it was fine and I’m too busy with this whole other mission critical application we desperately needed to rewrite 5 years ago to look at a Schrodinger’s security flaw the girls are fighting over in an app that’s still not in production because of a chain of stupid and/or horrifying decisions made by departments that are not mine that I neither want nor should get into), it’s way fucking better than what’s currently which is what I will say is not awful, it certainly falls short of many a best practice. I also learned that most places are not following all the best practices and I would guess that it being Really Fucking Hard is a big reason why.

So, like, a recommended step is Unicode normalization (specifically NFC I believe) because it can prevent situations where a user is inputting what is essentially the same string of text but for reasons that are not their fault and practically impossible for them to understand or predict, it is not the same set of bytes originally used to generate the password hash which then causes it to not authenticate. That’s relatively simple to do though in my nice greenfield application except oh yeah I have a bunch of fucking existing hashes I must maintain compatibility for and they weren’t normalized. For that and a number of other reasons, it maintains support for all the existing password hashes and can do so in a way that won’t break anything as we transition over to using the new authentication system completely while also having all of the machinery necessary that we can flip a switch and have it silently start rehashing any password using an old hash when a user authenticatss with one. That sounds really nice in theory too, but it resulted in some ugly fucking code and interfaces that are going to be there forever unless we decide to invalidate all the old hashes at some point.

Also I’m becoming too fucking aware that the length of a string as far as computer programming goes is a situation where you really need to be specific and make sure that everything agrees. I’m actually pretty sure I fucked this up in one area and need to go back and fix it eventually. Password length for example you want it to be the length of the string in characters but in Golang, the len() function returns the number of bytes in a string. So, you have to do type conversions to make sure length is actually characters. I thought, naively, that the length of a VARCHAR column in MySQL. Like idk a lot of column widths are defined in terms of bytes (or even bits!), so I just assumed that like varchar(255) capped the length at 255 bytes. Nope, it’s also characters. Hashing algorithms, however, do care about the length of the input in bytes. Bcrypt (widely used algorithm) has a maximum length of 72 bytes. PBKDF2 (the one used by Discourse) seemingly doesn’t, but it seems like some libraries did implement limits because you could effectively DDoS a site using it by making it perform the computationally expensive hashing algorithm on a super long string. Argon2 is similar, but the implementations I’ve seen tend to leave maximum input size as an exercise for the programmer to sort out. I’m getting off topic. Point is I was needing to check that the length was valid in terms of characters in at least 3 different contexts and the length in bytes in at least one. And it wouldn’t surprise me if I subtly fucked that up somewhere along the way. Like I’m not sure if it’s validating the length of normalized or unnormalized secrets and I’m pretty sure normalization can affect the length. Also that validation happens before it knows what hashing algorithm it needs to use, but… I think with how we plan to use it we just need to make sure it checks lengths in the way the desired hashing algorithm wants because that’s what it’ll inevitably be hashed with. Remember when I said this was complicated?

Oh yeah also just fucking handling passwords securely inside your own application is a nightmare. You want to make sure they’re not logged or thrown into errors or stack traces or core dumps as much as is reasonably possible, but because there’s no existing type will essentially redact itself automatically, I had to make one. But I’m neither stupid nor ambitious enough to write my own cryptography package which means that I inevitably have to pass a secret into a built-in type so there are like microseconds where it could hypothetically be exposed if the exact wrong thing happened at the wrong time. Thankfully that’s not a viable attack vector really unless an attacker already has access to the application host machine which is game over anyway. I do still try to minimize even the risk of that happening I guess. (Although I’m also remembering instances now where I forgot to zero out the bytes after using the secret for the last time but fucking whatever I’ll get to that eventually probably). Did I mention this was complicated?

5 Likes

you mfs keep doing it! Including people whose names I know. Thats right including you josh h abravanel

5 Likes

stop being paranoid it makes me want to do it more

3 Likes

Ya know I get the impulse to use your full legal name because of how brazenly you used to share it and it’s funny to be so open about it when most people tend to keep at least their last names somewhat private. Like wow Marissa showed her license on a Livestream one time lol! But then I remember I believe that we shouldn’t be eternally punished for dumb shit we did when we were 15 which is my way of saying that I’ll pretend like I’ve forgotten it going forward.

6 Likes

it was a better bit when it wasn’t actually my legal name but it is now

3 Likes

when I was like 13 or 14 I saw a password tip that was like “include an accented letter in your password! it’ll be super easy for you to remember, and it’s really unlikely your password will be cracked by a dictionary attack!” so I changed my throwaway-fake-email-for-signing-up-for-things password to have an accented letter and then it just. Wouldn’t let me log in. No matter how many ways I tried to put in the letter

8 Likes

Oh right they changed the announcer sounds in the menu

Just thinking about carrying out this gave me whiplash
It’s not even the fun part of computing it’s just tedious

I sort of cannot believe this actually happened to someone I know lol. I thought it had to be an incredibly rare issue especially in the English speaking world

It’s both incredibly tedious and incredibly important. The worst combination.

1 Like

I was talking to my dad about your optimization post. He had mentioned the last time he was forced to do optimization (but he still does it) was… Java 1.6 - lol!

it is theoretically possible the issue was ‘accidentally put in the wrong kind of accented e when I made the password’ rather than a hash issue, I don’t think so but given how long ago it was I’m not 100% confident in my recollection of how I set up the password

Is it just me, or is the site a bit laggy at the moment?

You’re still free?

Oh she’s amazing, she’s really versatile than the other heroes. You can be heavy damager if you get toxic bullets and ricochet and you also have to balance her spirit cuz she heals miraculously within 10-20s on max leech stacks

you don’t have school?

Wow she has standards too, she clearly won’t have an iilluminaughtii style downfall

I don’t have school but I do need to go to a law firm cabinet with this very awesome assistant professor and also hope my hair isn’t too oily today

you know you can take active actions against your hair being oily

Not really, it’s too late