感谢生生不息在freebuf社区”分享团”里给出线索,才有了本文$ o% E2 l# T5 j4 R2 u
5 I8 u+ J+ t9 R ]4 R: O- T; `原帖:http://club.freebuf.com/?/question/129#reply12
, d1 [1 v. }- U
' [* w; k( n+ z7 U sFCKEditor 2.6.8文件上传漏洞
5 R; K; g* O1 @* P$ I. @7 H
7 H7 i8 \. U" j1 J! uExploit-db上原文如下:
* c7 v- \- ?9 `5 P5 s# y; n2 H
, u: z( D" [ H5 w& l6 n$ u% V- Title: FCKEditor 2.6.8 ASP Version File Upload Protection bypass
' G; C7 @" S# E- Credit goes to: Mostafa Azizi, Soroush Dalili+ H8 V7 k) X/ E2 a% s: A, U- K
- Link:http://sourceforge.net/projects/fckeditor/files/FCKeditor/
) g7 t3 j" C9 d, {" V( Z; ~# R2 {1 G3 g- Description:
1 Q. {, G( Z* b( j6 @, GThere is no validation on the extensions when FCKEditor 2.6.8 ASP version is) p: @$ A6 F7 a. `) s
dealing with the duplicate files. As a result, it is possible to bypass$ }4 _0 a$ [+ w' `& o+ q/ N9 G' e5 D
the protection and upload a file with any extension.
6 t/ V- x* M$ C f6 F- Reference: http://soroush.secproject.com/blog/2012/11/file-in-the-hole/
! t) h; U$ _6 s9 @* n- Solution: Please check the provided reference or the vendor website.' k( g, p8 F' J1 m! y+ B) @2 d
t1 P* A, f( V# U5 A; y) w; m& c
- PoC:http://www.youtube.com/v/1VpxlJ5 ... ;rel=0&vq=hd720: X3 u: N! @4 J0 [' \
"
# l8 c0 Z. Q, C& z+ aNote: Quick patch for FCKEditor 2.6.8 File Upload Bypass:/ f4 m; c, z! S& g
% u& q/ f4 r" h0 S3 ^$ \5 H) U; M
In “config.asp”, wherever you have:
8 ]4 n* Y' E3 N" v6 l/ c ConfigAllowedExtensions.Add “File”,”Extensions Here”
! z7 `; y" z% J4 M SChange it to:+ ?6 x+ \4 q# E1 r
ConfigAllowedExtensions.Add “File”,”^(Extensions Here)$”在视频(需翻墙)里,我们可以看的很清楚:
. _3 `' C1 }. w6 u$ c4 J, I& v0 {+ @: ~. y* a. P
1.首先,aspx是禁止上传的 x. I) l% s: ^/ j2 w% t% d
2.使用%00截断(url decode),第一次上传文件名会被转成_符号7 Q8 x% l: M/ V+ _! @) z
( q$ q# f! {1 y! \
5 Q8 k5 R: {6 r4 J; L
6 M2 u9 V7 Z6 ^3 Y4 R6 m# e
接下来,我们进行第二次上传时,奇迹就发生了
2 W4 B \0 C8 b; G# T- J+ O
% e# x7 B3 ^2 E0 s& F; f
0 k* t, e2 @9 g' P" P9 L5 P! L$ F- a5 n0 @% o
代码层面分析可以看下http://lanu.sinaapp.com/ASPVBvbscript/121.html
9 n8 w: [7 O. o2 j& Q- f
5 o8 V/ }$ n0 X. }( `7 h0 J4 @
+ G2 e7 Y! w% P" b4 u+ T
! `2 `- a! V- r( |CKFinder/FCKEditor DoS漏洞, T' {2 t' B! J% c' k7 j$ d2 S0 B
! g8 X8 | @& I: C! o- d/ j2 s* N$ n
相比上个上传bug,下面这个漏洞个人觉得更有意思+ b. V% a* Y, @ C9 b2 z: r
0 j7 C9 N/ g& K) W) r- G" d ], r$ f2 z: h! d) r" L* e
% V7 F; i9 q9 C# G) X7 B$ uCKFinder是一个强大而易于使用的Web浏览器的Ajax文件管理器。 其简单的界面使得它直观,快速学习的各类用户,从高级人才到互联网初学者。 % I% ~5 B1 a* r! ~8 a
7 B7 X4 Y1 g3 g/ \& ?$ r) H" K# L6 i+ ]CKFinder ASP版本是这样处理上传文件的:
! d* \/ }. a2 [. j6 A8 x( n% W' P2 Q* L- [1 Y9 U; X* \
当上传文件名已存在时,会进行迭代重命名,比如file(1).ext存在了,会尝试重命名为file(2).ext……直到不重复为止。8 }1 g' }6 Z5 N. t
% v# Z0 M8 T- m那么现在有趣的事情来了——windows是禁止”con”作为文件名的(关于这个问题我印象中很久以前,win也有过con文件名漏洞,有兴趣可以确认下)7 Y3 u' D, v9 a' a- R# X3 Z
( {: y& z) z% g0 u5 `7 W! l
dos方法也应运而生!
5 ^( j% }3 m r+ ]- F, j8 L5 U
" m7 }( t' y. S
) S( h6 H, G6 R
1.上传Con.pdf.txt) e4 w5 w: `0 I/ Q/ o3 t1 u
2.CKFinder认为“Con.pdf.txt” 已被占用,于是开始尝试Con.pdf(1).txt,Con.pdf(2).txt……Con.pdf(MaxInt).txt从而对服务器形成致命dos。! |# d) }/ [1 o1 x$ \: n4 ]: A# i
, F, K6 e; u z2 D* s
|