I took over a website which I'm supposed to admin and somebody brought to my attention that certain Indexes and Files are available, which shouldn't be. I will be using dummy names.
You were able to access example.com/intern
before, but I changed a line in /etc/apache2/apache2.conf
according to this https://stackoverflow.com/a/31445273 . This worked partly, as I get a 403-Forbidden when I now navigate to example.com/intern
and that's basically what I want.
However the directory intern
governs a file called file.php.bak
aswell as file.php
. When I navigate to example.com/intern/file.php
I get a white website. I am however not sure, if you are able to access file.php
in another way, because the site does load and I don't get a 403 like before. What is way worse and the reason I am struggling with this is: If I go to example.com/intern/file.php.bak
then my Browser (Firefox) offers me to download file.php.bak
, which I can read in plaintext. I want all files in intern
to not be accessible via the website, but I have no idea how to do this. Can anybody help?
Things I've tried:
Removing the Indexes from the
apache2.conf
file like mentioned above. It only puts the 403 on the directory itself and not recursively for all the files in it.Writing a
.htaccess
file as described here: https://fedingo.com/how-to-prevent-direct-file-download-in-apache-server/ and putting it inintern
with the same result as in 1)Putting an empty
index.html
file in theintern
directory. This leads to no more 403 inexample.com/intern
, but the download onexample.com/intern/file.php.bak
is still possible. I've also triedindex.php
with the same result.
File System:
The application runs from /var/www/application
which is also the folder for the /var/www/application/index.php
I want to use. The /var/www/application/intern
directory is also there. While it isn't browsable anymore, the files in it still are accessible. /var/www/application/intern/file.php
can be navigated to via example.com/intern/file.php
, but it seems like it can't be downloaded or read as it results in a white page. /var/www/application/intern/file.php.bak
can however be downloaded via example.com/intern/file.php.bak
.