Back to Labs
Weakness (CWE)

CWE-23

Relative Path Traversal

About

The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory.

Common consequences

  • Integrity, Confidentiality, Availability → Execute Unauthorized Code or Commands
  • Integrity → Modify Files or Directories
  • Confidentiality → Read Files or Directories
  • Availability → DoS: Crash, Exit, or Restart

Mitigations

  • 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
  • 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 (s
  • 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].

CVEs with this weakness

Frequently asked questions

What is CWE-23?

The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory.

Which platforms does CWE-23 affect?

CWE-23 has been observed on: Not Technology-Specific, Web Based, AI/ML.

How many CVEs does Rainforest track for CWE-23?

Rainforest Labs currently tracks 2 published CVEs mapped to CWE-23. They are listed on this page.

Empower Your Security Strategy with Rainforest

Discover vulnerabilities early, prioritize critical threats, and protect what truly matters. Rainforest streamlines your security operations, saving you time and reducing costs, so you can focus on what drives your business forward.