Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AllowOverride security issues

There are all sorts of posts out there that advise you on how to add a .htaccess file to remove index.php from the URL. However, in order to get .htaccess files to work, the AllowOverride must be changed (usually to "All").

This tutorial explains that using .htaccess files for mod_rewrite is a misconception and can and should be done in the main config file.

I have been informed by my web security officer that - and I quote - "to change AllowOverride to All increases the risk to the web server as, if exploited, an intruder / hacker / opportunist could override the main servers configuration, which could allow them to get up to allsorts; this would be a serious security breach". I'm not sure how much weight this holds!

So my question is;

  1. are there really serious dangers to changing the AllowOverride
  2. and if so, why is .htaccess being recommended for removing index.php so widely on Stack Overflow?
like image 943
mikelovelyuk Avatar asked Oct 28 '25 08:10

mikelovelyuk


1 Answers

Well there is little bit of security issue with .htaccess in the sense that if a hacker/intruder gets hold of your file system then they can modify rewrite rules and change the behavior of your website. However do remember that if a hacker gets hold of your DOCUMENT_ROOT folder then a lot more damage can be done by modifying/deleting any other code as well and you have much bigger problem in your hand.

However what .htaccess provides you is utmost flexibility by letting you control your website behavior, authentication needs without need to make those changes in Apache config and restart it every time. Especially in a shared hosting environments Apache config is not even accessible for website owners.

like image 186
anubhava Avatar answered Oct 31 '25 07:10

anubhava