Top 15 Free SQL Injection Scanners 103
J.R writes "The Security-Hacks blog has a summary of the 15 best free SQL Injection scanners, with links to download and a little information about each one. The list is intended asan aid for both web application developers and professional security auditors."
asian aid (Score:2, Funny)
Ok, so that covers China and Japan, but what about Europe and the U.S.?
Re: (Score:1)
Why is this needed at all? (Score:5, Insightful)
I suppose the over-use of PHP (which for a long time didn't even support prepared statements (does it even do it today?)) combined with stupid users that created the current situation.
Re: (Score:2, Informative)
Re: (Score:2, Insightful)
Non Issue (Score:2)
2. The upgrade from 4 to 5 CAN be quite painful if you've done a lot of OOP coding in PHP4. Nearly all of the upgrade was focused on increasing and improving OO support. Some of the changes made (like, for example, constructor naming) are backwards compatible, but most aren't.
3. This is all moot because you don't HAVE to use the Circa-php4 mysql extension, anywa
Re: (Score:2)
Re: (Score:2, Insightful)
Re:Why is this needed at all? (Score:5, Informative)
The result being that SQL injection is only one forgotten function call away.
Re: (Score:3, Insightful)
The result being that SQL injection is only one forgotten function call away.
I agree. I actually find it easier to use the call with parameters, rather than trying patch together a string. Putting in the "?" parameters in the string, and listing them afterwards, pretty damn simple. I'm amazed SQL injection is an issue at all. I guess there's a lot scarier programming out the
Re: (Score:2, Insightful)
1) the string concatation technique being present in several pretty popular (and awful) PHP books, and (afai remember) in the PHP documentation itself, thus becoming defacto "standard";
2) The general ignorance of a significant part of PHP developers of any database abstraction layers and in fact anything but the magic LAMP.
Re: (Score:1)
Personally, I like either of these two case (syntax off the top of my head):
// Using PHP5's PDO
// Using native Postgres calls (ADOdb does this internally)
$stmt = $pdo->prepare('SELECT f1, f2, f3 FROM foo WHERE x = ?');
$stmt->execute(array($x));
$stmt = pg_prepare('SELECT f1, f2, f3 FROM foo WHERE x = $1');
pg_execute($stmt, array($x));
However, there are cases where prepared statements are insufficient, though they are certainly not mainstream. You can't prepare an incomplete statement. I
Re: (Score:2)
Re: (Score:2)
For a security audit of an existing code base! Or are you willing to hire someone to browse code in a month time?
Re: (Score:1)
Re:Why is this needed at all? (Score:5, Insightful)
Re: (Score:2, Insightful)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
The same thing (shooting yourself in the foot) could be said, nay, SCREAMED, about C.
Absolutely. Did I say that C was a good learning language? The reason that I didn't mention C was because this is a thread about PHP, and because this is a story about SQL injection where one of the most common interfaces to the database is (wait for it)..... PHP.
And if you'll note, I alluded to the fact that you could learn proper programming practices with any language, however that requires learning aids which mention them. In schools, this is sometimes the case. In books, it's much less so. Withou
Re: (Score:2)
Re: (Score:2)
Re:Why is this needed at all? (Score:4, Insightful)
Re: (Score:2)
Uhm, if you use PHP then you *can't* cache your prepared statements (unless you do the same query many times in the same PHP run, but that's unlikely). PHP is stateless, after one run it frees everything.
"but if you prepare the statement once and execute it many times, the local overhead becomes minimal and the execution time in the database improves because the DB doesn't have to re-parse and re-plan the query."
In theory, yes. But are there
Re: (Score:1)
Re: (Score:3, Insightful)
Note that this all depends on the database and the driver, as some databases do not cache query plans or the driver does not properly coordinate the query plan with the database.
There is no s
Re: (Score:1)
Re: (Score:2)
The availability of robust packages like those still doesn't stop newbie (and veteran) PHP programmers alike from just using the raw MySQL API subset known as the mysql_* functions (which were deprecated in favour of the newer MySQLi [php.net] functions/objects that also support prepared statements) along with occasional use of adds
Re: (Score:1)
I'm a veteran PHP programmer, and I've worked in a dedicated Postgres environment (we were more likely to switch our scripting language from PHP to Python than our database from Postgres to anything). We used PEAR::DB, and frankly, I think it sucked. It didn't support modern Postgres features at all (including using addslashes
Re:Why is this needed at all? (Score:4, Interesting)
Actually, that is not true, as it ignores one problem: bugs in the database drivers. Seriously, there have been bugs in database drivers that have enabled SQL injection... I specifically remember a bug in the PostgreSQL JDBC driver [postgresql.org] a while back.
I also remember seeing a JDBC driver that simply inserted arguments into the string containing the SQL statement, although I fail to remember exactly which driver that was. This was a while back, mind you, so hopefully errors like that have been fixed.
Until I encountered these things, I believed that positional arguments was the silver bullet. The point here is that positional arguements in itself is no guarantee, it is only a part of an API. At some point you have to trust the developers of the database driver and the database itself, of course...
Re: (Score:2)
Re: (Score:1)
Re: (Score:2)
Another way that I like, is (for DBMS that supports it) pass as a parameter an XML document with (if i'm paranoid) a schema, then pivot it as a table, and use the IN on that. Works pretty good.
Re: (Score:3, Interesting)
If you just make sure you always use prepared SQL statements with positional arguments, you will never have any problems with SQL injection.
Well, prepared statements have their own shortcomings -- they're not the magic bullet to solve all our DB issues. Some would have you believe they are, but don't be fooled.
I suppose the over-use of PHP (which for a long time didn't even support prepared statements (does it even do it today?)) combined with stupid users that created the current situation.
IIRC
Re: (Score:2)
Let's take an example: http://viewcvs.php.net/viewvc.cgi/php-src/ext/oci8
The problem is more with this database named after a child, which didn't support any of the advanced features for years.
Alternatives (Score:2, Interesting)
That said, there are times - and this is one of them - that I'm glad my recently most common database isn't fundamentally SQL, or anything well-recognized. It also helps that (I believe) mnesia is immune to injection [erlang.org], given that its queries are never textual, but rather always functional, and given that data are always presented as arguments. Every route to injection I'm aware of just doesn't make sense in context (though if someone knows a way attack Mnesi
Detecting SQL Injection is hard ... (Score:5, Insightful)
The feedback factor for SQL Injection is very low. It is very hard to generically detect the after-effects of a successful sql-injection attack.
In comparison, something like XSS is easy because if you inject a string, the string re-appears in the HTML returned (HTML injection). The XSRF and XSS attacks dominate the internet attacks because they are really easy to scan for - though technically that should be an excellent reason they shouldn't exist :)
Rasmus Lerdorf has this awesome test-tool for XSS he keeps demo'ing (thankfully not released). You can see the tool in action [flickr.com] in the background. But there's still no real easy way to reliably scan for Sql injection.
Re: (Score:1)
No need to click - it is easy to steal cookies and other information by injecting an img tag with onload=...
Re: (Score:3, Insightful)
Re: (Score:1)
Actually, it [php.net]'s been released for a while now.
Re: (Score:2)
what exactly is an sql injection? (Score:3, Interesting)
ain't there query parameters in practically all database access APIs?
Re:what exactly is an sql injection? (Score:4, Informative)
e.g.
'select * from employees where fullName like ' + mySQLInjectedInputFromUser
where mySQLInjectedInputFromUser has been asssigned a value entered by the user:-
Fred Flinstone; GO; delete employees; GO
Re: (Score:2)
Yep. And that's why you should use parameters instead of dynamically creating SQL commands as string. Not like this (C# .NET):
But like this (C# .NET):
Lousy example, I know. A lot of languages and/or frameworks sup
Re: (Score:2)
Re: (Score:1)
Re: (Score:2)
Wikipedia is your friend (Score:2)
Re: (Score:2)
www.php.net/pdo
Re: (Score:2)
this:
st = api.createStatement('select * from employees where fullName like ' + mySQLInjectedInputFromUser);
st.execute
take more time to write than this:
st = api.createStatement('select * from employees where fullName like ?' )
st.execute(mySQLInjectedInputFromUser);
Re: (Score:3, Insightful)
Properly written software... (Score:2)
Re: (Score:2)
Why go through the faff of stored procedures whn you can just use parameterized queries? As far as I know, you need to have access to the db server to create/edit stored procs, and also, afaik, there's no way to use a source code control system on them.
Because a parameterized query sits in the code, you don't have to touch the db server if you want to do a code update.
Re: (Score:2)
Not using stored procs at all in your application is typically done by novice developers, it is not how an experienced professional works with a database.
Re: (Score:3, Insightful)
Which I'm sure is fabulous if you're using .NET and MSSQL. However, I imagine that particular combination doesn't make up a very large percentage of all the database applications out there.
Don't get me wrong, stored procs are a useful tool which are the correct answer to some types of problem. But completely overkill if you just need simple or even slightly complicated CRUD operations. Using stored procs when they're not really necessary is the mark of a developer who doesn't know how to use every tool in
Re: (Score:2)
*sigh* I don't know what I was thinki
Re: (Score:2)
Most database engines also apply the exact same techniques to plain text queries. If the plain text queries are parameterized, then it works even better.
All Visual Studio gives you is a nice environment in which to extract sql scripts and check them into source control
Visual Studio also give you powerful tools to build parameterized queries and wraps t
Re: (Score:2)
Here's the arguments I would make for stored procs.
Most database engines also apply the exact same techniques to plain text queries. If the plain text queries are parameterized, then it works even better
Database engines more often than not will generate a whole new execution plan for plain text queries, it can also cause the execution plan cache to fill up more quickly, plus it opens you up to s
Re: (Score:2)
No, it doesn't. That's the false dichotomy that sp supporters like to espouse. A poorly called sp is vulnerable to SQL injection, while a well written, properly called ad-hoc query is not vulnerable. Just using a stored procedure does not protect you from SQL injection and just avoiding them does not make you vulnerable to it. I just worked up a real quick ad-hoc paraeterized SQLCommand in Visual Studio and here is what SQL Profiler shows me is really executing;
Re: (Score:2)
Re: (Score:2)
I'm sorry, but if you think that stored procedures are the be-all and end-all to db query security, then it would appear that you don't have a clue.
It is perfectly possible to write secure code without using stored procedures. It might be more difficult, in some cases, but not impossible.
Re: (Score:2)
Riiight...
Well the biggest clue I have about security is that you build it into every tier of your architecture. Sticking security in one place is not a security architecture, well OK it might be, but as far as security architecture goes it sux.
Re: (Score:2)
Re: (Score:2)
One of the database engine thats the most used in tandem with Visual Studio, does NOT. In SQL Server, the execution plan is not pre-prepared. Its made at runtime, and cached. What does that mean? That dynamic sql (using prepared statements ONLY!), and stored procedures, have the same performance advantage, so that argument falls flat. I know not
Re: (Score:2)
At the end of the day I find in just about every enterprise app there is at least one feature that requires a complex set of T-SQL instructions to be executed that have definite performance benefits when executed within a stored proc as opposed to parameterised queries executed from source code.
So for consistency and extensibility I always st
Re: (Score:2)
And there is NOOOOOOOOTHING you can do in a SP that you can't do in a param query. Nothing. None. ZERO. The only performance benefit you'll get is the bandwidth (if you run a long query 1000000 times in a row, its a lot of data going).
The rest is a decent argument, but one that only holds water in simple applications. In complex enterprise apps, you have a billion datasources. Probably
Re: (Score:2)
http://msdn2.microsoft.com/en-us/library/aa174792 ( SQL.80).aspx [microsoft.com]
Re: (Score:2)
That means conditionals, loops, temporary tables, transactions, you
Re: (Score:2)
I have faith that stored procs are actually going to win if only by the barest margin simply because there's an obvious reduction in network traffic for large complex queries. Plus I have faith that
Re: (Score:2)
Re: (Score:1)
Re: (Score:3, Insightful)
Now I am not saying this doesnt need an upgrade (currently in the works), but when you are talking about a mission critical app that is already m
Re: (Score:2)
I don't go round re-writting everything just for the sake of making it mine. In the real world you evaluate every application on a case by case basis. In the real world it is very often the case that the time required to add new features or fix existing
Re: (Score:2)
Good for you, I used to do nothing but create new code in my last job.
Nowadays I work in collaberation with serveral other developers and we all maintain each others code. Since I started I have learnt far more than I ever did when I only worked on designing my own projects from scratch. I also find it far more challenging and hence more rewa
Re: (Score:2)
My comment was obviously meant with humour. I collaborate with other developers all the time. I even go to user group meetings to get exposure to as many alternate views on development as possible.
And like most developers I prefer to work with new or next generation technology rather than working within the confines of some sort of time bubble from 10 years back due to the restrictions of some legacy system's architecture.
Re: (Score:2)
The truly secure methods are:
1) Use stored procedure, with no dynamic sql whatsoever.
2) Use prepared statements: this make dynamic sql just as secure as stored procedure, and in the more advanced RDBMS, allows query plan to be cached (aka: it is virtually exactly as fast as stored procedures. SPs being used for performance reasons is a myth folks, at least with the better RDBMSs)
3
Re: (Score:2)
Re: (Score:1)
Testing slashdot (Score:5, Funny)
Top 15 _______? (Score:3, Insightful)
What is this, Digg?
Re: (Score:2)
Validating Input (Score:2, Informative)
One of the best SQL injection attacks I've seen... (Score:5, Informative)
I was able to change an innocuous 'select
This was nicely reported back to me as a SQL error stating that SQL was unable to convert "sdfsdfsdfsdf" into an integer, where "sdfsdfsdfsdf" was user id 1's password. I reported the problem to the site's owners, and it was still a month before they fixed it.
Moral of story - don't show the users any SQL errors, it gives them far too much information.
Re:One of the best SQL injection attacks I've seen (Score:1)
What do you mean by 'too much information'? Security through obscurity [wikipedia.org]?
do they check cookies? (Score:3, Insightful)
intresting (Score:1)
Bwah (Score:2)