感谢生生不息在freebuf社区”分享团”里给出线索,才有了本文
& |2 ]& {0 }9 c5 I$ Z5 i! p' [0 R% k0 v* @$ O/ |0 E4 v S
原帖:http://club.freebuf.com/?/question/129#reply12
3 y+ |1 |5 C2 k. p7 S0 X
# P) F0 O2 J6 m2 M+ ~/ c4 D0 @" aFCKEditor 2.6.8文件上传漏洞
; u! g4 B- s8 x* Z. ?+ ~0 ]3 w7 Q. B2 K/ W( P
Exploit-db上原文如下:
1 E2 q0 }; u0 E. y; }
3 V3 q$ s, V. J$ p3 ?& `1 U% ?- Title: FCKEditor 2.6.8 ASP Version File Upload Protection bypass7 Z4 r$ t6 X4 L. ]
- Credit goes to: Mostafa Azizi, Soroush Dalili
5 Y$ f4 `7 @% z# v# h- Link:http://sourceforge.net/projects/fckeditor/files/FCKeditor/) J- W- p* |" w4 o- j* m5 v
- Description:( I( V9 W6 \1 a2 f6 t! p! U6 B
There is no validation on the extensions when FCKEditor 2.6.8 ASP version is
$ S" D% n5 p$ T6 H/ r0 n4 j( gdealing with the duplicate files. As a result, it is possible to bypass
% E: z% R$ c; g( V# S, r0 uthe protection and upload a file with any extension.
1 e0 d8 J, @! P( S7 _- Reference: http://soroush.secproject.com/blog/2012/11/file-in-the-hole/
f( S4 `8 F' q' p) Q- Solution: Please check the provided reference or the vendor website.
! e& p: \4 V% F6 v* N3 c# E3 O' w6 P
- PoC:http://www.youtube.com/v/1VpxlJ5 ... ;rel=0&vq=hd720
5 |: Z; B, M+ h"
8 [" I; p# }. oNote: Quick patch for FCKEditor 2.6.8 File Upload Bypass:% M& V. K$ r1 b
6 t4 d6 v8 N# z# L( k& g$ r0 z
In “config.asp”, wherever you have:+ Y% T1 w) L8 W; ?4 e \
ConfigAllowedExtensions.Add “File”,”Extensions Here”
% D. v; {& B7 i) `. K6 MChange it to:
* W; m4 d$ o8 U; ]. S1 L) [ ConfigAllowedExtensions.Add “File”,”^(Extensions Here)$”在视频(需翻墙)里,我们可以看的很清楚:, p" i8 a4 i' ^# P) H, R
" S. x5 p- O2 ~$ t+ _' i/ K1.首先,aspx是禁止上传的" s" k7 {7 O0 b K) n3 O, S; S
2.使用%00截断(url decode),第一次上传文件名会被转成_符号! w# R0 ~/ T( l; w! a8 {
% \6 V$ u! J' O7 W
' u: [2 [2 r" R6 }/ i+ W! C
. c3 I3 l D% @4 { `4 z& D接下来,我们进行第二次上传时,奇迹就发生了
1 Q$ @- A8 d9 A) V
( ?% M6 u6 t" u7 B$ c
1 \5 y: a1 O7 h o; O9 ^" o
: U& G- R, Y! i: Z$ O3 i代码层面分析可以看下http://lanu.sinaapp.com/ASPVBvbscript/121.html
: t. L4 u( P4 c$ ]) n' Z/ h' }) V: X/ s
) H& N' w2 w2 M
4 P/ F, @: m/ c, F7 K4 lCKFinder/FCKEditor DoS漏洞* T1 j' G$ j# @3 f2 G M+ x# C
8 O: L6 P2 |+ } G
相比上个上传bug,下面这个漏洞个人觉得更有意思/ Q0 C4 n+ K1 C/ `) ^! B# l6 q
* L& g, Z: s- S- R( E & O# ^/ r. E5 K; Q" w ~2 r; a* O
. u& c% @# u, j! W, J
CKFinder是一个强大而易于使用的Web浏览器的Ajax文件管理器。 其简单的界面使得它直观,快速学习的各类用户,从高级人才到互联网初学者。
( o% L- ~* Q/ y6 u7 j: z# @" U9 L5 w: a: K6 Q. g3 T
CKFinder ASP版本是这样处理上传文件的:/ B& ]; r4 g0 E
& ?+ \8 F& U0 p" ^$ n+ i" U
当上传文件名已存在时,会进行迭代重命名,比如file(1).ext存在了,会尝试重命名为file(2).ext……直到不重复为止。4 `1 W+ Y P6 E9 G6 g" r3 b% {
, v& i# d' D" u1 L' @8 A% ~9 D6 }那么现在有趣的事情来了——windows是禁止”con”作为文件名的(关于这个问题我印象中很久以前,win也有过con文件名漏洞,有兴趣可以确认下)$ {. \& B# g' w9 ?1 e1 _: N. v
n" [1 {3 U: ?# o7 Z
dos方法也应运而生!
! C" n- D1 B- z7 m* P, R' h0 f, H4 T; K# K) [( i
. ?1 ?$ O2 i1 g D* F. n; O2 J9 o5 g$ k7 f* @/ W5 a: E
1.上传Con.pdf.txt* U/ l( x; u& {1 O+ w, f6 Y- j
2.CKFinder认为“Con.pdf.txt” 已被占用,于是开始尝试Con.pdf(1).txt,Con.pdf(2).txt……Con.pdf(MaxInt).txt从而对服务器形成致命dos。
# T; H% p2 {; V! }
1 \6 I: c' c: F9 t" e# g |