感谢生生不息在freebuf社区”分享团”里给出线索,才有了本文
2 [3 V8 Z3 D* @% e1 ]! X/ A& I' g& _' X. {$ c
原帖:http://club.freebuf.com/?/question/129#reply12! ` s$ P' ?+ b4 \1 G
5 C1 O# ?1 w: r* R
FCKEditor 2.6.8文件上传漏洞
7 d, z1 C8 X1 c O6 s' ?2 [* {7 p# f( Y5 Z3 [5 F& w
Exploit-db上原文如下:
, C* a! y3 v+ Q' ]& m% T% {- d' E% G5 [* a0 Y
- Title: FCKEditor 2.6.8 ASP Version File Upload Protection bypass
2 E" F: a. V0 `2 t; V7 Y- Credit goes to: Mostafa Azizi, Soroush Dalili
! V0 d; O9 @ m9 W! K1 N- Link:http://sourceforge.net/projects/fckeditor/files/FCKeditor// w% s) O. |9 L4 O8 `7 p: O- V
- Description:3 ?. W$ `0 ~ D3 S% A
There is no validation on the extensions when FCKEditor 2.6.8 ASP version is6 \5 G" J8 w% \, q9 S/ c5 L
dealing with the duplicate files. As a result, it is possible to bypass
, |! K( d, l% p( Zthe protection and upload a file with any extension.
! A2 U F( H8 a9 ?- Reference: http://soroush.secproject.com/blog/2012/11/file-in-the-hole/
/ j9 _. b2 h# Q9 C, X- Solution: Please check the provided reference or the vendor website.- L8 a4 y* L6 E: O
* w; }+ ~, T* C' |' f. X- PoC:http://www.youtube.com/v/1VpxlJ5 ... ;rel=0&vq=hd720% x0 P2 J4 h' U' X% G( v
"! Y5 G) L# Y) e$ n! K. \
Note: Quick patch for FCKEditor 2.6.8 File Upload Bypass:
5 O( S2 l M# P' k- o" u& x8 l; u( N5 o/ P
In “config.asp”, wherever you have:, Q/ Y% K$ H8 a4 V: i
ConfigAllowedExtensions.Add “File”,”Extensions Here”' |7 S# T' H' j! a
Change it to:0 K! d: w% Y+ q# J$ U5 T$ [
ConfigAllowedExtensions.Add “File”,”^(Extensions Here)$”在视频(需翻墙)里,我们可以看的很清楚:
6 o! g3 h3 n% A' l) n+ o$ [7 |; c a8 b- X! R- |1 _9 N
1.首先,aspx是禁止上传的0 a g! V2 J$ B3 L( y& l1 ~
2.使用%00截断(url decode),第一次上传文件名会被转成_符号
) V" G8 I9 z* W* {8 L: Y
, a! d/ c) [( x; O U4 n8 b! [3 ]! `4 t2 Z
6 {5 W, |& S9 J& U
接下来,我们进行第二次上传时,奇迹就发生了
, F/ s4 p8 k# s+ C& V! E& F$ K5 m6 {2 s; ]) c2 N- V1 F6 T
. e* s7 R! Z- i' Q, R- u* E9 _3 P: ^
代码层面分析可以看下http://lanu.sinaapp.com/ASPVBvbscript/121.html: w0 W. E8 R- i7 u4 Y7 M
5 @9 W; `2 S- H% w' B7 Y" y
- O' p2 Z- e D" p+ V# F* T" ~) v% T" Z' d0 R$ D4 z2 M
CKFinder/FCKEditor DoS漏洞
. p- }4 c3 Z# C! U0 o
6 J# Z+ C( ]4 S9 ?+ u5 Z相比上个上传bug,下面这个漏洞个人觉得更有意思& S3 ?5 R+ U+ f- @' v
3 p3 o' e G/ X; {" `/ M
: X% p8 v+ t/ k( f( A
6 [$ h$ ^# O+ S# cCKFinder是一个强大而易于使用的Web浏览器的Ajax文件管理器。 其简单的界面使得它直观,快速学习的各类用户,从高级人才到互联网初学者。 , s) v% J- s b, r+ @7 _" R( Q
! D' e7 t& Q0 k. x4 h$ r
CKFinder ASP版本是这样处理上传文件的:
0 M' F! K) P- H- y( {. ~7 F$ e2 n+ o: Z5 w9 @
当上传文件名已存在时,会进行迭代重命名,比如file(1).ext存在了,会尝试重命名为file(2).ext……直到不重复为止。8 Y7 J& y% d% @8 g: u
& {9 }- I$ R9 ^
那么现在有趣的事情来了——windows是禁止”con”作为文件名的(关于这个问题我印象中很久以前,win也有过con文件名漏洞,有兴趣可以确认下)
) @* {! H2 F5 J. k, z2 N8 Q/ Z t5 N: \) r J% U1 K1 l
dos方法也应运而生!2 F" k/ l. y" S
% b8 ]! B" T/ o/ X/ [
: [/ ^' O$ P- ?# c7 t- y7 H9 R: O
1 H& T; |3 ^4 E7 O: \+ e! i1.上传Con.pdf.txt
0 e" T* I) M$ r2.CKFinder认为“Con.pdf.txt” 已被占用,于是开始尝试Con.pdf(1).txt,Con.pdf(2).txt……Con.pdf(MaxInt).txt从而对服务器形成致命dos。
0 c' Z0 {# O) M4 T$ Z% S8 V3 g3 s# s1 L* y: z) h. b' K
|