4 ms·
Possibly OT, but a security story/rant all the same. I worked on a project where web session information was managed by a java/php dance. PHP serving the fron
by mgkimsal 14y ago
Possibly OT, but a security story/rant all the same. I worked on a project where web session information was managed by a java/php dance. PHP serving the front end would ask a Java web service for a session token (or pass a session token in to validate it). The Java web service would generate a new session token by add a row to a database and returning a string of characters. The string of characters was the auto increment ID of the database row, encrypted with a key. When the Java web service got the token again, it would decrypt it to see if it matched a valid row ID in the database. The token was sent down in a web cookie.
I was then asked to also use this same 'session management' approach on something with far more sensitive financial information (the original use case was arguably already something sensitive, although not directly tied to financial records). I refused, and explained why. I was told I didn't understand security. I suggested tying the row to a random ID and using that. I was told that 'random generators aren't really random - you need to understand how computers and processors work to know that'. It took me 5 months from when I first brought this up as a security concern to someone above me actually understanding the problem - not necessarily agreeing with my conclusion that it was unsafe, but at least understanding why it could be unsafe. BTW, none of my nominal colleagues took it - or me - seriously - cause after all, I only did PHP - it doesn't even have threads (that was an actual quote from someone).
The problem was if someone managed to decrypt the cookie value, they'd immediately see it was a number like 109826374. Trying again a few minutes later, they'd see 109826379, etc. Yes, potentially hard to decrypt in the first place (or to know that it was encrypted), but if done, devastatingly easy to assume another identity.
I was continually told I didn't understand web security, or computers, or programming, because I was new to the company, and developers far more senior than me had developed this (at this point I'd been doing web development for almost 8 years, and had already made my fair share of stupid/dumb security mistakes, so I recognized this one instantly).
Finally someone 'got' it when I pointed out that dozens of people had come and gone, had access to the code, but more importantly, had had access to the encryption key. It hadn't been changed. Ever. I asked how they could ensure that people weren't already using that key to decrypt and take over accounts - there'd be no way they could actually identify if that was even happening. I think the immediate answer was to plan to rotate the encryption key on a regular basis, but I left soon after that (for more reasons than just this, but this was illustrative of how I was interacting with the place). Having values in a cookie that are tied to directly manipulatable database values simply isn't a good idea, even if the cookie is encrypted, and you certainly wouldn't want financial records stored with this as the primary (only?) means of security.
Was some of the failure my fault? Possibly. I may have come across as arrogant, or 'know it all', or whatever. I'd sent detailed tech emails to people outlining the issue. I'd had friendly lunch conversations. I'd demonstrated how it was possible. Nothing worked. And that was frustrating, and led me to coin my own phrase - "It doesn't matter what you say, it matters how you're seen when you say it".
- alexchamberlain 14y agoWhat would you do differently? I'm starting a Grad job soon; what should I do if I think I find such a problem?
- mgkimsal 14y agoI've asked myself that a lot over the years. A friend of mine started there several years ago with me, took a different path, and is still there, as a senior dev/tech/depthead/something (a tech bigwig). I just don't think I was cut out to play/work in such a large organization (even though it means missing out on a lot of the financial perks that come with that sort of employment). I might try to go up the chain a bit higher faster than I did. I tried to play along with following the standard 'chain of command' (as best as I could find). However, I took the opposite approach with another problem I found (it wasn't just me - when I showed it to other people they basically agreed it was an operational problem too - made us look bad to potential customers). I went to the top (as he invited dialogue) but it quickly became a bit of a hooha that was never adequately resolved - I'd rocked the boat, was threatened vaguely (not physically, just with dismissal) by a senior company officer, and apparently became a marked man because of that. So... I guess in retrospect, I'm not sure what I'd do differently. Not work at a large company? I don't want to swear off them entirely - never say never and all that - but there's far more politics involved in working at large companies (well, the couple I've been at or seen inside) than I was comfortable (capable of?) dealing with. You'll need to find out what your work style is - do you enjoy working on teams? Or do you prefer to work solo? I don't mind teams, but need to have more autonomy/control when the time calls for it, and I've never been in that situation. It's made all the more frustrating when you have 'corporate HR' stuff telling you to 'take ownership of a problem', and 'take responsibility for things'. Fine, but when I have no authority over any resources to make that happen, it ends up just being a 'take the blame for other peoples' crap' sort of situation. I've been self-employed for the past several years, and while I'd like to do something else eventually, I enjoy probably 80% of what I'm doing now, instead of, say, 40-50% at traditional 'employement' situations. Again - never say never - I may work for someone else again in a traditional capacity, but it'd have to offer something more/different than what I have now. I'm at mgkimsal@gmail.com if you have more questions :)