Dealing with Double File Extensions

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

(<pre> changed to <source> with PHP syntax coloring)
(CheckDoubleExtension replaced the {{{config}}} variable)
 
Line 1: Line 1:
{{Ckfinder_2.x Double extensions Description|code=<source lang="php">$config['CheckDoubleExtension'] = true ;</source>}}
+
{{Ckfinder_2.x Double extensions Description|code=<source lang="php">$config['CheckDoubleExtension'] = true ;</source>|config=CheckDoubleExtension}}

Latest revision as of 14:13, 29 March 2011

Due to security issues with Apache modules it is recommended to leave the following setting enabled:

$config['CheckDoubleExtension'] = true ;

How does it work? Suppose the following scenario:

If php is added to the denied extensions list, a file named foo.php cannot be uploaded. If rar (or any other) extension is added to the allowed extensions list, one can upload a file named foo.rar. The file foo.php.rar has a rar extension so in theory, it can also be uploaded.

Under some circumstances Apache can treat the foo.php.rar file just like any other PHP script and execute it. If CheckDoubleExtension is enabled, each part of the file name after a dot is checked, not only the last part. If extension is disallowed, the dot (.) is replaced with an underscore (_). So the uploaded file foo.php.rar will be renamed into foo_php.rar.

This page was last edited on 29 March 2011, at 14:13.