---
title: "CAPEC-127: Directory Indexing"
url: https://radicalnotion.ai/capec/capec-127
type: capec
description: "An adversary crafts a request to a target that results in the target listing/indexing the content of a directory as output. One common method of triggering directory contents as output is to construct a request containing a path that terminates in a directory name rather than a file name since many applications are configured to provide a list of the directory's contents when such a request is received. An adversary can use this to explore the directory tree on a target as well as learn the names of files. This can often end up revealing test files, backup files, temporary files, hidden files, configuration files, user accounts, script contents, as well as naming conventions, all of which can be used by an attacker to mount additional attacks."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-127: Directory Indexing

- **Abstraction:** Detailed
- **Status:** Draft
- **Typical severity:** Medium
- **Likelihood of attack:** High
- **CAPEC catalog version:** 3.9

## Description

An adversary crafts a request to a target that results in the target listing/indexing the content of a directory as output. One common method of triggering directory contents as output is to construct a request containing a path that terminates in a directory name rather than a file name since many applications are configured to provide a list of the directory's contents when such a request is received. An adversary can use this to explore the directory tree on a target as well as learn the names of files. This can often end up revealing test files, backup files, temporary files, hidden files, configuration files, user accounts, script contents, as well as naming conventions, all of which can be used by an attacker to mount additional attacks.

## Execution flow

### Step 1: Explore

\[Directory Discovery\] Use a method, either manual, scripted, or automated to discover the directories on the server by making requests for directories that may possibly exist. During this phase the adversary is less concerned with whether a directory can be accessed or indexed and more focused on simply discovering what directories do exist on the target.

- Send requests to the web server for common directory names
- If directories are discovered that are native to a server type further refine the directory search to include directories usually present on those types of servers.
- Search for uncommon or potentially user created directories that may be present.

### Step 2: Experiment

\[Iteratively explore directory/file structures\] The adversary attempts to access the discovered directories that allow access and may attempt to bypass server or application level ACLs by using manual or automated methods

- Use a scanner tool to dynamically add directories/files to include their scan based upon data obtained in initial probes.
- Use a browser to manually explore the website by issuing a request ending the URL in a slash '/'.
- Attempt to bypass ACLs on directories by using methods that known to work against some server types by appending data to the directory request. For instance, appending a Null byte to the end of the request which may cause an ACL to fail and allow access.
- Sequentially request a list of common base files to each directory discovered.
- Try multiple fuzzing techniques to list directory contents for directories that will not reveal their contents with a "/" request

### Step 3: Exploit

\[Read directories or files which are not intended for public viewing.\] The adversary attempts to access the discovered directories that allow access and may attempt to bypass server or application level ACLs by using manual or automated methods

- Try multiple exploit techniques to list directory contents for directories that will not reveal their contents with a "/" request
- Try other known exploits to elevate privileges sufficient to bypass protected directories.
- List the files in the directory by issuing a request with the URL ending in a "/" slash.
- Access the files via direct URL and capture contents.
- Attempt to bypass ACLs on directories by using methods that are known to work against some server types by appending data to the directory request. For instance, appending a Null byte to the end of the request which may cause an ACL to fail and allow access.
- Sequentially request a list of common base files to each directory discovered.

## Prerequisites

- The target must be misconfigured to return a list of a directory's content when it receives a request that ends in a directory name rather than a file name.
- The adversary must be able to control the path that is requested of the target.
- The administrator must have failed to properly configure an ACL or has associated an overly permissive ACL with a particular directory.
- The server version or patch level must not inherently prevent known directory listing attacks from working.

## Skills required

- **Low:** To issue the request to URL without given a specific file name
- **High:** To bypass the access control of the directory of listings

## Resources required

- Ability to send HTTP requests to a web application.

## Consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Data | Information Leakage |

## Mitigations

- 1. Using blank index.html: putting blank index.html simply prevent directory listings from displaying to site visitors.
- 2. Preventing with .htaccess in Apache web server: In .htaccess, write "Options-indexes".
- 3. Suppressing error messages: using error 403 "Forbidden" message exactly like error 404 "Not Found" message.

## Example instances

The adversary uses directory listing to view sensitive files in the application. This is an example of accessing the backup file. The attack issues a request for http://www.example.com/admin/ and receives the following dynamic directory indexing content in the response: Index of /admin Name Last Modified Size Description backup/ 31-May-2007 08:18 - Apache/ 2.0.55 Server at www.example.com Port 80 The target application does not have direct hyperlink to the "backup" directory in the normal html webpage, however the attacker has learned of this directory due to indexing the content. The client then requests the backup directory URL and receives output which has a "db\_dump.php" file in it. This sensitive data should not be disclosed publicly.

## Related weaknesses (CWE)

- [CWE-276](https://radicalnotion.ai/cwe/cwe-276): Incorrect Default Permissions
- [CWE-285](https://radicalnotion.ai/cwe/cwe-285): Improper Authorization
- [CWE-288](https://radicalnotion.ai/cwe/cwe-288): Authentication Bypass Using an Alternate Path or Channel
- [CWE-424](https://radicalnotion.ai/cwe/cwe-424): Improper Protection of Alternate Path
- [CWE-425](https://radicalnotion.ai/cwe/cwe-425): Direct Request
- [CWE-693](https://radicalnotion.ai/cwe/cwe-693): Protection Mechanism Failure
- [CWE-732](https://radicalnotion.ai/cwe/cwe-732): Incorrect Permission Assignment for Critical Resource

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-54](https://radicalnotion.ai/capec/capec-54) | Query System for Information |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| ATTACK | File and Directory Discovery | 1083 |

## Frequently asked questions

### What is CAPEC-127?

An adversary crafts a request to a target that results in the target listing/indexing the content of a directory as output. One common method of triggering directory contents as output is to construct a request containing a path that terminates in a directory name rather than a file name since many applications are configured to provide a list of the directory's contents when such a request is received. An adversary can use this to explore the directory tree on a target as well as learn the names of files. This can often end up revealing test files, backup files, temporary files, hidden files, configuration files, user accounts, script contents, as well as naming conventions, all of which can be used by an attacker to mount additional attacks.

### How does a Directory Indexing attack work?

It typically unfolds over 3 phases. It begins with: \[Directory Discovery\] Use a method, either manual, scripted, or automated to discover the directories on the server by making requests for directories that may possibly exist. During this phase the adversary is less concerned with whether a directory can be accessed or indexed and more focused on simply discovering what directories do exist on the target.

### How do you prevent CAPEC-127?

1. Using blank index.html: putting blank index.html simply prevent directory listings from displaying to site visitors.

### What weaknesses does CAPEC-127 target?

CAPEC-127 exploits 7 CWE weaknesses, including CWE-276 (Incorrect Default Permissions), CWE-285 (Improper Authorization), CWE-288 (Authentication Bypass Using an Alternate Path or Channel) and CWE-424 (Improper Protection of Alternate Path).

### How severe is CAPEC-127?

MITRE rates CAPEC-127 as Medium severity with high likelihood of attack.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/127.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-127). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
