CWE•Base•Stable•20 recent CVEs
CWE-22Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Description
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.
[object Object]
Common consequences
- Integrity,Confidentiality,Availability→Execute Unauthorized Code or CommandsThe attacker may be able to create or overwrite critical files that are used to execute code, such as programs or libraries.
- Integrity→Modify Files or DirectoriesThe attacker may be able to overwrite or create critical files, such as programs, libraries, or important data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, appe
- Confidentiality→Read Files or DirectoriesThe attacker may be able read the contents of unexpected files and expose sensitive data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, by reading a password file
- Availability→DoS: Crash, Exit, or RestartThe attacker may be able to overwrite, delete, or corrupt unexpected critical files such as programs, libraries, or important data. This may prevent the product from working at all and in the case of protection mechanisms such as authentica
Potential mitigations
- Implementation[object Object]
- Architecture and DesignFor 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.
- Implementation[object Object]
- Architecture and DesignUse 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].
- OperationUse 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].
- Architecture and Design,OperationRun 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 ad
- Architecture and Design[object Object]
- Architecture and Design,Operation[object Object]
- Architecture and Design,Operation[object Object]
- Implementation[object Object]
Related CWEs
Recent CVEs classified under this CWE
CVE-2026-464848.12026-06-08CVE-2026-464862026-06-08CVE-2026-414489.42026-06-08CVE-2026-255598.82026-06-08CVE-2026-492332026-06-08CVE-2026-95062026-06-08CVE-2022-509536.22026-06-08CVE-2026-114706.32026-06-08CVE-2026-114675.42026-06-08CVE-2026-114114.42026-06-06CVE-2026-91974.92026-06-06CVE-2026-75654.92026-06-06CVE-2026-25004.42026-06-06CVE-2026-92907.52026-06-06CVE-2026-114312026-06-05CVE-2026-114292026-06-05CVE-2026-114168.12026-06-05CVE-2026-114232026-06-05CVE-2026-463976.52026-06-05CVE-2026-114202026-06-05