<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How To Clean Up After a SQL Injection Attack</title>
	<atom:link href="http://www.jephens.com/2008/07/27/how-to-clean-up-after-a-sql-injection-attack/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jephens.com/2008/07/27/how-to-clean-up-after-a-sql-injection-attack/</link>
	<description>Keeping Computers Happy Since 1997</description>
	<lastBuildDate>Mon, 30 Jan 2012 05:38:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Rich</title>
		<link>http://www.jephens.com/2008/07/27/how-to-clean-up-after-a-sql-injection-attack/comment-page-1/#comment-2446</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Fri, 11 Jun 2010 15:38:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.jephens.com/?p=36#comment-2446</guid>
		<description>Hi Jeff,

Great Article!  This informanation helped me save a database after an attack, and a recent DB backup failed.
Also, I found the security hole and patched it. 

Thank You!!

Rich</description>
		<content:encoded><![CDATA[<p>Hi Jeff,</p>
<p>Great Article!  This informanation helped me save a database after an attack, and a recent DB backup failed.<br />
Also, I found the security hole and patched it. </p>
<p>Thank You!!</p>
<p>Rich</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morten A</title>
		<link>http://www.jephens.com/2008/07/27/how-to-clean-up-after-a-sql-injection-attack/comment-page-1/#comment-364</link>
		<dc:creator>Morten A</dc:creator>
		<pubDate>Mon, 26 Jan 2009 18:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.jephens.com/?p=36#comment-364</guid>
		<description>Hi
You are a star :)
Thanks for your help. That worked :)
Now I have to start the long and painfull process of finding the &quot;hole&quot;. Not easy when I first picked up SQL one week ago, with no past experience, but I guess I will get there sooner or later :)
Kind Regards
Morten</description>
		<content:encoded><![CDATA[<p>Hi<br />
You are a star <img src='http://www.jephens.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Thanks for your help. That worked <img src='http://www.jephens.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Now I have to start the long and painfull process of finding the &#8220;hole&#8221;. Not easy when I first picked up SQL one week ago, with no past experience, but I guess I will get there sooner or later <img src='http://www.jephens.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Kind Regards<br />
Morten</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Knapp</title>
		<link>http://www.jephens.com/2008/07/27/how-to-clean-up-after-a-sql-injection-attack/comment-page-1/#comment-363</link>
		<dc:creator>Jeff Knapp</dc:creator>
		<pubDate>Mon, 26 Jan 2009 13:19:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.jephens.com/?p=36#comment-363</guid>
		<description>Morten,

The script isn&#039;t meant to be run together like that, they&#039;re intended to run separately.

However, that&#039;s not clear from the text, so I updated the code.

If you throw 2 dashes in front of the second &quot;Declare @T ...&quot; line&quot; so it looks like &quot;-- Declare @T ...&quot; it should work just fine.

Sorry for the confusion.

Jeff</description>
		<content:encoded><![CDATA[<p>Morten,</p>
<p>The script isn&#8217;t meant to be run together like that, they&#8217;re intended to run separately.</p>
<p>However, that&#8217;s not clear from the text, so I updated the code.</p>
<p>If you throw 2 dashes in front of the second &#8220;Declare @T &#8230;&#8221; line&#8221; so it looks like &#8220;&#8211; Declare @T &#8230;&#8221; it should work just fine.</p>
<p>Sorry for the confusion.</p>
<p>Jeff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morten A</title>
		<link>http://www.jephens.com/2008/07/27/how-to-clean-up-after-a-sql-injection-attack/comment-page-1/#comment-362</link>
		<dc:creator>Morten A</dc:creator>
		<pubDate>Mon, 26 Jan 2009 12:26:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.jephens.com/?p=36#comment-362</guid>
		<description>Hi
Thanks for a very interesting article. Learned alot.
I have been attached with sql injection and trying to first clean, then find a way to close the whole.

I ran the first PRINT script and as you said, it shows in the log as you say.
Then i tried to clean &quot;ntext&quot; datafield injection with the following script, only shanging the hackers website URL:


----------------------------------------------------------
DECLARE @T VARCHAR(255),@C VARCHAR(255)
DECLARE Table_Cursor CURSOR FOR
SELECT a.name,b.name FROM sysobjects a,syscolumns b WHERE a.id=b.id AND a.xtype=&#039;u&#039; AND (b.xtype=35 OR b.xtype=231 OR b.xtype=167)
OPEN Table_Cursor
FETCH NEXT FROM Table_Cursor INTO @T,@C
WHILE(@@FETCH_STATUS=0)
BEGIN
PRINT (&#039;UPDATE [&#039;+@T+&#039;] SET [&#039;+@C+&#039;]=REPLACE([&#039;+@C+&#039;],&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;)&#039;)
FETCH NEXT FROM Table_Cursor INTO @T,@C
END
CLOSE Table_Cursor
DEALLOCATE Table_Cursor

DECLARE @T VARCHAR(255),@C VARCHAR(255)
DECLARE Table_Cursor CURSOR FOR
SELECT a.name,b.name FROM sysobjects a,syscolumns b WHERE a.id=b.id AND a.xtype=&#039;u&#039; AND b.xtype=99
OPEN Table_Cursor
FETCH NEXT FROM Table_Cursor INTO @T,@C
WHILE(@@FETCH_STATUS=0)
BEGIN
PRINT (&#039;UPDATE [&#039;+@T+&#039;] SET [&#039;+@C+&#039;]=cast(replace(cast([&#039;+@C+&#039;] as nvarchar(4000)),&#039;&#039;&#039;&#039;,&#039;&#039;&#039;&#039;) as ntext)&#039;)
FETCH NEXT FROM Table_Cursor INTO @T,@C
END
CLOSE Table_Cursor
DEALLOCATE Table_Cursor
---------------------------------------------------------


I then get the return error:

Msg 134, Level 15, State 1, Line 15
The variable name &#039;@T&#039; has already been declared. Variable names must be unique within a query batch or stored procedure.


Can anyone help me on whats going wrong here, and what I have to change in the script to get it to work

Kind Regards
Morten</description>
		<content:encoded><![CDATA[<p>Hi<br />
Thanks for a very interesting article. Learned alot.<br />
I have been attached with sql injection and trying to first clean, then find a way to close the whole.</p>
<p>I ran the first PRINT script and as you said, it shows in the log as you say.<br />
Then i tried to clean &#8220;ntext&#8221; datafield injection with the following script, only shanging the hackers website URL:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
DECLARE @T VARCHAR(255),@C VARCHAR(255)<br />
DECLARE Table_Cursor CURSOR FOR<br />
SELECT a.name,b.name FROM sysobjects a,syscolumns b WHERE a.id=b.id AND a.xtype=&#8217;u&#8217; AND (b.xtype=35 OR b.xtype=231 OR b.xtype=167)<br />
OPEN Table_Cursor<br />
FETCH NEXT FROM Table_Cursor INTO @T,@C<br />
WHILE(@@FETCH_STATUS=0)<br />
BEGIN<br />
PRINT (&#8216;UPDATE ['+@T+'] SET ['+@C+']=REPLACE(['+@C+'],&#8221;&#8221;, &#8221;&#8221;)&#8217;)<br />
FETCH NEXT FROM Table_Cursor INTO @T,@C<br />
END<br />
CLOSE Table_Cursor<br />
DEALLOCATE Table_Cursor</p>
<p>DECLARE @T VARCHAR(255),@C VARCHAR(255)<br />
DECLARE Table_Cursor CURSOR FOR<br />
SELECT a.name,b.name FROM sysobjects a,syscolumns b WHERE a.id=b.id AND a.xtype=&#8217;u&#8217; AND b.xtype=99<br />
OPEN Table_Cursor<br />
FETCH NEXT FROM Table_Cursor INTO @T,@C<br />
WHILE(@@FETCH_STATUS=0)<br />
BEGIN<br />
PRINT (&#8216;UPDATE ['+@T+'] SET ['+@C+']=cast(replace(cast(['+@C+'] as nvarchar(4000)),&#8221;&#8221;,&#8221;&#8221;) as ntext)&#8217;)<br />
FETCH NEXT FROM Table_Cursor INTO @T,@C<br />
END<br />
CLOSE Table_Cursor<br />
DEALLOCATE Table_Cursor<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>I then get the return error:</p>
<p>Msg 134, Level 15, State 1, Line 15<br />
The variable name &#8216;@T&#8217; has already been declared. Variable names must be unique within a query batch or stored procedure.</p>
<p>Can anyone help me on whats going wrong here, and what I have to change in the script to get it to work</p>
<p>Kind Regards<br />
Morten</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Chen</title>
		<link>http://www.jephens.com/2008/07/27/how-to-clean-up-after-a-sql-injection-attack/comment-page-1/#comment-163</link>
		<dc:creator>David Chen</dc:creator>
		<pubDate>Thu, 23 Oct 2008 20:07:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.jephens.com/?p=36#comment-163</guid>
		<description>Very informative and fun to learn this type of SQL injection attack technique.  You made it a fun one to understand and prevent.  Thanks for your work!</description>
		<content:encoded><![CDATA[<p>Very informative and fun to learn this type of SQL injection attack technique.  You made it a fun one to understand and prevent.  Thanks for your work!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

