04 Мар, 2024

Insufficient protection against path traversal attacks

Path Traversal, also known as Directory Traversal or ../ (dot dot slash) attacks, is a common web application security vulnerability. It occurs when an application allows an attacker to navigate outside of the intended directory or access files and directories that are not supposed to be directly accessible. Insufficient protection against path traversal attacks can lead to unauthorized access to sensitive files, including configuration files, user data, or other critical information.

Attack Description:

Input Validation Failure:

The application takes user input, such as file paths or directory names, without properly validating or sanitizing the input.

Directory Traversal Attempt:

An attacker manipulates the input by introducing special characters, such as “../” or “%2e%2e%2f,” to navigate up the directory tree and access files outside the intended directory.

File Access:

The manipulated input allows the attacker to access files or directories that should be restricted, including sensitive system files or user-specific data.

Раскрытие информации:

The attacker gains unauthorized access to files containing sensitive information, leading to potential information disclosure or, in some cases, remote code execution.

Consider a web application that allows users to view their profile pictures stored in a directory. The application uses the following URL to retrieve the image:


An attacker could manipulate the input to navigate outside the intended directory:


In this example, the attacker uses “../” to traverse up multiple directories, attempting to access the system password file (/etc/passwd). If the application lacks proper protection, the attacker might succeed in viewing sensitive system information.

Scanners that detect vulnerability

Burp Suite:

Описание: A web application security testing toolkit that includes features for identifying and testing path traversal vulnerabilities.

OWASP ZAP (Zed Attack Proxy):

Описание: An open-source web application security testing tool designed to find security vulnerabilities, including path traversal.


Описание: A web server scanner that can identify various security vulnerabilities, including those related to path traversal.


Описание: A comprehensive vulnerability scanner that can identify a wide range of security issues, including path traversal vulnerabilities.


Описание: A web vulnerability scanner that helps identify and remediate various web security issues, including path traversal.


Описание: A flexible web application brute-forcing tool that can be used for fuzzing and identifying path traversal vulnerabilities.


Описание: An actively developed web application security reconnaissance tool that can identify vulnerabilities, including path traversal.


Описание: A dynamic application security testing (DAST) tool that helps identify and remediate security vulnerabilities, including path traversal.


Описание: A web application scanner designed to identify various security vulnerabilities, including path traversal.


Описание: A high-performance web application security scanner framework that covers various vulnerabilities, including path traversal.

Average CVSS score

Assigning a specific Common Vulnerability Scoring System (CVSS) score for “Insufficient Protection Against Path Traversal Attacks” can be challenging, as the score depends on various factors such as the impact, exploitability, and mitigating factors specific to each vulnerability.

Factors Influencing CVSS Score:

Attack Complexity (AC):




Low Complexity (AC:L): If the attack can be carried out with low complexity (e.g., without advanced knowledge or tools), the score might be higher.

Privileges Required (PR):




Low Privileges Required (PR:L): If the attack requires minimal privileges, allowing an attacker with lower access to exploit the vulnerability, the score might be higher.

User Interaction (UI):




Required User Interaction (UI:R): If the attack requires user interaction (e.g., convincing a user to click a link), the score might be influenced by the likelihood of user interaction.

Scope (S):

Changed Scope (S:C): If the attack allows the attacker to extend their influence beyond the originally compromised scope, it could impact the score.

Confidentiality, Integrity, and Availability Impact (CIA):

High Impact (CIA:H): If the attack results in a high impact on confidentiality, integrity, and availability, the overall impact score will be higher.

CWE information

CWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’):

Описание: This weakness occurs when an attacker can specify a pathname that is not properly restricted, allowing access to files or directories that are outside the intended directory.

CWE-36: Absolute Path Traversal:

Описание: This weakness occurs when an attacker can specify an absolute path in a way that bypasses security controls, resulting in access to files or directories outside the intended scope.

CWE-23: Relative Path Traversal:

Описание: This weakness occurs when an attacker can specify a relative path in a way that bypasses security controls, resulting in access to files or directories outside the intended scope.

CWE-29: Improper Validation of Certificate with Host Mismatch:

Описание: While not specific to path traversal, this weakness can be relevant when validating paths within URLs and dealing with SSL/TLS. It involves the improper validation of certificates, potentially leading to security issues.

CWE-661: Use of Non-canonical URL Paths to Bypass Authentication Controls:

Описание: This weakness involves using non-canonical URL paths to bypass authentication controls, potentially leading to unauthorized access.

Conclusion and Mitigation

Insufficient protection against path traversal attacks poses a significant risk to web applications, potentially leading to unauthorized access to sensitive files and directories. This vulnerability allows attackers to manipulate input to traverse beyond the intended directory structure and access files that should be restricted. A successful path traversal attack can result in information disclosure, unauthorized data access, and even remote code execution, depending on the application’s functionality and security measures.

Key Points:

Common Attack Vector:

Path traversal attacks are a common attack vector, exploiting lax input validation and insufficient access controls.

Potential Impact:

The impact of path traversal vulnerabilities ranges from unauthorized access to critical files, such as configuration files and user data, to potential compromise of the entire application or system.

Mitigation Strategies:

Input Validation and Sanitization:

Implement robust input validation and sanitization to ensure that user-provided input does not contain special characters or sequences used in path traversal.

Use Whitelists:

Enforce whitelists for acceptable characters and patterns in file and directory names, preventing the use of malicious sequences.


Apply canonicalization techniques to normalize file paths and prevent the use of relative paths for traversal.

Access Controls:

Implement strong access controls to restrict user access to authorized files and directories. Enforce the principle of least privilege.

Use Absolute Paths:

Utilize absolute paths instead of relative paths in file operations to avoid unintentional traversal.

Security Awareness Training:

Train developers and administrators on secure coding practices, emphasizing the risks associated with path traversal vulnerabilities.

Automated Security Tools:

Employ automated security tools, such as static code analyzers and vulnerability scanners, to detect and flag potential path traversal vulnerabilities during the development process.

Regular Security Audits:

Conduct regular security audits и ПЕНТЕСТ to identify and remediate path traversal vulnerabilities in both development and production environments.

Другие Услуги

Готовы к безопасности?

Связаться с нами