Skip to content
OpenAdvisories

Weakness (CWE)

CWE-22: Improper Limitation of a Pathname to a Restricted Directory

Base

The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

More detail

Many file operations are intended to take place within a restricted directory. By using special elements such as ".." and "/" separators, attackers can escape outside of the restricted location to access files or directories that are elsewhere on the system. One of the most common special elements is the "../" sequence, which in most modern operating systems is interpreted as the parent directory of the current location. This is referred to as relative path traversal. Path traversal also covers the use of absolute pathnames such as "/usr/local/bin" to access unexpected files. This is referred to as absolute path traversal.

How to prevent it (8 mitigations)
  1. Implementation

    Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.

    When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."

    Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.

    When validating filenames, use stringent allowlists that limit the character set to be used. If feasible, only allow a single "." character in the filename to avoid weaknesses such as CWE-23, and exclude directory separators such as "/" to avoid CWE-36. Use a list of allowable file extensions, which will help to avoid CWE-434.

    Do not rely exclusively on a filtering mechanism that removes potentially dangerous characters. This is equivalent to a denylist, which may be incomplete (CWE-184). For example, filtering "/" is insufficient protection if the filesystem also supports the use of "\" as a directory separator. Another possible error could occur when the filtering is applied in a way that still produces dangerous data (CWE-182). For example, if "../" sequences are removed from the ".../...//" string in a sequential fashion, two instances of "../" would be removed from the original string, but the remaining characters would still form the "../" string.

  2. Architecture and Design

    For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.

  3. Implementation

    Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.

    Use a built-in path canonicalization function (such as realpath() in C) that produces the canonical version of the pathname, which effectively removes ".." sequences and symbolic links (CWE-23, CWE-59). This includes:

    - realpath() in C

    - getCanonicalPath() in Java

    - GetFullPath() in ASP.NET

    - realpath() or abs_path() in Perl

    - realpath() in PHP

  4. Architecture and Design

    Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].

  5. Operation

    Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].

  6. Architecture and Design, Operation

    Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.

  7. Architecture and Design

    When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.

    For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap [REF-185] provide this capability.

  8. Architecture and Design, Operation

    Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software.

    OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations.

    This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise.

    Be careful to avoid CWE-243 and other weaknesses related to jails.

Source: MITRE CWE-22

