感谢生生不息在freebuf社区”分享团”里给出线索,才有了本文6 w- @: h/ H, W& L4 _" \* `
6 I* R* V# B( g' [原帖:http://club.freebuf.com/?/question/129#reply12. \9 k A/ V6 |# s# ^) X- l" u
, {: [6 T; F* u# X
FCKEditor 2.6.8文件上传漏洞! W' k" H! m! l' E: S2 c6 B% {
9 s6 t7 [: ]( WExploit-db上原文如下:
. q2 E% ]2 T2 p1 J* C+ C6 T
. M3 _2 K% l) K$ K/ u- Title: FCKEditor 2.6.8 ASP Version File Upload Protection bypass
4 u7 Y! e) R/ ?+ m- Credit goes to: Mostafa Azizi, Soroush Dalili
& S5 a. [; J5 r ^. P- Link:http://sourceforge.net/projects/fckeditor/files/FCKeditor/
$ `3 E' }) X0 i+ C7 l4 S: T- Description:( d* b% r" x# h+ d# s6 E4 _# ?
There is no validation on the extensions when FCKEditor 2.6.8 ASP version is
8 A* A `( ^- B' {* S. j: I& [dealing with the duplicate files. As a result, it is possible to bypass G0 M% U; T- h8 x
the protection and upload a file with any extension.
/ V: _$ R& T8 F; M0 H) }6 N- Reference: http://soroush.secproject.com/blog/2012/11/file-in-the-hole/
0 V2 L- l) f$ v/ n- Solution: Please check the provided reference or the vendor website.
, K# Q. c. ^# J
7 D: T% C) L0 g( O- PoC:http://www.youtube.com/v/1VpxlJ5 ... ;rel=0&vq=hd720' e' ]/ T# y* d) s( H0 V- S$ a4 S
"
1 W1 |2 z* [7 dNote: Quick patch for FCKEditor 2.6.8 File Upload Bypass:3 l) R2 {, g$ k: q2 |
3 l5 b7 q* ~9 a% z; F% H1 g
In “config.asp”, wherever you have:( {# m( ~5 A4 {7 T9 t# A3 X1 j
ConfigAllowedExtensions.Add “File”,”Extensions Here”) {+ Y, W4 i* D! z
Change it to:
7 Z4 _! b% Y$ c( T& D+ P ConfigAllowedExtensions.Add “File”,”^(Extensions Here)$”在视频(需翻墙)里,我们可以看的很清楚:" w' y6 R2 T( X) ]
8 ]8 I" w# e" F9 M9 w1.首先,aspx是禁止上传的4 V$ [3 q: s# W/ d7 L }2 C1 g
2.使用%00截断(url decode),第一次上传文件名会被转成_符号
; E6 k0 B. @- @6 i3 h# }5 Q! B$ Q. t" a
- a l4 I- C; s$ k2 ]& |
3 P1 W) @% s$ n3 d$ f3 F
接下来,我们进行第二次上传时,奇迹就发生了" j$ P% E/ `( ~8 e1 l8 t
8 G0 q+ I8 g0 o. L! R
2 s) ?1 @( F2 X$ `
5 i/ i" R2 Z8 `) \$ e8 Y代码层面分析可以看下http://lanu.sinaapp.com/ASPVBvbscript/121.html
! L: C1 \" _! o; t- k" m H3 A' f$ V
9 P/ }* W2 k, U' g7 x
+ M5 {: S3 c0 B) f Z$ e
CKFinder/FCKEditor DoS漏洞8 ~7 l T3 w% a; F
9 m9 g! u4 z% A2 }相比上个上传bug,下面这个漏洞个人觉得更有意思
5 G; K5 j, ?) @) c/ |
, Y- k( \) @3 h$ g- ?* s0 T+ _8 J8 i , _$ R, [9 a v
! {9 u/ C# Z* G% l" l) KCKFinder是一个强大而易于使用的Web浏览器的Ajax文件管理器。 其简单的界面使得它直观,快速学习的各类用户,从高级人才到互联网初学者。 & H# R3 ~, K7 ~1 n K8 M1 v2 a. q
. z! d: |" W; S! yCKFinder ASP版本是这样处理上传文件的:
: g8 x0 b( l- }2 A! u3 h B. |2 m/ q {+ m
当上传文件名已存在时,会进行迭代重命名,比如file(1).ext存在了,会尝试重命名为file(2).ext……直到不重复为止。
: y, U5 L6 r. b. {
% F, n3 b' K7 c- ~; I& _: k T那么现在有趣的事情来了——windows是禁止”con”作为文件名的(关于这个问题我印象中很久以前,win也有过con文件名漏洞,有兴趣可以确认下)1 E0 |& Y( x% O; Z: f
8 w2 s5 m& |) f. Y* ^dos方法也应运而生!# c3 l! D, d- ~1 K3 ]; b1 D
2 U3 ]7 T* |* z! a6 l5 y) Q
" C t; s# T- b( ?, m$ g
2 M1 {5 X8 n0 v, T1.上传Con.pdf.txt
@# V# v w8 F2.CKFinder认为“Con.pdf.txt” 已被占用,于是开始尝试Con.pdf(1).txt,Con.pdf(2).txt……Con.pdf(MaxInt).txt从而对服务器形成致命dos。9 N) R1 Q! d& L l% ?8 P
' r( y; E x0 O% Q$ c. I# [7 M |