cdog
Perch
With all the posts on sql injections lately thought that this might be possibly handy
http://forums.asp.net/t/1254125.aspx
http://forums.asp.net/t/1254125.aspx
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
the javascript injection was being put into SQL DBs replacing data in tables with the javascript code just FYI antic![]()
Yes, my point though is that doesn't require T_SQL injection to do that. If your app stores any user-entered data in the db and later displays it as-is, that is the exact same risk as far as javascript hacks are concerned. So looking for T_SQL code isn't enough, you have to check for HTML too.
Displaying all user-entered data with Server.HTMLEncode prevents this from occurring, as any malicious HTML never gets parsed by the browser. If the infected web apps had done that one thing, no javascript would have been able to run.
There is an update posted at ISC's diary:
http://isc.sans.org/diary.html?storyid=4610
It has link to an asp function contributed by one of the readers there to help prevent injection.
As long you escape all single quotes, then they can inject DECLARE and "--" all they like, it's not going to work.
If the injection is '; drop table users; --
It will turn:
SELECT * FROM users WHERE username = ''; drop table users; -- mylogin' AND password = 'mypass'
(which causes the damage)
Into:
SELECT * FROM users WHERE username = '''; drop table users; -- mylogin' AND password = 'mypass'
Note the escaped quote ('') so no damage is done since the login name being checked simply turns into '; drop table users; -- mylogin (single quote, semicolon and hyphens just become part of the string)
But yeah.. bummer about the logs.There must be another way of patching into the ASP worker process.. I believe you can do it with .NET.
Anyway, does it matter if it changes the logs? It will only alter HTTP requests for the bad-listed domains, not every request that comes in.
Just another incentive for them to fix their app.![]()
no if you applied the ISAPI, it would BENEFIT them as in reduce their logs by 8x, we'd have some people faking sql injections to get it
Eh? Why would escaping single quotes in http requests reduce the log size by 8x?
And nobody would want their requests altered if they had a choice. For one thing it would stop CMS's from working properly as all <> tags would be removed from form POSTs.
oh not talking about escaping, the ISAPI would reduce it![]()
about POSTS, the sql injections are happening just as much from GET requests in very bad coding!
This looks like an interesting tool from MS:
Microsoft Source Code Analyzer for SQL Injection
http://www.microsoft.com/downloads/...6E-A599-4FCB-9AB4-A4334146B6BA&displaylang=en
Also the article Preventing SQL Injections in ASP
http://msdn.microsoft.com/en-us/library/cc676512.aspx