P.Wiaderny (talk | contribs) (Created page with "{{Ckfinder_2.x Securing a Publicly Accessible Folder}} '''Microsoft IIS''' For Microsoft IIS servers, you can enable the <code>X-Content-Type-Options</code> header in your...") |
(No difference)
|
Latest revision as of 11:55, 21 August 2019
When integrating CKFinder, you will often want to give users access to uploaded files, so they can insert images or links to files into the edited content. This requires to make the folder publicly accessible, so all the files are served through the web server. If you rely on your web server to serve the files uploaded with CKFinder, you should take additional steps to make sure the files are served in a secure way.
Let us assume that you have configured your CKFinder to allow uploading of avi files. Even if the avi file is then served with a valid Content-Type: video/x-msvideo
header, some browsers may ignore this information and perform additional checks on the raw file contents. If any HTML-like data is detected in the file content, the browser may decide to ignore information about the content type and handle the served content as if it was a regular web page. This behavior is called content sniffing (also known as media type sniffing or MIME sniffing), and in some circumstances, it may lead to security issues (for example, it may open door for XSS attacks).
To avoid content sniffing, you should make sure that your server adds the X-Content-Type-Options: nosniff
header to all HTTP responses when serving files from the publicly available folder. The X-Content-Type-Options
response HTTP header is a marker used by the server to indicate that the MIME type set by the Content-Type
header should not be changed and should be followed. As a result, the browser does not perform any content sniffing on the received content.
Microsoft IIS
For Microsoft IIS servers, you can enable the X-Content-Type-Options
header in your web.config
file:
<system.webServer> <httpProtocol> <customHeaders> <remove name="X-Content-Type-Options"/> <add name="X-Content-Type-Options" value="nosniff"/> </customHeaders> </httpProtocol> </system.webServer>