Live data from Hacker News

How not to protect against SQL injection (view source)

cadw.wales.gov.uk

121–125 of 125 posts

Re: How not to protect against SQL injection (view source)

#121
post #13

The saddest part is that tons of people will be reading this thinking that they're way smarter than that guy, while in fact their sites are wide open to exploitation as well. That last statement probably applies to me too. Doing web security well is hard, too hard. Everyone gets caught with a security bug sooner or later, even google. It's easy to laugh with silly coding like this, but I blame the technology for allo…

Web security is hard, but I don't think its unreasonable to expect that someone you hire understands the basics of how to make a form submission secure, if they don't perhaps they should be flipping burgers instead. There is just no excuse for something so sloppy. As for SQL being a "bad API" that might be one of the more ridiculous comments I have heard.

About this case specifically, you're right. This person wrote some dumb code. However...

It is indeed unreasonable to expect a junior developer to make form submission secure. Aside from SQL injection there's DoS, MiTM, CSRF, XSS, session fixation, cache poisoning, clickjacking, timing attacks (to detect valid vs invalid values), rainbow table attacks, and many more. Just go through the list of requirements in OWASP ASVS. It's intimidating how much stuff there is to keep track of. We have a dedicated security engineer on our team who reviews all new code, out of necessity.

Also, about SQL being a bad API, I didn't say it was a bad API in general, just bad for the web. SQL is like eval(), it evaluates code from a parsed string. If eval() is bad for the web, SQL is just as bad.

Re: How not to protect against SQL injection (view source)

#122
post #121

Earlier quoted context omitted.

Web security is hard, but I don't think its unreasonable to expect that someone you hire understands the basics of how to make a form submission secure, if they don't perhaps they should be flipping burgers instead. There is just no excuse for something so sloppy. As for SQL being a "bad API" that might be one of the more ridiculous comments I have heard.

About this case specifically, you're right. This person wrote some dumb code. However... It is indeed unreasonable to expect a junior developer to make form submission secure. Aside from SQL injection there's DoS, MiTM, CSRF, XSS, session fixation, cache poisoning, clickjacking, timing attacks (to detect valid vs invalid values), rainbow table attacks, and many more. Just go through the list of requirements in OWASP…

If indeed it was a junior developer then where was the supervision? I take your point on SQL though.

Re: How not to protect against SQL injection (view source)

#123
post #99
post #74

Earlier quoted context omitted.

No offense, but I think you're a tad paranoid. If I was a mechanic and I saw someone at a gasstation driving a car that was obviously dangerous because of some kind of bad fixup I would tell him. This is no different, and I don't expect anyone to sue me for that. Here's the mail I sent: Hi there, It appears that you have some pretty severe security problems on your site. This is a heads up so you can get it fixed. I…

I sent a email when i saw it too.

Actually got a thank you email back yesterday, them seemed pleased :-) See what they did there america? You don't have to sue everyone.

Re: How not to protect against SQL injection (view source)

#124
post #74

Earlier quoted context omitted.

No offense, but I think you're a tad paranoid. If I was a mechanic and I saw someone at a gasstation driving a car that was obviously dangerous because of some kind of bad fixup I would tell him. This is no different, and I don't expect anyone to sue me for that. Here's the mail I sent: Hi there, It appears that you have some pretty severe security problems on your site. This is a heads up so you can get it fixed. I…

I wouldn't say they were paranoid. A few months back I showed a colleague what looked like the openings of a very serious data leak in a major company's site. He investigated further and then reported it up through the chain of command and then over to the company. At no point did he do anything other than what was done here, as in point out a publicly visible security flaw. He was nearly fired after the company thre…

I would go find a new employer if that was the case, what bunch of idiots.

Re: How not to protect against SQL injection (view source)

#125
post #74

Earlier quoted context omitted.

No offense, but I think you're a tad paranoid. If I was a mechanic and I saw someone at a gasstation driving a car that was obviously dangerous because of some kind of bad fixup I would tell him. This is no different, and I don't expect anyone to sue me for that. Here's the mail I sent: Hi there, It appears that you have some pretty severe security problems on your site. This is a heads up so you can get it fixed. I…

I've got $10 riding on "they see the word Hacker in 'Hacker News' and start freaking out". :D Oh, I understand the word hacker in all its culturally and context relevant forms, and you understand the word hacker, but they do not understand the word hacker. :-(

I think he deftly smoothed that potential problem over with the statement in parenthesis, as well as mentioning how it was posted in reddit.
Post reply on HN