ํด๋น ๋ด์ฉ์ ์๋ฒ์ sql injetction ๊ณต๊ฒฉ์ ๋ฐ์์ ๊ฒฝ์ฐ
DB๋ณต๊ตฌ๊ฐ ์๋ ํด๋น DB ๋ฅผ ์์ ํ๋ ์ฟผ๋ฆฌ๋ฌธ์ ๋๋ค.
์ฌ์ฉ ๋ฐฉ๋ฒ์ ์๋ ์ฃผ์ ์ ํด์ ํ๋ฉด ํด๋นDB์ ํด๋นํ๋ ๊ตฌ๋ฌธ์ ์ฐพ์ ์ ๋ฐ์ดํธ ํฉ๋๋ค.
๋ฌผ๋ก ์ค์ DATA๊ฐ ์ฌ๋ผ์ง ๊ฒฝ์ฐ๋ ์์ผ๋ ์ฃผ์ํ์ฌ ์ฌ์ฉํ์๊ธธ ๊ถ์ฅํฉ๋๋ค.
====================================================================================
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 = '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 @T, @C;
WHILE (@@FETCH_STATUS = 0) BEGIN
print ('select ['+@C+'] from ['+@T+'] where ['+@C+'] like ''%<script%</script>''');
exec ('select ['+@C+'] from ['+@T+'] where ['+@C+'] like ''%<script%</script>''');
-- ์ ํ์ ์ฃผ์
--exec('update ['+@T+'] set ['+@C+'] = left(convert(varchar(8000), ['+@C+']),len(convert(varchar(8000), ['+@C+'])) - 6 -patindex(''%tpircs<%'',reverse(convert(varchar(8000), ['+@C+'])))) where ['+@C+'] like ''%<script%''');
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 = '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 @T, @C;
WHILE (@@FETCH_STATUS = 0) BEGIN
print ('select ['+@C+'] from ['+@T+'] where ['+@C+'] like ''%<script src%</script>''');
exec ('select ['+@C+'] from ['+@T+'] where ['+@C+'] like ''%<script src%</script>''');
-- ์ ํ์ ์ฃผ์
--exec('update ['+@T+'] set ['+@C+'] = left(convert(varchar(8000), ['+@C+']),len(convert(varchar(8000), ['+@C+'])) - 10 -patindex(''%crs tpircs<%'',reverse(convert(varchar(8000), ['+@C+'])))) where ['+@C+'] like ''%<script src%''');
FETCH NEXT FROM Table_Cursor INTO @T, @C;
END;
CLOSE Table_Cursor;
DEALLOCATE Table_Cursor;
'๋ฆฌ๋ ์ค > MYSQL' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
MariaDB(Mysql) varํด๋์์ homeํด๋๋ก ๋ณ๊ฒฝ (0) | 2017.04.25 |
---|---|
mysql root ๊ณ์ ๋ณ๊ฒฝ (0) | 2016.07.10 |