I have a URL which displays all of the pdf files at a given dir by visiting the following site location :
http://www.mysite.com/allpdffiles/
Does this present any security vulnerabilities?
|
I have a URL which displays all of the pdf files at a given dir by visiting the following site location : http://www.mysite.com/allpdffiles/ Does this present any security vulnerabilities? |
|||||
|
|
If there are no files in there beside the ones you want to share than it is ok. But make sure you disable indexing for all other directories on the server.
Indexing is considered to be a security threat. More in here: http://www.ducea.com/2006/06/26/apache-tips-tricks-disable-directory-indexes/ |
|||||||||||||||
|
|
It depends on what's in there. Originally the idea behind the web was to provide a catalog of useful information; each file in a public directory contains some piece of information, and an index is automatically generated to make that information accessible. The whole reason why your default file is traditionally called If the directory contains nothing but publicly-accessible files (such as pictures, PDFs, HTML files, or what-have-you), then the auto-generated index is no less secure than an equivalent manually-generated index. But if instead you have some sort of web app -- and particularly one written in PHP or ASP or ASP.NET or a similar language where the application files are stored inside the document root mixed in with the media -- then the auto-generated index may provide links to files that you didn't intend to make public. This is even more true if you have "include" files in there as well. And in that case, this automatic index could make it easier to find files that could lead to a vulnerability. Note that the index itself is not a vulnerability and is not a security risk in itself. Instead, it could assist in locating and exploiting some other security vulnerability on the site. If you have no such vulnerabilities, then the index does not add any risk on its own. Furthermore, all of the practices that could make a directory index dangerous are, themselves, categorically bad practices, and are not made safe simply by removing the index directive. This specifically includes placing server-side code files in your document root. To be safe, you should have ONE file ( |
|||
|
|
|
If you want to allow browsing files in that manner, why not setup a file server? You used the tag web-application, which differs from just providing some PDFs. In that case I would go with what tyler1 stated. |
|||||||
|
|
No. This does not present any security vulnerabilities. It is a perfectly reasonable thing to do. Do make sure that every file in that directory is in fact intended to be made publicly available. Don't put any file you want to keep secret under that directory. (But then, ordinarily you should avoid putting such files anywhere under your web root, so I'm probably not telling you anything overly new.) |
|||
|
|
|
While there is likely no problem in showing the list of files in that particular location, the main risk you run into is when the code passes the folder name as a parameter, possibly from user input. At that point, you have to be very careful to filter the folder parameter to only allow approved folders, or a user could specify other folders like /etc or your web app source code and read all sorts of sensitive data like passwords. |
|||
|
|