Misconfiguration in LIMIT directive of .htaccess file
High Web Application Scanning Plugin ID 98095
SynopsisMisconfiguration in LIMIT directive of .htaccess file
DescriptionThere are a number of HTTP methods that can be used on a webserver (for example `OPTIONS`, `HEAD`, `GET`, `POST`, `PUT`, `DELETE `etc.). Each of these methods perform a different function, and each has an associated level of risk when their use is permitted on the webserver.
The `<Limit>` directive within Apache's `.htaccess` file allows administrators to define which of the methods they would like to block. However, as this is a blacklisting approach, it is inevitable that a server administrator may accidentally miss adding certain HTTP methods to be blocked, thus increasing the level of risk to the application and/or server.
SolutionThe preferred configuration is to prevent the use of unauthorised HTTP methods by utilising the `<LimitExcept>` directive.
This directive uses a whitelisting approach to permit HTTP methods while blocking all others not listed in the directive, and will therefor block any method tampering attempts.
Most commonly, the only HTTP methods required for most scenarios are `GET` and `POST`. An example of permitting these HTTP methods is: `<LimitExcept POST GET> require valid-user </LimitExcept>`