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

91 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 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 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
  • Medium 5.3
    CVE-2026-66384 Exploited Public exploit

    Authenticated users may write data outside the intended Docker cache path

    An authenticated user may write data outside the intended Docker cache path under specific remote-repository conditions.

    KEV Aug 27, 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 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
  • Medium 6.5
    CVE-2026-20262 Exploited Public exploit EPSS 29%

    Cisco Catalyst SD-WAN Manager Arbitrary File Write Vulnerability

    A vulnerability in the web UI of Cisco Catalyst SD-WAN Manager, formerly SD-WAN vManage, could allow an authenticated, remote attacker to create a file or overwrite any file on the filesystem of an affected system. This vulnerability exists because the affect…

    KEV Jun 15, 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
  • Medium 5.4
    CVE-2025-61624 Exploited

    An Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') [CWE-22] vulnerability in Fortinet Fo…

    KEV Oct 16, 2026
  • High 8.7
    CVE-2025-8110 Exploited Public exploit EPSS 80%

    File overwrite in file update API in Gogs

    Improper Symbolic link handling in the PutContents API in Gogs allows Local Execution of Code.

    KEV Jan 12, 2026
  • High 7.5
    CVE-2025-61884 Exploited · Ransomware Public exploit EPSS 96%

    Vulnerability in the Oracle Configurator product of Oracle E-Business Suite (component: Runtime UI). Supported versions…

    KEV Oct 20, 2025
  • High 7.5
    CVE-2025-25231 Exploited Public exploit EPSS 25%

    Omnissa Workspace ONE UEM contains a Secondary Context Path Traversal Vulnerability. A malicious actor may be able to g…

  • High 7.8
    CVE-2025-6218 Exploited Public exploit EPSS 90%

    RARLAB WinRAR Directory Traversal Remote Code Execution Vulnerability

    RARLAB WinRAR Directory Traversal Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of RARLAB WinRAR. User interaction is required to exploit this vulnerability in that the targ…

    KEV Dec 9, 2025
  • Critical 9.8
    CVE-2025-4632 Exploited Public exploit 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 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
  • High 7.2
    CVE-2025-2749 Exploited

    Kentico Xperience <= 13.0.178 Staging Media File Upload Authenticated RCE

    An authenticated remote code execution in Kentico Xperience allows authenticated users Staging Sync Server to upload arbitrary data to path relative locations. This results in path traversal and arbitrary file upload, including content that can be executed se…

    KEV Apr 20, 2026
  • High 7.2
    CVE-2024-57728 Exploited · Ransomware EPSS 64%

    SimpleHelp remote support software v5.5.7 and before allows admin users to upload arbitrary files anywhere on the file …

    KEV Apr 24, 2026
  • Critical 9.1
    CVE-2024-57727 Exploited · Ransomware Public exploit EPSS 97%

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

    KEV Feb 13, 2025
  • Medium 4.4
    CVE-2024-55550 Exploited · Ransomware EPSS 38%

    Mitel MiCollab through 9.8 SP2 could allow an authenticated attacker with administrative privilege to conduct a local f…

    KEV Jan 7, 2025
  • High 7.5
    CVE-2024-11667 Exploited · Ransomware

    A directory traversal vulnerability in the web management interface of Zyxel ATP series firmware versions V5.00 through…

    KEV Dec 3, 2024
  • Critical 9.1
    CVE-2024-41713 Exploited · Ransomware Public exploit 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 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
  • High 8.8
    CVE-2024-7399 Exploited Public exploit EPSS 92%

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

    KEV Apr 24, 2026
  • Critical 9.8
    CVE-2024-4885 Exploited Public exploit 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
  • High 8.6
    CVE-2024-28995 Exploited Public exploit EPSS 100%

    SolarWinds Serv-U L Directory Transversal Vulnerability

    SolarWinds Serv-U was susceptible to a directory transversal vulnerability that would allow access to read sensitive files on the host machine.

    KEV Jul 17, 2024
  • Critical 9.1
    CVE-2024-32113 Exploited Public exploit 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
  • High 8.4
    CVE-2024-1708 Exploited · Ransomware Public exploit EPSS 95%

    Improper limitation of a pathname to a restricted directory (“path traversal”)

    ConnectWise ScreenConnect 23.9.7 and prior are affected by path-traversal vulnerability, which may allow an attacker the ability to execute remote code or directly impact confidential data or critical systems.

    KEV Apr 28, 2026
  • Critical 9.8
    CVE-2024-23897 Exploited · Ransomware Public exploit 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
  • Medium 5.3
    CVE-2024-0769 Exploited EPSS 83%

    D-Link DIR-859 HTTP POST Request hedwig.cgi path traversal

    ** UNSUPPORTED WHEN ASSIGNED ** A vulnerability was found in D-Link DIR-859 1.06B01. It has been rated as critical. Affected by this issue is some unknown functionality of the file /hedwig.cgi of the component HTTP POST Request Handler. The manipulation of th…

    KEV Jun 25, 2025
  • Critical 9.8
    CVE-2023-47246 Exploited · Ransomware Public exploit 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
  • High 8.2
    CVE-2023-41266 Exploited · Ransomware EPSS 85%

    A path traversal vulnerability found in Qlik Sense Enterprise for Windows for versions May 2023 Patch 3 and earlier, Fe…

    KEV Dec 7, 2023
  • High 7.2
    CVE-2023-35081 Exploited EPSS 64%

    A path traversal vulnerability in Ivanti EPMM versions (11.10.x < 11.10.0.3, 11.9.x < 11.9.1.2 and 11.8.x < 11.8.1.2) a…

    KEV Jul 31, 2023
  • High 7.5
    CVE-2023-38950 Exploited EPSS 92%

    A path traversal vulnerability in the iclock API of ZKTeco BioTime v8.5.5 allows unauthenticated attackers to read arbi…

    KEV May 19, 2025
  • High 8.6
    CVE-2023-32315 Exploited Public exploit EPSS 100%

    Openfire administration console authentication bypass

    Openfire is an XMPP server licensed under the Open Source Apache License. Openfire's administrative console, a web-based application, was found to be vulnerable to a path traversal attack via the setup environment. This permitted an unauthenticated user to us…

    KEV Aug 24, 2023
  • Medium 6.5
    CVE-2022-41328 Exploited EPSS 11%

    A improper limitation of a pathname to a restricted directory vulnerability ('path traversal') [CWE-22] in Fortinet For…

    KEV Mar 14, 2023
  • Critical 9.8
    CVE-2022-41352 Exploited · Ransomware Public exploit 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 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
  • High 7.2
    CVE-2022-27925 Exploited · Ransomware Public exploit EPSS 99%

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

    KEV Aug 11, 2022