POST 数据漏洞文件执行任意后缀文件保存& P( @. a2 }+ m
漏洞文件/chart/php-ofc-library/ofc_upload_image.php. p2 H# X4 @+ ~0 K( S2 o! B Y7 U
4 Y0 _- N0 u- `! j利用:7 \8 r4 d* o( D* a/ I* u) j
/chart/php-ofc-library/ofc_upload_image.php?name=hfy.php hfy.php 文件名9 f- h) a1 w) [1 v" C
4 I5 G2 r/ \; c: S
Post任意数据0 F, R8 L% m, E E
保存位置http://localhost/chart/tmp-upload-images/hfy.php
' Z/ \: c4 f$ P% I E* O' p, K- |: h4 [! ]1 n/ Z; f
5 I( Q3 k5 G0 f9 v! z! ], N最新版wss漏洞文件,即使是收费版本也有的,在新浪商店部署的demo~
, z! V. |+ }! r' \7 @# v6 u- X& l2 `& Z3 D/ ~
<?php; K& U4 d/ W5 j* Y$ s" j: ?# |
$ V7 x, }' Y: B6 m! U# T# d//
7 a; \: u# g$ s; d5 j// In Open Flash Chart -> save_image debug mode, you
2 c7 L. C. _. }- J a// will see the 'echo' text in a new window.9 [* U [" ]3 P: J+ t H2 w8 ^
//9 e$ c% b+ {; S
* ]5 N% B! L' j
/*
. ]/ a4 V' G# w h- h# Y: j+ q1 M5 S, ?
print_r( $_GET );
* F* @$ V$ Y Qprint_r( $_POST );# X$ U, \) g; }/ H7 J
print_r( $_FILES );
# X0 x6 C7 G' j# o% l- `3 ^* d6 w h& d! N |4 s9 n
print_r( $GLOBALS );
. w8 W) U$ E% c4 D, bprint_r( $GLOBALS["HTTP_RAW_POST_DATA"] );) U$ O. L4 b, h0 ~
5 B, T) V4 z2 z- Z) R# e*/
2 m) w' o1 R2 a: k// default path for the image to be stored //
+ f/ F5 {& e" a0 y+ c1 l# {: n$default_path = '../tmp-upload-images/';
4 j p" A) t* [+ d
( J* ?$ ]7 m4 ?0 K& S `0 @4 O% b5 uif (!file_exists($default_path)) mkdir($default_path, 0777, true);
4 H4 I$ h: |% n
% Q9 X- Q B5 S2 M" q// full path to the saved image including filename //
# @, J0 M" B% h$ ^) ]3 N, k5 U$destination = $default_path . basename( $_GET[ 'name' ] ); $ W0 V0 e {4 c
; I1 h# N: Q, d& v: vecho 'Saving your image to: '. $destination;
]% m7 @4 F& m+ U( w) h) @" _// print_r( $_POST );: _. I9 L* Q7 C6 f, s: B
// print_r( $_SERVER );! z2 {. i/ J l2 x' D/ f
// echo $HTTP_RAW_POST_DATA;
2 X+ u. i. l7 Z# U8 ~. }4 m7 B5 Z8 d$ f' p
//
' s5 ~1 Y. E1 u( {% F7 E// POST data is usually string data, but we are passing a RAW .png7 G2 O% d# B0 p1 r$ L- t- I$ E
// so PHP is a bit confused and $_POST is empty. But it has saved. N4 c7 A6 b" C6 C. v% |% r
// the raw bits into $HTTP_RAW_POST_DATA
. `) _! [4 G2 z# o8 \2 `//
0 w1 F) @9 n* n. F, k, z' y! K/ c: }( r$ X8 g
$jfh = fopen($destination, 'w') or die("can't open file");
; t& P* s. T9 F& t. W, @5 ~5 m Afwrite($jfh, $HTTP_RAW_POST_DATA);2 l& o2 C5 F" T+ c
fclose($jfh);
1 a) x, O! r, Z& X) p; y: Y" ]: I
~5 V$ q( P7 Y( u$ H7 g8 B//8 j+ t' g& c" y5 x1 x/ {. A7 k6 B
// LOOK:' @5 T8 v" V2 _2 q
//
; \/ \! D7 _2 Xexit();* q' Z4 G' g2 i
//
' T! ]4 Q0 m0 N// PHP5:
. H F; k/ H* R7 A! Y w0 E//2 K, Z+ ]5 h/ w3 I$ v
/ `5 G4 o& F: C. y" B" n9 [
! V! n9 }* @# K3 ^; G// default path for the image to be stored //: D8 n+ {2 _3 @8 X7 K
$default_path = 'tmp-upload-images/';
- u1 {0 x2 B- T8 S* T N% k0 _. I9 d$ ^7 @
if (!file_exists($default_path)) mkdir($default_path, 0777, true);5 x; u8 v0 B; o: l* @
4 {" Z) W/ S6 w! F! V
// full path to the saved image including filename //3 C" n/ x) g/ ~0 _* M: W
$destination = $default_path . basename( $_FILES[ 'Filedata' ][ 'name' ] );
% b0 {1 U+ R' g% ^5 b- ^
) x" j/ t! d8 J6 n. K: H// move the image into the specified directory //
4 p$ @& L" ?; E+ p% ?% _if (move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)) {
& f! c- G6 ]2 |3 a/ o echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";- }$ f/ I, m2 {7 D( k, _/ |* |5 S
} else {
' K+ F6 Y! l4 }! v echo "FILE UPLOAD FAILED";
) R u4 A- k# I! o- ?9 \; i}0 F. ?: P8 O# _% \* q
$ }$ S& A- {& ]. g2 I+ ?1 K8 b5 ]
2 ?1 Y( }9 Z; X4 ]$ S/ M?>
. t. D7 a" g1 _2 H- d6 }$ _$ o2 U/ B
0 ^6 O' \. f4 r( C3 t% }5 v
6 f+ L* l) K1 n& a8 o; x8 C0 m
3 g& A: u( u2 V% Y( a; L) N z2 S/ c+ Q
R3 [2 r9 M$ \9 \7 Z- v+ B
' r8 P& l9 o- W% N修复方案:
. r1 u* I9 `# T5 ~5 [( r; c5 x这个漏洞文件就是个杯具,怎么破,加权限验证,后缀等验证~,自己搞 - v3 u/ u' v5 I. g7 a2 @' _! I
# Z8 y- O1 N# h' Y+ t; h
$ c4 z- y1 m' H
' ?/ k: R- o5 e$ ^; {
( S7 g( y) s. u: N$ k |