Forum Moderators: open
Microsoft has denied any blame for a rash of web server attacks that have affected half a million web pages.
Speaking on The Microsoft Security blog, the company moved swiftly to refute suggestions that vulnerabilities in its SQL Server software were being exploited in the attacks.
"Microsoft's investigation has shown that there are no new or unknown vulnerabilities being exploited," says Bill Sisk, of the Microsoft Security Response Center.
No New IIS Or Microsoft SQL Server Vulnerabilities, Despite Claims [pcpro.co.uk]
Microsoft Security Response Center (MSRC) [blogs.technet.com]
Even well respected articles on how to prevent ASP SQL injection are still vulnerable because they only rely on basic matching, they do not seem to unescape anything. This is useful since it is possible to hex encode the statement (as this attack does). PHP provides a common escaping function so fewer people roll their own broken implementations.
[sitepoint.com...]
I do not think the recommendations would prevent against this attack (except limiting privileges), correct me if I am wrong.
Obviously it is recommended to use prepared statements but there are some times where this is not possible, plus it is easier for new users to build sql statements.
This WAS Microsofts problem but they ignored it for so long that it is now an app developers problem.
What I don't understand is why the security firms/Internet watchdogs don't shut down these domains where the scripts are being hosted?
What really surprised me during the telcon was this statement...
"Edward, if there are any SQL statements on the page, you are susceptible to the SQL injection attack. You cannot use SQL statements on the page, they must be Stored Procedures."
I then asked him why people do the on page SQL stuff to begin with and he said because it is the "easy way". The year is 2008 and the "easy way" is no longer an option. Security is of the utmost concern and "everything" needs to be locked down. We're currently in the process of doing a review and seeing where we can lock things down further. I did find a few pages with SQL statements here and there. Those will be addressed immediately.
What did I gather from the telcon? If you are using SQL Statements on any of your pages, you're at risk for the SQL injection attack.
What percentage of programmers and/or database administrators are using SQL Statements on page? I think the numbers are much, much higher than we might expect.
This is as the attack only needs a logon to be made into a database then it is creating its own statement which is executed.
I have no exact answer, except for withdrawing permissions on as many tables as possible. Several large corporates have already been caught - and i am sure they have more resources than we do.
Even if you check data from forms this attack is in binary data format so checking strings for words like UPDATE etc will not catch this little critter.
IMHO of course
Even well respected articles on how to prevent ASP SQL injection are still vulnerable because they only rely on basic matching, they do not seem to unescape anything. This is useful since it is possible to hex encode the statement (as this attack does). PHP provides a common escaping function so fewer people roll their own broken implementations.
Believe me, it's a coding problem, not a language problem.
It is certainly a fault of the language that there is no proper escape function and way to stop this attack easily.
Here are some developers who wish there was a proper built in escape function.
[forums.iis.net...]
I see this is going to be a real problem with MS blaming the developers and developers looking to MS for a proper fix. The fixes listed on that forum are very easy to work around.
To really escape the input you need to pass the string to the actual program that will eventually escape it (ie MSSQL), anything else and you have two sets of code which are attempting to do the same thing.
Just blocking ; does not work either because sql servers often have a different EOL sequence (ie MySQL uses \g as well). There are many many ways to encode a string to hide what it actually is, I have seen exploits that use multibyte encoding to get around simple filters.
[aqtronix.com...]
Aqtronix Webknight basically blocks viruses, script kiddies, and SQL injections.
You also got URLScan & IIS Lockdown both supported by Microsoft themselves
[microsoft.com...]
[microsoft.com...]
You shouldnt use raw SQL code in web pages everyone knows that.
By the way, what input I accept is always run through a few regexes to remove unexpected data, then put through
mysql_real_escape_string() before I put it into my query.
So yes, basic good practices apply here too--if you MUST use embedded SQL statements, parameterize each and every variable before using it in the SQL statement. Otherwise, use stored procedures. In either case, use restricted logins that are only capable of doing what they absolutely must do--no need for your reporting system to have UPDATE, INSERT, or DELETE capabilities.