A few months ago I gave a presentation on SQL Injection to a group of developers. I talked about and demonstrated the hows and whys and gave some frightening examples of what can be done if your web application isn't secure.
A quick note to my non-technical readers.... SQL Injection is a technique that can be used to hack a website that doesn't do proper validation of user input. Its effects range from an error shown to the user, revealing data that should be hidden, deleting or changing data, all the way to gaining total control of a web server. In short, it's bad.
Anyway, back to the presentation. At the end of the talk I got a range of comments from "well duh" and "I can't believe you had to give that talk" to "oh shit! I had no idea". My feelings on it fall strongly in the "I can't believe I needed to give that talk" category. In this day and age, information about how to secure yourself against these sorts of attacks as well as how to exploit these holes are everywhere. A quick search of the net will tell you everything you need to know, so there really isn't ANY excuse for building web applications that are vulnerable to SQL injections. It's lazy and it's sloppy and if you're doing it, I'll go as far as saying you probably shouldn't get paid.
Unfortunately, there are developers who are still doing it.
Some of these people are just blissfully unaware, this means that they just lack the understanding of the tools they are using, and have not put any thought into what might happen if a user enters some data they aren't expecting. This also means that they are not honing their skills and keeping up to date by reading and researching. This stuff isn't new. An analogy might be a builder filling your walls with asbestos because he hasn't heard that the stuff could kill you. Would you find that acceptable ?
Others think that their tools do or should automatically protect them from their own stupidity. I've actually had a developer say to me "shouldn't Microsoft do that automatically ?". What the ??? That's up there with "It's not my job to test this code".
The other excuse I've heard is "what if it's not a high profile site ? It really doesn't matter". Well that's a great attitude! It doesn't need to be high profile, a lot of peoples personal details and data are stored in smaller sites. Not only that, but a compromised server can be used as a staging point to attack other sites with some anonymity.
The reason I bring this up today is that someone sent me a link to a site in "beta". We're experiencing a second bubble and starting to see lots of hype, and lots of high profile sites. This time around we also have bloggers linking to the latest hot property.
So anyway, I was sent a link to the site, with a note that some well known bloggers are involved in it, and it could be the next big thing. I had a quick look at the site, was pretty underwhelmed by it all, but I thought I'd kick a tyre or two. I dropped an apostrophe in the search box and bang! There I had, in all it's glory, an ASP.NET "yellow screen of death", complete with a full stack trace (debug builds in production) containing the dynamic SQL that had been executed. Fantastic. Had I been a malicious type (and I'm not), I could have caused all sorts of mischief. I'm not talking about using sophisticated "hacking tools" either, I'm talking about typing into a box on the website using nothing more than a browser. As an aside, I'm going to be responsible and let the people involved with the site know privately.
So I ask my fellow developers here, why is it, in the year 2006, that we are STILL seeing these mistakes being made ? Haven't we learned anything in the last 10 years ? Why are SQL Injection exploits still the most common attack vector on the net ?
This isn't Microsoft specific, or even closed source specific either, so don't drag out that tired argument. Every platform, and every language makes it possible to do this, and it happens on every one of them too.