[{"data":1,"prerenderedAt":20},["ShallowReactive",2],{"fix-directory-listing":3},{"id":4,"slug":5,"title":6,"description":7,"bucket":8,"severity":9,"status":10,"publishedAt":11,"summary":12,"affectedCheck":13,"fixSteps":14,"agenticPrompt":15,"references":16},"fix-directory-listing","directory-listing","Your server is listing directory contents","Directory listing turns your web server into a file browser, exposing backups, dumps and files you never meant to publish. Here is how to check and switch it off.","LONG_STANDING_VULNERABILITY","medium","published","2026-11-23T09:10:00.000Z","\u003Cp>When a web server receives a request for a directory with no index file, it can do one of two things: refuse, or list what is inside. Listing is the unhelpful option, and on some configurations it is the default.\u003C\u002Fp>\n\u003Cp>The listing itself is not the vulnerability. The problem is that it removes the need to guess. Files nobody linked to, and nobody expected to be found, become browsable: database dumps, \u003Ccode>backup.zip\u003C\u002Fcode>, \u003Ccode>site-old\u002F\u003C\u002Fcode>, editor swap files, spreadsheets, invoices, build output with internal paths in it.\u003C\u002Fp>\n\u003Cp>Treat this as a disclosure issue that makes every other weakness easier to find. It is usually a few minutes of work to fix and it closes off a whole category of casual discovery.\u003C\u002Fp>","\u003Cp>Request a directory on your own site that has no index page, for example:\u003C\u002Fp>\n\u003Cpre>https:\u002F\u002Fyour-domain.com\u002Fassets\u002F\nhttps:\u002F\u002Fyour-domain.com\u002Fuploads\u002F\nhttps:\u002F\u002Fyour-domain.com\u002Fbackups\u002F\u003C\u002Fpre>\n\u003Cp>If you see a bare table of filenames with a title like \u003Ccode>Index of \u002Fuploads\u003C\u002Fcode>, listing is on. A \u003Ccode>403\u003C\u002Fcode> or \u003Ccode>404\u003C\u002Fcode> is the correct response.\u003C\u002Fp>\n\u003Cp>While you are there, look at what the listing reveals. Anything sensitive in those directories should be treated as already downloaded.\u003C\u002Fp>","\u003Ch3>1. Turn listing off\u003C\u002Fh3>\n\u003Cp>For nginx, make sure autoindex is off. It is off by default, so an explicit \u003Ccode>autoindex on;\u003C\u002Fcode> somewhere is usually the cause:\u003C\u002Fp>\n\u003Cpre>autoindex off;\u003C\u002Fpre>\n\u003Cp>For Apache, remove the \u003Ccode>Indexes\u003C\u002Fcode> option:\u003C\u002Fp>\n\u003Cpre>Options -Indexes\u003C\u002Fpre>\n\u003Ch3>2. Move what should never have been published\u003C\u002Fh3>\n\u003Cp>Switching listing off hides the index, not the files. Anyone who guesses a filename can still fetch it. Move backups, dumps and archives out of the published directory altogether.\u003C\u002Fp>\n\u003Ch3>3. Rotate anything a dump contained\u003C\u002Fh3>\n\u003Cp>If a database dump or an archive of your application was exposed, treat its contents as read, and rotate any credential inside it.\u003C\u002Fp>\n\u003Ch3>4. Stop writing backups into the web root\u003C\u002Fh3>\n\u003Cp>This usually comes from a convenience script or a plugin writing to a path under the document root. Fix the script, not just today's files, or the problem returns with the next backup.\u003C\u002Fp>","You are helping me fix a security misconfiguration on a website I own and operate.\n\nProblem: my web server lists directory contents when there is no index file, exposing files I never intended to publish.\n\nWork through the following in order, and confirm with me before deleting or moving anything.\n\n1. Identify the web server and the directory it publishes. Tell me how you concluded that.\n2. Find the configuration that enables directory listing: autoindex on for nginx, or Options Indexes for Apache. Report every place it is set, including included config files and .htaccess.\n3. Give me the exact change that disables it for this server, and nothing broader than necessary.\n4. Inventory the published directory for files that should not be public. Look for database dumps (.sql, .dump), archives (.zip, .tar, .tar.gz, .bak), editor and swap files (.swp, ~, .orig, .save), spreadsheets and documents, private keys (.pem, .key, .p12), and any directory named like backup, old, temp, or copy.\n5. Classify that inventory by sensitivity, and recommend for each whether to move it out of the published directory or delete it. Do not delete anything yourself: list it and wait for me.\n6. If any dump or archive is likely to contain credentials, tell me so and produce a rotation checklist naming each credential and where it is rotated. Never print a secret value.\n7. Check whether anything in this repository or its scripts writes backups into the published directory, and propose a fix so the problem does not come back with the next backup run.\n8. Add an index file or an explicit deny rule for directories that are meant to stay browsable to nobody.\n\nFinish with a summary of what you changed and an ordered list of what I must do by hand.",[17],{"label":18,"href":19},"OWASP Top 10: Security Misconfiguration","https:\u002F\u002Fowasp.org\u002FTop10\u002FA05_2021-Security_Misconfiguration\u002F",1795449486729]