| home | forums | resources | search | news | join | members: 5949 |
|
php | Mon, 2008-06-30 02:59 tags: How to tell Apache to be more strict about files with multiple extensions. The bolded text is what was necessary to make the browser show PHP as plain text on Dreamhost. One necessary approach to solve this vulnerability is to use a better value with fileDenyPattern within your application. On the other side, another approach could be to modify the Apache configuration (maybe through a .htaccess file on shared webhosting) to make Apache less "sloppy" (from our perspective) when dealing with multiple file extensions. In the unlikely case there are already files existing in your webspace you might consider to force Apache to definitely only treat files as PHP scripts that have a file name with ".php" as final extension. This will display the content of the files as text/plain:
This will deny to access the files via HTTP at all:
Make sure that you don't "switch off" PHP files that belong to the TYPO3 system, so don't use the FilesMatch directive in a place where it can affect the contents of the folders typo3, typo3conf or t3lib. A more general approach to prevent Apache's multiple file type handling would be to unregister PHP file types and only map files based on their last extension to their according handler. In our case putting: ForceType text/plain or RemoveType .php .php3 .php4 .php5 .php6 .phps .pht .phtml into virtual host configuration or an .htaccess file would make the trick. Then we register the handler again according to the last file extension with
Caution: According to our experiences, when using Debian based Linux distributions, you additionally have to comment/remove the listed PHP mime types from /etc/mime.types. Otherwise the changes above don't have any effect. |
Drupal London Hotels
Silverlight Laptop Reviews
Joomla! Just Dial International Calls
Content Management Systems Excel Training Courses
PHP excel courses in london
Wordpress Data Recovery
Windows Cheap Personal & Secured Loans
Content Management Systems Sell Online
Adobe Flex
|
NewsletterGet updates on Hiveminds services, articles and downloads by signing up for the newsletter. |
Editor's choiceSome of the better articles, stories and tutorials found at Hiveminds. |
Find moreFind more of Hiveminds articles, stories, tutorials and user comments by searching. |
Picked linksHand picked websites and articles from around the web that provide quality reading. |