최근 중국발 Mass SQL Injection 공격이 기승을 부린다.
구글에서 검색해도 수두룩하게 나오는 감염된 사이트..-0-
패턴을 모르면 웹방화벽조차 막을 수 없는 어이없는 놈들 ㅎㅎ
일단 복구 쿼리
declare @tablename varchar(255), @columnname varchar(255), @action varchar(1000) declare table_cursor cursor for
select a.name, b.name
from sysobjects a, syscolumns b
where a.id = b.id and a.xtype='u' and (b.xtype=99 or b.xtype=35 or b.xtype=231 or b.xtype=167)
open table_cursor fetch next from table_cursor into @tablename, @columnname
while(@@fetch_status=0) begin
print @columnname
set @action = 'updaTe ['+@tablename+'] set ['+@columnname+'] = replace(['+@columnname+'], "##공격문자열##", "")'
print @action
exec
(
'updaTe ['+@tablename+'] set ['+@columnname+'] = replace(['+@columnname+'], ''##공격문자열##'', '''')'
-- 'updaTe ['+@tablename+'] set ['+@columnname+'] = replace(convert(varchar(8000), ['+@columnname+']), "##공격문자열##", "")'
)
fetch next from table_cursor into @tablename, @columnname end
close table_cursor deallocate table_cursor
해당 DB에서 공격문자열을 넣구 실행하면 된다.
단 데이터에 침혜를 당한 DB는 복구 불가능 하다는 단점이 있고 Text Type의 컬럼은 수정이 안된다는
단점이 있긴하지만...DB복구가 불가능한 시점에서는 많은 일손을 덜어준다.
자나깨나 Dynamic 쿼리는 자제하고 프로시저나 Static 쿼리를 이용하는 습관을 갖는게 중요하다.
이올린에 북마크하기
이올린에 추천하기




