Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,683 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,235 people online right now. Registration is fast and FREE... Join Now!




SQL Injection Affects Half Million Sites

 
Reply to this topicStart new topic

SQL Injection Affects Half Million Sites

skyhawk133
post 27 May, 2008 - 01:57 PM
Post #1


Head DIC Head

Group Icon
Joined: 17 Mar, 2001
Posts: 14,846



Thanked 45 times

Dream Kudos: 1650

Expert In: Web Development

My Contributions


There is a virus being spread through the use of SQL Injection. The SQL Injection inserts an iframe which loads a javascript on the visitors computer and infects the system. If you run a web site, you should look through your logs and traffic to see if there is anything abnormal.

2008-04-28 - No New IIS Or Microsoft SQL Server Vulnerabilities, Despite Claims
http://www.webmasterworld.com/microsoft_asp_net/3636835.htm

2008-04-28 - Half a million sites hit by huge web hack
http://www.techworld.com/security/news/ind...fm?newsid=12100

2008-05-15 - Phishing botnet turns to SQL-injection attack
http://www.techworld.com/security/news/ind...m?newsid=101510

2008-05-05 - Under Attack! Hacker attacked DB with link to virus
http://www.webmasterworld.com/microsoft_asp_net/3641891.htm

2007-11-19 - Avoiding SQL injection attacks without the need to replace words
http://www.webmasterworld.com/microsoft_asp_net/3509272.htm

How To: Protect From SQL Injection in ASP.NET
http://msdn.microsoft.com/en-us/library/ms998271.aspx

How To: Protect From Injection Attacks in ASP.NET
http://msdn.microsoft.com/en-us/library/bb355989.aspx

Anti-Cross Site Scripting Library
http://msdn.microsoft.com/en-us/security/aa973814.aspx


For those of you running an Apache/Linux box, I would HIGHLY recommend installing mod_security with the latest rules.

For the rest of you... fix your damn code.
User is offlineProfile CardPM

Go to the top of the page

RodgerB
post 27 May, 2008 - 02:04 PM
Post #2


D.I.C Lover

Group Icon
Joined: 21 Sep, 2007
Posts: 2,127



Thanked 15 times

Dream Kudos: 2200

Expert In: Dot Net Technologies

My Contributions


Holy crap! ohmy.gif
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 27 May, 2008 - 02:11 PM
Post #3


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 5,062



Thanked 175 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


We had a few pages in my company's site hit by this and I had to patch it up for them. It essentially injects an sql statement in binary info and casts it to nvarchar and then executes it. The binary code casted to nvarchar results in a simple insert of a javascript src tag.

Way to prevent it is simply to validate URL parameters and make sure that all parameters are of the right size and type. In addition I make sure that parameters are not more than 100 chars in length which pretty much knocks this sql injection out because the binary string itself is a few hundred chars.

smile.gif
User is offlineProfile CardPM

Go to the top of the page

Mikhail
post 27 May, 2008 - 05:51 PM
Post #4


D.I.C Addict

Group Icon
Joined: 26 Oct, 2007
Posts: 977



Thanked 1 times

Dream Kudos: 250
My Contributions


None of the sites I know were hit, However that is a large number.
User is offlineProfile CardPM

Go to the top of the page

Sonic88
post 28 May, 2008 - 05:45 AM
Post #5


D.I.C Head

**
Joined: 19 Feb, 2008
Posts: 166



Thanked 2 times
My Contributions


We got hit on a site we maintain byt this like 5 times. WE didnt build the site, and are actually in the process of finishing the redesign, but whoever did left the whole damn site wide open. No validation on query strings. A true pain in the ass. The one we got passed in a hex value that when converted ascii was an SQL statement that tries to hit every table in the database. <rant>A true pain in the ass as we were already maxed out on time and now we gotat deal with this cause some "knows enough to be dangerous" web developer codes a vulnerability into every page thats been around for years.</rant>
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 28 May, 2008 - 06:43 AM
Post #6


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,933



Thanked 118 times

Dream Kudos: 8525

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Thanks for the heads up Chris! I found a kick ass QueryString validation object, it is written in VB.Net so I'm working on converting it to C#, once that is done I will share it in the form of a tutorial or blog post to help people protect their site against these kind of attacks.
User is offlineProfile CardPM

Go to the top of the page

jjsaw5
post 28 May, 2008 - 08:02 AM
Post #7


I vill break you

Group Icon
Joined: 4 Jan, 2008
Posts: 1,364



Thanked 6 times

Dream Kudos: 125

Expert In: HTML, CSS, Database,

My Contributions


We've been having issues with this.
User is offlineProfile CardPM

Go to the top of the page

joeyadms
post 29 May, 2008 - 07:15 AM
Post #8


D.I.C Head

Group Icon
Joined: 4 May, 2008
Posts: 145



Thanked 6 times

Dream Kudos: 600

Expert In: PHP, Web Security

My Contributions


SQL Injections are the scariest holes out there. They are so common, and are extremely critical.

What I always have to explain to people, is this affects server level, the attacker is running commands on your sql server under your privileges.

It's all about escaping the current query, and there are so many vectors and ways to beat filters it's crazy. Especially with MSSQL server and there xp.cmdshell.

It is very probable that someone could gain root on your sql server from this vulnerability.

We need to be escaping all variable data that goes into queries. I always build a wrapper into my database abstraction layer for this. Also, use prepared statements as much as possible, this eliminates all of the worry.

Next is something at application level, like skyhawk said, mod_security works wonders, you just have to be careful. The first time I installed it, I unwittingly grabbed some rules off different sites that were horrible about false positives.

Next, the user you use for your application for your SQL server should have only permissions needed. That way if your compromised, they only have a sandbox to play in.
User is offlineProfile CardPM

Go to the top of the page

mikeblas
post 29 May, 2008 - 03:00 PM
Post #9


D.I.C Head

**
Joined: 8 Feb, 2008
Posts: 155



Thanked 1 times
My Contributions


QUOTE(PsychoCoder @ 28 May, 2008 - 07:43 AM) *

Thanks for the heads up Chris! I found a kick ass QueryString validation object, it is written in VB.Net so I'm working on converting it to C#, once that is done I will share it in the form of a tutorial or blog post to help people protect their site against these kind of attacks.

Why worry about the strings? Just bind your parameters, and you're fine.
User is offlineProfile CardPM

Go to the top of the page

KYA
post 30 May, 2008 - 06:19 AM
Post #10


#include <nerd.h>

Group Icon
Joined: 14 Sep, 2007
Posts: 4,211



Thanked 50 times

Dream Kudos: 1150
My Contributions


I'm sorry, but this bothers me:

effect: noun, something that happens

affect: verb, to make something happen like above

they are different and not interchangeable, example:

SQL Injection Has An Effect On Half Million Sites -- correct
SQL Injection Affects Half Million Sites--correct
SQL Injection Effects Half Million Sites--incorrect

Cool topic about SQL injections, thanks for the post



Sorry for being a grammar nazi smile.gif

This post has been edited by KYA: 30 May, 2008 - 06:21 AM
User is offlineProfile CardPM

Go to the top of the page

skyhawk133
post 30 May, 2008 - 06:33 AM
Post #11


Head DIC Head

Group Icon
Joined: 17 Mar, 2001
Posts: 14,846



Thanked 45 times

Dream Kudos: 1650

Expert In: Web Development

My Contributions


Fixed.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 06:52AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month