Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Massive Sql Injection problemMassive Sql Injection problem
Previous
 
Next
New Post
7/30/2008 4:17 PM
 

Hi Folks,

Just become the latest victim of Sql Injection problems which in my case hit every Varchar colum in every table in my DNN database.

I'm not saying that DNN has a massive security hole as I now realise that some of my own code could allow this too happen.

The point of this email is to pass on the sql stored procedure below that I just used to remove all of the offending injected text.

Hope it helps anyone else out of a hole.

Regards

Tony

/*

SET

ANSI_NULLS ON

GO

SET

QUOTED_IDENTIFIER ON

GO

ALTER

PROC RemoveText

(

@TextToRemove

)

VARCHAR(4000)

AS

DECLARE

@T VARCHAR(255),

@C

VARCHAR(255)

DECLARE

Table_Cursor CURSOR

FOR

 

 

 

 

 

SELECT a.name,b.nameFROM sysobjects a,syscolumns bWHERE a.id=b.idAND a.xtype='u'AND (b.xtype=99 OR b.xtype=35 OR b.xtype=231 OR b.xtype=167)

OPEN

 

 

Table_CursorFETCH NEXT FROM Table_CursorINTO @T,@C WHILE(@@FETCH_STATUS=0)

BEGIN

 

EXEC(

 

SET ['

'UPDATE ['+@T+']+@C+']=REPLACE(CONVERT(VARCHAR(4000), ['+@C+']), ''' + @TextToRemove + ''', '''')')

 

 

FETCH NEXT FROM Table_Cursor INTO @T,@CEND

CLOSE

Table_Cursor

DEALLOCATE

Table_Cursor

*/

To use the procedure

EXEC

RemoveText 'theoffendingtext'

 
New Post
7/30/2008 6:35 PM
 

Tony:

The incidence of SQL injection attacks is running very high all over the place, this has been documented a lot lately.  In the last few days I have seen a lot of attempts in the logs of my DNN sites.  None of them have been successful by the way, this is because of the good design of the DNN modules and architecture (I'm only using the native modules in DNN).  These attempts are also DNN specific by the way.

The text that is being attempted during the SQL injection attack includes a call to a file called "ngg.js", don't know if this is the same you found.  But in any case, I have been using a stored procedure I found some time ago to do a global text search, like in all the text fields on all tables for a given database at once.  You can find this stored procedure in this link.  They also have a global search and replace in that site but I have not used that one.

Carlos

 

 
New Post
7/31/2008 8:38 AM
 

Hi Carlos,

Thanks for the links. The replace procedure looks better than the one I posted as my one was limited to 4000 chars.

I have looked through my logs and cannot see where the injection occoured, just the first incident of its result. In my case the script being called was gty5.ru/js.js and the gty5.ru is a known domain that is being used by these bas*%rds.

What gets me is the fact that the code got added to all of my text columns in all of my tables. How does that happen.

Regard

Tony

 

 
New Post
7/31/2008 8:48 AM
 

Carlos Rodriguez wrote

The text that is being attempted during the SQL injection attack includes a call to a file called "ngg.js" 

That's a very popular injection, and it runs a script to download a client to the system calling it that further attacks other servers.  I haven't gotten a successful injection attack in several years (that I know of...) on either DNN, ASP.NET or Classic ASP sites.  The DNN core modules are all pretty tight, I don't use many thrid party modules, the ones I've coded aren't susceptible and I've been pretty diligent in coding to avoid SQL injection opportunities.

But the important thing is:  DNN, by itself, is not vulnerable.  But there are thousands of ways an admin can make their site vulnerable.  Be vigilant, always have good backups and don't be afraid to flatten a box when you don't know what's happened.

Sorry, gotta go check backups now...

Jeff

 
New Post
7/31/2008 10:02 AM
 

Tony,

Also if you believe the injection was due to DNN or something simliar please send an e-mail to security@dotnetnuke.com as that is the desired communication medium for all issues of this nature.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Massive Sql Injection problemMassive Sql Injection problem


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out