Project: WASC Threat Classification
Threat Type: Weakness
Reference ID: WASC-16
Automatic directory listing/indexing is a web server function that lists all of the files within a requested directory if the normal base file (index.html/home.html/default.htm/default.asp/default.aspx/index.php) is not present. When a user requests the main page of a web site, they normally type in a URL such as: http://www.example.com/directory1/ - using the domain name and excluding a specific file. The web server processes this request and searches the document root directory for the default file name and sends this page to the client. If this page is not present, the web server will dynamically issue a directory listing and send the output to the client. Essentially, this is equivalent to issuing an "ls" (Unix) or "dir" (Windows) command within this directory and showing the results in HTML form. From an attack and countermeasure perspective, it is important to realize that unintended directory listings may be possible due to software vulnerabilities (discussed in the example section below) combined with a specific web request.
When a web server reveals a directory's contents, the listing could contain information not intended for public viewing. Often web administrators rely on "Security Through Obscurity" assuming that if there are no hyperlinks to these documents, they will not be found, or no one will look for them. The assumption is incorrect. Today's vulnerability scanners, such as Wikto, can dynamically add additional directories/files to include in their scan based upon data obtained in initial probes. By reviewing the /robots.txt file and/or viewing directory indexing contents, the vulnerability scanner can now interrogate the web server further with these new data. Although potentially harmless, Directory Indexing could allow an information leak that supplies an attacker with the information necessary to launch further attacks against the system.
Client issues a request for - http://www.example.com/admin/ and receives the following dynamic directory indexing content in the response -
Index of /admin
Name Last modified Size Description
-----------------------------------------------------------------
Parent Directory -
backup/ 31-Mar-2003 08:18 -
-----------------------------------------------------------------
Apache/2.0.55 Server at www.example.com Port 80
As you can see, the directory index page shows that there is a sub-directory called "backup". There is no direct hyperlink to this directory in the normal html webpages however the client has learned of this directory due to the indexing content. The client then requests the backup directory URL and receives the following output -
Index of /admin/backup
Name Last modified Size Description
-----------------------------------------------------------------
Parent Directory 10-Oct-2006 01:20 -
WS_FTP.LOG 18-Jul-2003 14:59 4k
db_dump.php 18-Jul-2003 14:59 2k
dump.txt 28-Jun-2007 20:30 59k
dump_func.php 18-Jul-2003 14:59 5k
restore_db.php 18-Jul-2003 14:59 4k
-----------------------------------------------------------------
Apache/2.0.55 Server at www.example.com Port 80
As you can see, there is sensitive data within this directory (such as DB dump data) that should not be disclosed to clients. Also note that files such as WS_FTP.LOG can provide directory listing information as this file lists client and server directory content transfer data. An example WS_FTP.LOG file may look like this -
101.08.27 17:56 B C:\unzipped\admin\backup\db_dump.php --> 192.168.1.195 /public_html/admin/backup db_dump.php
101.08.27 17:56 B C:\unzipped\admin\backup\dump.txt --> 192.168.1.195 /public_html/admin/backup dump.txt
101.08.27 17:56 B C:\unzipped\admin\backup\dump_func.php --> 192.168.1.195 /public_html/admin/backup dump_func.php
101.08.27 17:56 B C:\unzipped\admin\backup\restore_db.php --> 192.168.1.195 /public_html/admin/backup restore_db.php
101.08.27 18:02 B C:\unzipped\admin\backup\db_dump.php --> 192.168.1.195 /public_html/admin/backup db_dump.php
The following information could be obtained based on directory indexing data:
There are three different scenarios where an attacker may be able to retrieve an unintended directory listing/index:
Wikto
[1] http://www.sensepost.com/research/wikto/using_wikto.pdf
Directory Indexing Vulnerability Alerts
[2] http://www.securityfocus.com/bid/1063
[3] http://www.securityfocus.com/bid/6721
[4] http://www.securityfocus.com/bid/8898
Nessus "Remote File Access" Plugin Web page
[5] http://cgi.nessus.org/plugins/dump.php3?family=Remote%20file%20access
The Google Hacker's Guide
[6] http://johnny.ihackstuff.com/security/premium/The_Google_Hackers_Guide_v1.0.pdf
Information Leakage
[7] http://projects.webappsec.org/Information-Leakage
Information Leak Through Directory Listing
Insert links to other pages or uploaded files.
Tip: To turn text into a link, highlight the text, then click on a page or file from the list above.
Comments (0)
You don't have permission to comment on this page.