39 results · Clear filters · Feed

  • Critical 9.8
    CVE-2026-104286 Exploited Public exploit

    An improper limitation of a pathname to a restricted directory ('path traversal') vulnerability in Fortinet FortiMail 8…

    KEV Oct 1, 2026
  • Critical 9.8
    CVE-2026-93616 Exploited Public exploit Scanner template EPSS 92%

    Directory Traversal and File upload allows execution of arbitrary script on the Management Server

    A directory traversal and file upload vulnerability allows an unauthenticated attacker to upload and execute arbitrary scripts on Check Point Management Server.

    KEV Sep 22, 2026
  • Critical 10.0
    CVE-2026-85706 Exploited Public exploit Scanner template EPSS 97%

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in GitLab

    GitLab has remediated an issue in GitLab CE/EE affecting all versions from 18.7 before 18.11.12, 19.0 before 19.0.9, 19.1 before 19.1.8, 19.2 before 19.2.6, and 19.3 before 19.3.2 that, under certain conditions, an unauthenticated user could have read arbitra…

    KEV Sep 11, 2026
  • Critical 9.8
    CVE-2026-59310 Exploited · Ransomware Public exploit EPSS 62%

    vCenter directory-traversal vulnerability

    VMware vCenter contains a directory traversal vulnerability in the Syslog server. A malicious actor with network access to vCenter may exploit this issue to execute arbitrary code.

    KEV Aug 18, 2026
  • Critical 10.0
    CVE-2026-48282 Exploited Public exploit Scanner template EPSS 42%

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

    ColdFusion versions 2025.9, 2023.20 and earlier are affected by an Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability that could lead to arbitrary code execution in the context of the current user. Exploitation of thi…

    KEV Jul 7, 2026
  • Critical 10.0
    CVE-2026-34909 Exploited EPSS 69%

    A malicious actor with access to the network could exploit a Path Traversal vulnerability found in UniFi OS devices to …

    KEV Jun 23, 2026
  • Critical 9.8
    CVE-2025-4632 Exploited Public exploit Scanner template EPSS 24%

    Improper limitation of a pathname to a restricted directory vulnerability in Samsung MagicINFO 9 Server version before …

    KEV May 22, 2025
  • Critical 9.3
    CVE-2025-34028 Exploited Public exploit Scanner template EPSS 98%

    Commvault Command Center Innovation Release <= 11.38.25 Unathenticated Install Package Path Traversal

    The Commvault Command Center Innovation Release allows an unauthenticated actor to upload ZIP files that represent install packages that, when expanded by the target server, are vulnerable to path traversal vulnerability that can result in Remote Code Executi…

    KEV May 2, 2025
  • Critical 9.1
    CVE-2024-57727 Exploited · Ransomware Public exploit Scanner template EPSS 97%

    SimpleHelp remote support software v5.5.7 and before is vulnerable to multiple path traversal vulnerabilities that enab…

    KEV Feb 13, 2025
  • Critical 9.1
    CVE-2024-41713 Exploited · Ransomware Public exploit Scanner template EPSS 97%

    A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) coul…

    KEV Jan 7, 2025
  • Critical 9.4
    CVE-2024-8963 Exploited Public exploit Scanner template EPSS 99%

    Path Traversal in the Ivanti CSA before 4.6 Patch 519 allows a remote unauthenticated attacker to access restricted fun…

    KEV Sep 19, 2024
  • Critical 9.3
    CVE-2024-7262 Exploited

    Arbitrary Code Execution in WPS Office

    Improper path validation in promecefpluginhost.exe in Kingsoft WPS Office version ranging from 12.2.0.13110 to 12.2.0.16412 (exclusive) on Windows allows an attacker to load an arbitrary Windows library. The vulnerability was found weaponized as a single-clic…

    KEV Sep 3, 2024
  • Critical 9.8
    CVE-2024-4885 Exploited Public exploit Scanner template EPSS 99%

    WhatsUp Gold GetFileWithoutZip Directory Traversal Remote Code Execution Vulnerability

    In WhatsUp Gold versions released before 2023.1.3, an unauthenticated Remote Code Execution vulnerability in Progress WhatsUpGold.  The WhatsUp.ExportUtilities.Export.GetFileWithoutZip allows execution of commands with iisapppool\nmconsole privileges.

    KEV Mar 3, 2025
  • Critical 9.1
    CVE-2024-32113 Exploited Public exploit Scanner template EPSS 100%

    Apache OFBiz: Path traversal leading to RCE

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in Apache OFBiz.This issue affects Apache OFBiz: before 18.12.13. Users are recommended to upgrade to version 18.12.13, which fixes the issue.

    KEV Aug 7, 2024
  • Critical 9.8
    CVE-2024-23897 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    Arbitrary file read vulnerability through the Jenkins CLI can lead to RCE

    Jenkins 2.441 and earlier, LTS 2.426.2 and earlier does not disable a feature of its CLI command parser that replaces an '@' character followed by a file path in an argument with the file's contents, allowing unauthenticated attackers to read arbitrary files …

    KEV Aug 19, 2024
  • Critical 9.8
    CVE-2023-47246 Exploited · Ransomware Public exploit Scanner template EPSS 99%

    In SysAid On-Premise before 23.3.36, a path traversal vulnerability leads to code execution after an attacker writes a …

    KEV Nov 13, 2023
  • Critical 9.8
    CVE-2022-41352 Exploited · Ransomware Public exploit Scanner template EPSS 95%

    An issue was discovered in Zimbra Collaboration (ZCS) 8.8.15 and 9.0. An attacker can upload arbitrary files through am…

    KEV Oct 20, 2022
  • Critical 9.8
    CVE-2022-37042 Exploited · Ransomware Public exploit Scanner template EPSS 92%

    Zimbra Collaboration Suite (ZCS) 8.8.15 and 9.0 has mboximport functionality that receives a ZIP archive and extracts f…

    KEV Aug 11, 2022
  • Critical 9.8
    CVE-2022-30333 Exploited · Ransomware Public exploit EPSS 99%

    RARLAB UnRAR before 6.12 on Linux and UNIX allows directory traversal to write to files during an extract (aka unpack) …

    KEV Aug 9, 2022
  • Critical 9.8
    CVE-2022-29464 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    Certain WSO2 products allow unrestricted file upload with resultant remote code execution. The attacker must use a /fil…

    KEV Apr 25, 2022
  • Critical 9.8
    CVE-2021-42013 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773)

    It was found that the fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories a…

    KEV Nov 3, 2021
  • Critical 9.8
    CVE-2021-22005 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    The vCenter Server contains an arbitrary file upload vulnerability in the Analytics service. A malicious actor with net…

    KEV Nov 3, 2021
  • Critical 9.9
    CVE-2021-38163 Exploited Public exploit EPSS 37%

    SAP NetWeaver (Visual Composer 7.0 RT) versions - 7.30, 7.31, 7.40, 7.50, without restriction, an attacker authenticate…

    KEV Jun 9, 2022
  • Critical 9.8
    CVE-2021-20090 Exploited Scanner template EPSS 100%

    A path traversal vulnerability in the web interfaces of Buffalo WSR-2533DHPL2 firmware version <= 1.02 and WSR-2533DHP3…

    KEV Nov 3, 2021
  • Critical 9.8
    CVE-2021-21972 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    The vSphere Client (HTML5) contains a remote code execution vulnerability in a vCenter Server plugin. A malicious actor…

    KEV Nov 3, 2021
  • Critical 9.8
    CVE-2021-3199 Exploited EPSS 30%

    Directory traversal with remote code execution can occur in /upload in ONLYOFFICE Document Server before 5.6.3, when JW…

    KEV Oct 8, 2026
  • Critical 9.1
    CVE-2020-17519 Exploited Public exploit Scanner template EPSS 98%

    Apache Flink directory traversal attack: reading remote files through the REST API

    A change introduced in Apache Flink 1.11.0 (and released in 1.11.1 and 1.11.2 as well) allows attackers to read any file on the local filesystem of the JobManager through the REST interface of the JobManager process. Access is restricted to files accessible b…

    KEV May 23, 2024
  • Critical 9.8
    CVE-2020-5902 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    In BIG-IP versions 15.0.0-15.1.0.3, 14.1.0-14.1.2.5, 13.1.0-13.1.3.3, 12.1.0-12.1.5.1, and 11.6.1-11.6.5.1, the Traffic…

    KEV Nov 3, 2021
  • Critical 9.8
    CVE-2019-19781 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    An issue was discovered in Citrix Application Delivery Controller (ADC) and Gateway 10.5, 11.1, 12.0, 12.1, and 13.0. T…

    KEV Nov 3, 2021
  • Critical 9.8
    CVE-2019-7195 Exploited · Ransomware Public exploit Scanner template EPSS 89%

    This external control of file name or path vulnerability allows remote attackers to access or modify system files. To f…

    KEV Jun 8, 2022
  • Critical 9.8
    CVE-2019-7194 Exploited · Ransomware Public exploit Scanner template EPSS 83%

    This external control of file name or path vulnerability allows remote attackers to access or modify system files. To f…

    KEV Jun 8, 2022
  • Critical 9.8
    CVE-2019-16278 Exploited Public exploit Scanner template EPSS 99%

    Directory Traversal in the function http_verify in nostromo nhttpd through 1.9.6 allows an attacker to achieve remote c…

    KEV Nov 7, 2024
  • Critical 9.1
    CVE-2018-13379 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    An Improper Limitation of a Pathname to a Restricted Directory ("Path Traversal") in Fortinet FortiOS 6.0.0 to 6.0.4, 5…

    KEV Nov 3, 2021
  • Critical 9.9
    CVE-2019-11510 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    In Pulse Secure Pulse Connect Secure (PCS) 8.2 before 8.2R12.1, 8.3 before 8.3R7.1, and 9.0 before 9.0R3.4, an unauthen…

    KEV Nov 3, 2021
  • Critical 9.8
    CVE-2019-3396 Exploited · Ransomware Public exploit Scanner template EPSS 100%

    The Widget Connector macro in Atlassian Confluence Server before version 6.6.12 (the fixed version for 6.6.x), from ver…

    KEV Nov 3, 2021
  • Critical 9.9
    CVE-2018-18809 Exploited Scanner template EPSS 79%

    TIBCO JasperReports Library Directory Traversal Vulnerability

    The default server implementation of TIBCO Software Inc.'s TIBCO JasperReports Library, TIBCO JasperReports Library Community Edition, TIBCO JasperReports Library for ActiveMatrix BPM, TIBCO JasperReports Server, TIBCO JasperReports Server Community Edition, …

    KEV Dec 29, 2022
  • Critical 9.1
    CVE-2018-14847 Exploited Public exploit EPSS 96%

    MikroTik RouterOS through 6.42 allows unauthenticated remote attackers to read arbitrary files and remote authenticated…

    KEV Dec 1, 2021
  • Critical 9.1
    CVE-2015-4068 Exploited EPSS 64%

    Directory traversal vulnerability in Arcserve UDP before 5.0 Update 4 allows remote attackers to obtain sensitive infor…

    KEV Mar 25, 2022
  • Critical 9.8
    CVE-2014-0780 Exploited Public exploit EPSS 75%

    InduSoft Web Studio Path Traversal

    Directory traversal vulnerability in NTWebServer in InduSoft Web Studio 7.1 before SP2 Patch 4 allows remote attackers to read administrative passwords in APP files, and consequently execute arbitrary code, via unspecified web requests.

    KEV Apr 15, 2022