Directory Listing Enabled
The web server lists the contents of directories that have no index page, revealing files that were never meant to be linked or downloaded.
| Severity | Medium |
| CVSS 3.1 | 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N Open in the calculator |
| CVSS 4.0 | 6.9 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-548: Exposure of Information Through Directory Listing |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1594 Search Victim-Owned Websites |
| Category | Information Disclosure |
Description
When a request is made for a directory that has no default document, such as index.html, the web server generates and returns a list of every file and subdirectory in it. Automatic indexing is a feature of most web servers, including mod_autoindex in Apache httpd, the autoindex module in nginx, directory browsing in IIS and the default servlets of Java application servers, and it is enabled either in the global configuration or for particular directories.
The weakness lies in what the listings expose. Files that are not linked from the application can normally be found only by guessing their names; a listing removes that obstacle, and an attacker can browse the listed directories and download any file the web server will serve from them. That includes content never intended to be public, such as backup copies that contain source code or credentials, archives, other users' uploaded documents, logs, configuration and include files, temporary files and old versions of scripts. Even where nothing sensitive is listed, the structure and file names help an attacker map the application and plan further attacks.
The issue is identified by requesting directory paths, including those found in page source, scripts and other responses, and looking for the server's characteristic "Index of" pages or their equivalent. Scanners report it wherever a listing is returned. What an attacker gains is limited to what the listed directories contain, so the severity depends on them: a listing of public images is of little consequence, whereas one of an uploads or backup directory can expose sensitive data.
Remediation
- Disable automatic directory listings globally, and enable them only for directories that are deliberately meant to be browsed.
- Review the directories that were listed and remove anything that should not be on the web server, such as backups, archives, logs and old files. Move uploaded files and other data outside the web root or behind an access-controlled download handler.
- Rotate any credentials or keys found in files that were exposed.
For Java application servers, make sure the default servlet's listings parameter is false, as it is by default in Apache Tomcat. An empty index file in each directory hides the listing but is not a substitute for disabling the feature. Confirm the fix by requesting the previously listed directories and checking that a 403 or 404 response is returned.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.