Guides · ← All guides
Directory Listing Enabled: What It Shows Attackers and How to Disable It
Published: November 14, 2026 · Last reviewed: November 14, 2026 · 7 min read
Run a free BreachHunter assessment on your site →
Nobody enables directory listing on purpose in 2026. It survives as a default: a new virtual host, a migrated server, a static-file container configured in a hurry. Then a folder that was never meant to be browsed — /uploads/, /backup/, /assets/ — answers a bare request with its full contents, neatly linked.
This guide explains what a listing actually gives an attacker beyond the filenames themselves (timestamps, sizes, and a crawlable index of everything your other controls forgot), how it compounds the sensitive-path findings, and the exact disable directives for Apache, nginx and IIS, plus the empty-index alternative for static hosts.
What does a directory listing really reveal?
Start with names: backup-2024.zip, db-export.sql, .env.bak — the listing turns the attacker's guessing game (the wordlist probing in exposed backup files) into reading comprehension. Add sizes and modification dates and they can pick the freshest, fullest archive without downloading anything else.
Uploads folders are the second gift. A listing of /uploads/ exposes every user-submitted file by name — invoices, ID scans, contracts — many of which were “protected” only by the assumption that nobody could guess the URL. And because listings are ordinary HTML pages full of links, search engines have indexed them: a query for your domain plus a filetype can surface files you did not know were public.
Why is the fix global, not per-folder?
Per-folder fixes rot. The folder you protected stays protected; the new folder a plugin creates next quarter inherits the server default. The durable fix is the default itself: Options -Indexes in Apache, autoindex off (the default — so a listing means someone turned it on, or another module serves it) in nginx, and directoryBrowse disabled in IIS.
Verify the way the scanner does: request several bare directory paths — /uploads/, /images/, /backup/, /assets/ — and confirm each returns 403 or 404, never a listing. A 403 is fine and even preferable: it confirms the folder exists but refuses the map, and the assessment's directory-discovery phase records exactly that distinction.
Worked example: summittrail.example
Summit Trail Outfitters, a retailer with a seasonal catalog, migrated hosts in spring. The new server's default vhost had Indexes on. Its assessment found the /assets/ tree browsable, and inside the listing sat the migration working files nobody had deleted:
Index of /assets/migration/ old-catalog-export.csv 2026-03-02 4.1M customer-list-backup.csv 2026-03-02 2.8M site-backup-pre-migration.zip 2026-03-01 212M
The CSV named “customer-list” is the line that turned a hygiene fix into an incident review: the file was removed, the server default flipped to -Indexes, and every directory the scanner probed retested at 403. The zip and exports were deleted rather than merely hidden — a listing is a symptom, and in this case the disease was working files living in a public tree at all.
The five actions to take
Killing directory listing properly, once:
- Probe your own site first: request /uploads/, /assets/, /images/, /backup/ and note any that return a listing.
- Disable listing at the server or vhost level (Apache: Options -Indexes; nginx: autoindex off; IIS: directoryBrowse enabled=false).
- Delete working files, exports and backups from the public tree — hiding them behind 403 is not the same as removing them.
- Add an empty index.html in any folder a static host insists on serving, as a second layer.
- Re-scan and confirm every probed directory returns 403 or 404, then repeat the probe after your next migration or plugin install.
Run a free BreachHunter assessment on your site →
Frequently asked questions
Is a directory listing a vulnerability or just hygiene?
It is information disclosure that functions as an attack accelerator: it converts blind file-guessing into a browsable index and has exposed everything from database dumps to customer exports. Scanners file it as a real finding, and incident reports keep citing it as the first step.
The listing only shows images. Is that still a problem?
Less severe, but still fix it at the default level. Today's image folder is tomorrow's upload target, and the listing also confirms your server software and path layout. The global fix costs the same whether the folder matters or not.
Why did this appear after we changed hosts?
Because listing is a server default, not a site setting. Migrations reset it. That is why the checklist ends with re-probing after any migration — it belongs on the go-live runbook next to the TLS checks.
403 or 404 for directories — which is better?
Either passes an assessment. 403 honestly says “exists, refused”; 404 says nothing. Security-through-404 is marginally quieter, but do not contort a server to achieve it — the listing being gone is the substance.
Can search engines index a directory listing?
Yes — listings are link-rich HTML and crawlers follow them, which is how “unlisted” upload files end up in search results. After disabling, use your search console's removal tool for any listing URLs already indexed.
Where listings hide after the main fix
Turning listings off on the main site is the easy half. They survive in the corners: the staging vhost that inherited a different config, the old /assets/ tree served by a CDN origin with its own rules, the backup virtual host your host provisions silently. Apache adds a subtler trap — a .htaccess file deep in the tree can re-enable Options Indexes for one directory while the global config says off.
So verify by walking, not by trusting the config. Request a handful of real directories — uploads, images, backups, includes — from outside, logged out, and read what each returns. A listing anywhere is the finding, even if the homepage's folders are locked down tight.
Sources
The primary sources behind this guide — the documents we check our own work against:
- Apache httpd 2.4 — mod_autoindex documentation (2024) — the module that generates listings, and the Options flag that turns it off.
- nginx — ngx_http_autoindex_module documentation (2024) — the autoindex directive and its default state.