CAPEC-127

Directory Indexing
HIGH
MEDIUM
Draft
2014-06-23 00:00 +00:00
2021-06-24 00:00 +00:00

Alerte pour un CAPEC

Stay informed of any changes for a specific CAPEC.
Alert management

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.

Informations

Execution Flow

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.

Technique
  • 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.

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

Technique
  • 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

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

Technique
  • 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

To issue the request to URL without given a specific file name
To bypass the access control of the directory of listings

Resources Required

Ability to send HTTP requests to a web application.

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.

Related Weaknesses

CWE-ID Weakness Name
CWE-424 Improper Protection of Alternate Path
The product does not sufficiently protect all possible paths that a user can take to access restricted functionality or resources.
CWE-425 Direct Request ('Forced Browsing')
The web application does not adequately enforce appropriate authorization on all restricted URLs, scripts, or files.
CWE-288 Authentication Bypass Using an Alternate Path or Channel
A product requires authentication, but the product has an alternate path or channel that does not require authentication.
CWE-285 Improper Authorization
The product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action.
CWE-732 Incorrect Permission Assignment for Critical Resource
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.
CWE-276 Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
CWE-693 Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.

References

REF-11

WASC Threat Classification 2.0
http://projects.webappsec.org/Directory-Indexing

Submission

Name Organization Date Date Release
CAPEC Content Team The MITRE Corporation 2014-06-23 +00:00

Modifications

Name Organization Date Comment
CAPEC Content Team The MITRE Corporation 2015-11-09 +00:00 Updated References, Related_Attack_Patterns
CAPEC Content Team The MITRE Corporation 2017-08-04 +00:00 Updated Examples-Instances, Related_Vulnerabilities
CAPEC Content Team The MITRE Corporation 2018-07-31 +00:00 Updated References
CAPEC Content Team The MITRE Corporation 2021-06-24 +00:00 Updated Related_Weaknesses
Click on the button to the left (OFF), to authorize the inscription of cookie improving the functionalities of the site. Click on the button to the left (Accept all), to unauthorize the inscription of cookie improving the functionalities of the site.