CWE-22 - Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')


A path traversal vulnerability allows an attacker to access files on your web server to which they should not have access. They do this by tricking either the web server or the web application running on it into returning files that exist outside of the web root folder.

    With a system vulnerable to directory traversal, an attacker can make use of this vulnerability to step out of the root directory and access other parts of the file system. This might give the attacker the ability to view restricted files, or even more dangerous, allowing the attacker to execute powerful commands on the web server which can lead to a full compromise of the system.

    Here are some known directory traversal attack strings:

    Directory traversal on Unix:

    Common Unix-like directory traversal uses the ../ characters.

    Directory traversal on Microsoft Windows:

    Microsoft Windows and DOS directory traversal uses the ..\ or ../ character sequences.

The weakness allows attacker to read, change and overwrite data that can help them to bypass security mechanisms and upset the system work.
The vulnerability is introduced during Architecture and Design, Implementation stages.

Latest vulnerabilities for CWE-22


Description of CWE-22 on Mitre website