感谢生生不息在freebuf社区”分享团”里给出线索,才有了本文- y" K" x: i. ~' Y6 J# Y' h
u# M; f0 p( F% k( }3 @* O原帖:http://club.freebuf.com/?/question/129#reply128 @+ \. {. |: U( V
8 C: h, l6 i! ~, g+ H% e
FCKEditor 2.6.8文件上传漏洞
% d. r3 o3 e+ H' A' n, `# f& t8 g* A" T$ m c
Exploit-db上原文如下:
( f: t* _- Q6 u! J
1 M$ L! M, {5 }/ ?9 s$ d- Title: FCKEditor 2.6.8 ASP Version File Upload Protection bypass3 j9 m. F% I C+ a( i `7 I+ C
- Credit goes to: Mostafa Azizi, Soroush Dalili
Q' p% E4 z9 {) ]- Link:http://sourceforge.net/projects/fckeditor/files/FCKeditor/; R7 Q" @( n& ^% S9 d$ l/ p
- Description:8 w0 b" v, {/ m, [8 W
There is no validation on the extensions when FCKEditor 2.6.8 ASP version is! i" D! N/ K( S& e5 H5 N+ B- l
dealing with the duplicate files. As a result, it is possible to bypass
8 Y; V3 ~5 {! q. \, g/ W, b; B5 Cthe protection and upload a file with any extension.2 H% A) v- z6 h; q+ D3 H) t
- Reference: http://soroush.secproject.com/blog/2012/11/file-in-the-hole/ t5 r: Z% f2 G# ^% F# a1 }: P+ H
- Solution: Please check the provided reference or the vendor website.
' i' [7 d9 G _2 h% U$ t
. L, s0 I Q- T8 s- PoC:http://www.youtube.com/v/1VpxlJ5 ... ;rel=0&vq=hd7208 T4 w1 o; e# P. c1 w0 q( H9 t
"
9 r3 F5 n2 a* Y4 K! y5 p E kNote: Quick patch for FCKEditor 2.6.8 File Upload Bypass:
' ^8 U, h# ~, ~1 w* i+ q# R, }5 }- B& b
In “config.asp”, wherever you have:
* }3 G I7 f7 m; I5 F2 g7 w ConfigAllowedExtensions.Add “File”,”Extensions Here”
9 g6 D: c k1 B; N- GChange it to:: y7 j9 {2 [0 a
ConfigAllowedExtensions.Add “File”,”^(Extensions Here)$”在视频(需翻墙)里,我们可以看的很清楚:
/ m6 Q7 ?# p" N, m7 {* a3 F/ i$ Y8 [% z0 l
1.首先,aspx是禁止上传的
" d7 f! Q; c3 u2 t( t2.使用%00截断(url decode),第一次上传文件名会被转成_符号3 {7 e" X# D; ^9 x% ^7 W
5 ]. W' c2 t$ K' J1 d* b
. b6 R: b7 l5 h+ z4 D
- ^# S8 q, v8 m接下来,我们进行第二次上传时,奇迹就发生了
! U/ q7 c9 P2 ]
, \1 A, U2 A9 O( W! \" |, ~1 m% Y
% W2 d% l+ ]1 ]* B
% z. t: X6 P- R2 u1 ^代码层面分析可以看下http://lanu.sinaapp.com/ASPVBvbscript/121.html3 d) Q& X# P$ O6 Q* u; m
7 ~6 B+ c) G; J# k
: T5 r) n7 w6 b! b, L
, R* l2 e Z4 z7 Z/ zCKFinder/FCKEditor DoS漏洞
: D& `' g( `! d: `) d( ?" G5 K# W" {0 |2 w0 }, f
相比上个上传bug,下面这个漏洞个人觉得更有意思
1 m9 o1 B w# A" k j
* V% X! T d( R9 L* b+ T: z! E 7 T0 `0 @& J- v4 `$ @/ F
( ]" C, ?; |; g/ \! c- @; gCKFinder是一个强大而易于使用的Web浏览器的Ajax文件管理器。 其简单的界面使得它直观,快速学习的各类用户,从高级人才到互联网初学者。 # H- D0 \- {- f8 c/ c& b" R
% T* d/ M" a5 j; b0 j$ E7 d/ GCKFinder ASP版本是这样处理上传文件的:
. x) B4 ^8 ?) @% v ?2 |
. _ [2 I# P3 T: `* o% R/ A当上传文件名已存在时,会进行迭代重命名,比如file(1).ext存在了,会尝试重命名为file(2).ext……直到不重复为止。
$ h' \8 H; R6 D9 k2 U( Z3 t3 E
1 |, g9 |2 R q- ]3 [8 Y那么现在有趣的事情来了——windows是禁止”con”作为文件名的(关于这个问题我印象中很久以前,win也有过con文件名漏洞,有兴趣可以确认下)
) d; O7 Y4 i6 o: f. D' ?- Q( W; V4 U
dos方法也应运而生!+ A/ B# o1 I: g/ n3 H6 C
% k) t }! _7 d8 @9 L
1 q8 Y6 Z! q' r. Y$ a$ } y# E+ i E' {# F" T" F5 i- \. i
1.上传Con.pdf.txt3 n: P0 z+ `, Q9 C; `' X% `/ Z
2.CKFinder认为“Con.pdf.txt” 已被占用,于是开始尝试Con.pdf(1).txt,Con.pdf(2).txt……Con.pdf(MaxInt).txt从而对服务器形成致命dos。: @8 K$ P& H6 i- A: x
" l" @4 D' a9 @
|