3 ms·
Instead of making sure SQL injection is not possible at all by using proper stored procedures and other techniques, they just limit a few keywords and hope hack
by wkat4242 3y ago
Instead of making sure SQL injection is not possible at all by using proper stored procedures and other techniques, they just limit a few keywords and hope hackers don't come up with something that they haven't thought of like some escaping trick.
Yeah that would probably work for a while. Until someone proves it doesn't :P
It's not really rocket science anymore to make sure user input doesn't mix with your SQL. This is not 2005.
And really if this works in the first place you're storing the passwords unhashed which was even a dumb thing in 2005. If the same applies to the username or other user input fields it would make a bit more sense but passwords should never enter the database like that.
- jrockway 3y agoI think it was early 2005 when I wrote my first database app, and I didn't find it that hard to not mix user data with SQL. (I think I even ran my CGI script in "taint mode". Remember that!?)
- MathMonkeyMan 3y agoAt work, we were discussing how to serialize some structured data as an HTTP request header value. I reflexively said "ascii subset of JSON without newlines," but that was rejected for some reasons (maybe too much punctuation, verbose for Chinese...). Someone came up with pipe-separated fields, but then that was rejected too. The reason was something like "some customers used to have proxies that would reject any headers that include a pipe character." My point is that voodoo programming isn't always due to lack of due diligence. It's due to knowing that something went wrong with something in the past, but for which there is no evidence, and about which you would be able to do nothing. My preference is to deploy it anyway, see if it breaks, and if necessary work it out with the customer after the fact. That's unpopular for good and obvious reasons, so no pipe characters.
- hamburglar 3y agoYou realize, don’t you, that the fact that this made the front page tells us that you are explaining things that are obvious to this audience?
- wkat4242 3y agoOf course! I was being sarcastic :) It's ridiculous that this kind of thing still happens.
- dmurray 3y ago> And really if this works in the first place you're storing the passwords unhashed Not really, your RDBMS probably supports some hash functions so you could be storing them hashed as "UPDATE USERS SET PASSWORD = SHA2($PASSWORD)" which would be vulnerable to SQL injection yet does not store unhashed passwords. There are good reasons I'd recommend to do the hashing in the application layer instead, but doing it in the DB (with correctly parameterized queries, of course) is not so terrible.
- wkat4242 3y agoMaybe not terrible but certainly not great. It's best to keep confidential info exposed to as few components as possible.