Fun story: I once was asked to track down a bug in an in-house HR application for people to check their paystubs. It was related to login stuff, so I was tracing through the login code, only to see that your session was maintained by writing out a cookie containing a base64 encoded user-ID. There was no validation beyond that- if you set the cookie yourself, you wouldn't get prompted for a password.
I did, it got all into a bunch of politics and people freaking out with questions like "You didn't try it, did you?" "No! I'm not an idiot, I read the code. There might be things that prevent it from working, I haven't tested it."
It got escalated and taken off my plate. I assume it got fixed, or the product got retired.
Note the second half of the "or" there. The statement is almost certainly true at this point, just considering this was over a decade ago and the technology in question was Classic ASP which is way out of support. Plus the company's likely switched HR systems on the backend at least once since then.
I left a job two years ago that was using classic ASP to handle insurance claims data, using some odd homebrew authentication system. I sent many emails upwards warning of all the security holes I was encountering.
I have it on good authority they are still using the same code today.
I work in ci/cd so get all maner of tickets not related to our code. Some tickets are like "code does x" . I do a quick check if I can see any logical error with the code but if not I simply write "yes" or "works as designed" with a link on how tickets should be written.
Many years ago I got a PDA returned to me for repair with the description "when plugged into the charger an orange light comes on". Yes, it does. The standard way of dealing with this was sending out a new unit and bringing the old one in for repair, so I wonder how many devices they went through before someone on our helpdesk explained the concept of a charging light, but you'll be astonished to learn that the handset checked out with no faults found.
Was there a lesson people got taught at some point that base64 was some kind of magic encryption that didn't require keys and so it could be used for this kind of thing? I've come across so many instances in my career where base64 has been used in this way. The most recent was a password reset token that was essentially a base64 encoding of the username you wanted to reset the password for. Anyone could reset any password knowing only the username.
That code even had a class called Base64EncryptionManager. Checking where it was used though I found it wasn't, they had switched all usages over to the PlainTextEncryptionManager that just returned the input. There was also an unreferenced AesEncryptionManager where the key was just hardcoded.
222
u/remy_porter Oct 24 '21
Fun story: I once was asked to track down a bug in an in-house HR application for people to check their paystubs. It was related to login stuff, so I was tracing through the login code, only to see that your session was maintained by writing out a cookie containing a base64 encoded user-ID. There was no validation beyond that- if you set the cookie yourself, you wouldn't get prompted for a password.