Directory listing
| Class | Security misconfiguration |
|---|---|
| Also known as | Directory indexing, directory browsing, open directory, autoindex |
| CWE | CWE-548: Exposure of Information Through Directory Listing |
| OWASP Top 10 | A02:2025 Security Misconfiguration; the CWE is mapped to A01:2025 Broken Access Control |
| Typical severity | Medium, higher when the folder holds backups, dumps or keys |
| Affects | nginx, Apache, IIS and Caddy with listing switched on, Vercel projects with the setting on, Python http.server |
A request for https://example.com/uploads/ ends in a slash and names a folder. Most web servers first look in that folder for an index file such as index.html and send it. When none exists, a server with directory listing switched on builds a page of its own instead: every file and subfolder in the folder, each one a link, usually with its size and the date it last changed.12 The visitor can then open any of those files, including ones the site never linked to.3
How the listing is produced
In nginx the listing comes from the autoindex module, which handles requests whose path ends in a slash after the index module has found no index file.2 In Apache, the core Options directive decides: with Indexes set and no file named by DirectoryIndex in the folder, mod_autoindex returns a formatted list.1 Caddy lists a folder only when its file_server directive carries the browse option.4 IIS keeps the switch in the enabled attribute of <directoryBrowse>.5
| Server | Setting | Default |
|---|---|---|
| nginx | autoindex on | off | autoindex off |
| Apache 2.4 | Options Indexes | Options FollowSymlinks, but the sample httpd.conf sets Options Indexes FollowSymLinks on the document root |
| IIS 7 and later | <directoryBrowse enabled="..."> | false |
| Caddy | file_server browse | Off unless browse is given |
| Vercel | Directory Listing under Advanced | Off for projects created from 12 January 2021 |
Python http.server | None | Lists any folder without an index page |
The listings are easy to read by script as well as by eye. nginx can return the list as XML, JSON or JSONP, Caddy answers in JSON or plain text when the request asks for it in the Accept header, and Apache accepts query arguments that sort the list by date or keep only names that match a pattern.249
Why listings end up switched on
Most major web servers leave listing off when no setting names it.10 An explicit line turns it on, and Apache's own sample configuration carries one: Options Indexes FollowSymLinks in the block for the web root, so a server set up from that file lists any folder without an index file.61 Censys, an internet scanning company that counted open folders in 2023, suggested an administrator who turned listing on to fetch old files from a server and never cleaned up afterwards. Another cause it named is python -m http.server, which shares the folder it was started in for as long as the process runs.10 The Python documentation warns against that module in production, since it performs only basic security checks.8
Until 12 January 2021, Vercel listed any deployed folder without an index file, and turning that off took a rewrite rule in vercel.json; the change of that date switched listing off for newly created projects only.7 In Apache, a .htaccess file can switch Indexes on for one folder when the main configuration allows that override.1
What a listing exposes
A listing hands over the file names and dates, which can describe what a file holds, and it leads to files that were placed in the web root without a link, such as source code or private data.3 The Censys survey found 477,330,039 files in open folders on 313,750 hosts, more than 2,000 TB in all. Database file paths held the word "backup" 713 times and "dump" 334 times, and the files that may hold credentials included .htpasswd files, SSH private keys and Unix password files.10 In one published attack scenario, the attacker browses a listed folder, downloads compiled Java classes, decompiles them and finds an access control flaw in the code.11
The OWASP Top 10:2025 files the weakness in two places. Its CWE is mapped to Broken Access Control (A01), whose advice includes disabling listing, while that scenario sits in the Security Misconfiguration chapter (A02).1211 Older editions filed the weakness under Security Misconfiguration (2013) and Insecure Configuration Management (2004).3 Cloud storage that lets anyone list a bucket is covered in Public cloud storage bucket.
Turning it off
# nginx: in http, server or location
autoindex off;
# Apache: in <Directory> or .htaccess
Options -Indexes
# Caddy: serve files without browse
file_server
<!-- IIS: web.config -->
<system.webServer>
<directoryBrowse enabled="false" />
</system.webServer>On Vercel, open the project settings, choose Advanced and turn Directory Listing off; a request for a folder then gets a 404 response. An index file in one folder (any extension except .css) hides that folder alone. A custom 404 page does not stop the listing.13
Switching the listing off hides the names but leaves every file reachable by anyone who guesses its path. Backup files and repository metadata such as .git also have to leave the web root.12 Apache's IndexIgnore only drops names from a listing that stays on.9 Backups, the .git folder and source maps each have an article: Exposed backups, Exposed .git folder and Source maps in production.
In SecFlash
SecFlash reports a folder whose files the server lists as SF-SEC-615 on the Security page. On the Cloud page it reports a Vercel project with the setting on as SF-CLD-403. A macOS .DS_Store file, which holds the names of the files next to it, appears on the Exposure page as SF-EXP-414.
See also
- Common types of attack on web applications
- Exposed sensitive files
- Exposed backups
- Exposed .git folder
- Public cloud storage bucket
- Path traversal
- Category: Security misconfiguration
- Category: Reconnaissance
References
- a b c d e Apache Software Foundation. "Options Directive". Apache HTTP Server 2.4 documentation, core features.
- a b c d "Module ngx_http_autoindex_module". nginx documentation.
- a b c MITRE. "CWE-548: Exposure of Information Through Directory Listing". Common Weakness Enumeration.
- a b c Caddy. "file_server". Caddy documentation.
- a b Microsoft. "Directory Browse <directoryBrowse>". Microsoft Learn, IIS configuration reference.
- a b Apache Software Foundation. "httpd.conf.in". Apache HTTP Server source, 2.4.x branch.
- a b Vercel (2021, January 12). "Listing the content of directories can now be toggled". Vercel changelog.
- a b Python Software Foundation. "http.server: HTTP servers". Python 3 documentation.
- a b Apache Software Foundation. "Apache Module mod_autoindex". Apache HTTP Server 2.4 documentation.
- a b c TechRepublic (2023, September 29). "Censys Reveals Open Directories Share More Than 2,000 TB of Unprotected Data". TechRepublic.
- a b "A02:2025 Security Misconfiguration". OWASP Top 10:2025. OWASP Foundation.
- a b "A01:2025 Broken Access Control". OWASP Top 10:2025. OWASP Foundation.
- back Vercel (2026, February 26). "Using the Directory Listing". Vercel documentation.
External links
- CWE-548: Exposure of Information Through Directory Listing, MITRE
- Module ngx_http_autoindex_module, nginx documentation