Objective
Verify that web server directory indexing is not unintentionally enabled for directories where listing their contents could disclose unnecessary files or information.
Directory indexing occurs when a web server generates a response containing a listing of files and directories because an index resource is absent and directory browsing is permitted.
Directory listings can expose deployment artifacts, backup files, uploaded content, application resources, documentation or other information that was not intended to form part of the public interface.
Some applications intentionally expose directory listings. Report the condition when the listing is unnecessary and creates a meaningful security or information-disclosure risk.
Scope
Review publicly accessible directories including, where applicable:
Prerequisites
| Authorization | Confirm explicit authorization to test the target application. |
|---|---|
| Application inventory | Identify known public directories and application resource locations. |
| Web server | Identify the web server or reverse proxy responsible for serving resources. |
| Expected behavior | Establish whether any directory listing is intentionally required. |
Methodology
The assessment should combine direct HTTP observation with configuration review. A successful directory response alone does not establish that the exposure is a security finding.
| Method | Purpose |
|---|---|
| Application mapping | Identify directories intended to be publicly accessible. |
| HTTP request | Determine whether a directory produces a generated listing. |
| Response inspection | Identify files and metadata disclosed by the listing. |
| Configuration review | Determine whether directory indexing is intentionally enabled. |
Test procedure
Perform directory discovery only against systems for which testing authorization has been granted. Keep request volume proportionate to the assessment.
Directory discovery
Example HTTP request
GET /assets/ HTTP/1.1
Host: example.test
Accept: text/html
Potential response indicators
| Observation | Interpretation |
|---|---|
| Application-generated page | Directory may not be directly indexed. Continue evaluating application behavior. |
| 403 / access denied | Directory access is restricted. |
| 404 / not found | Directory may not be publicly routable. |
| Generated file listing | Directory indexing is potentially enabled and requires further assessment. |
| Redirect to index resource | Review the final destination and determine whether it represents intentional behavior. |
A 200 response does not necessarily indicate directory indexing, and a 403 response does not prove that sensitive files are inaccessible through every route. Review the actual application behavior.
Exposure assessment
The security significance of directory indexing depends primarily on what the listing exposes and whether those resources are intended to be public.
| Exposure | Assessment consideration |
|---|---|
| Public static assets | Usually expected when required by the application's frontend. |
| User uploads | Review whether filenames and metadata are intended to be enumerable. |
| Backup files | Potentially significant if source, configuration or sensitive data is exposed. |
| Internal documentation | Determine whether the information is intended for public users. |
| Temporary files | Usually unnecessary in the public application and should be reviewed. |
| Configuration artifacts | Treat as potentially sensitive and investigate immediately. |
Expected result
Directory contents are not unnecessarily enumerated through public HTTP requests, and resources that require public listing are intentionally documented and contain only information approved for public exposure.
The preferred default for most application directories is to serve known resources rather than expose an automatically generated directory index.
Failure criteria
Consider the procedure failed when directory indexing is unintentionally enabled and the resulting exposure creates a meaningful security or information-disclosure risk.
An application directory generates a public file listing containing deployment and temporary resources that are not required for normal application operation.
Remediation
Disable automatic directory indexing for directories where listing is not required. Remove unnecessary files from the public web root wherever possible.
Recommended approach
- Disable directory indexing by default.
- Remove unnecessary files from public directories.
- Move internal resources outside the public web root.
- Restrict directories that must remain accessible.
- Ensure upload directories expose only intended resources.
- Review deployment pipelines for accidental publication of temporary or backup files.
- Document any intentional public directory listing.
Apache example
<Directory "/var/www/public">
Options -Indexes
</Directory>
Nginx example
location / {
autoindex off;
}
The examples are illustrative. Apply the setting at the correct server, virtual host, location or application layer and confirm that inherited configuration does not override the intended behavior.
Verification
Unnecessary directory listing is no longer publicly available.
The identified directory exposure remains after remediation.
The required directory or verification condition could not be evaluated.
Evidence requirements
Do not publish credentials, tokens, private configuration, personal data or other sensitive information that may have been exposed during testing.
Classification
| WebOTG procedure | WebOTG-SM-004 |
|---|---|
| OWASP category | A02:2025 — Security Misconfiguration |
| Procedure type | Directory listing and indexing review |
| Assessment result | PASS / FAIL / NOT TESTED |
| Finding severity | Determine from the nature and sensitivity of the exposed resources and their resulting security impact. |
WebOTG-SM-004 is a WebOTG-defined verification procedure. The identifier is not an OWASP-defined test identifier.
References
| Source | Relevance |
|---|---|
| OWASP Top 10:2025 — A02 | Security Misconfiguration category. |
| OWASP Web Security Testing Guide | Web server and configuration testing methodology. |
| OWASP ASVS | Application security verification requirements. |
| Web server documentation | Platform-specific directory indexing configuration and behavior. |
WebOTG should maintain source URLs, document versions and review dates centrally through its content-management system so that references can be updated without modifying the procedure template.