Goal#
How to protect your apache server against a LFI vulnerability that can be found with Nikto .
Nikto test#
https://raw.githubusercontent.com/sullo/nikto/master/program/databases/db_tests
Protection#
To do so, you have to disable trailing pathname by disabling the AcceptPathInfo
directive:
- For example edit your vhost configuration:
vim /etc/apache2/vhosts.d/vhostname.conf
(openSUSE)vim /etc/apache2/sites-available/example.com.conf
(Debian/Ubuntu)vim /etc/httpd/sites-available/example.com.conf
(CentOS/RHEL/Fedora)
- And in the
<Directory>
section add the directiveAcceptPathInfo Off
or turn it to Off if already existing - Save your config file
- Restart apache:
systemctl restart apache2.service
(openSUSE)service apache2 restart
(Debian/Ubuntu)systemctl restart httpd.service
(CentOS/RHEL/Fedora)apachectl restart
(generic)