Path Equivalence: 'filename/' (Trailing Slash)

Incomplete Variant
Structure: Simple
Description

This vulnerability occurs when an application accepts file or directory paths that end with a slash (e.g., 'documents/') without properly normalizing them. This can confuse the system's path resolution logic, potentially allowing an attacker to bypass security checks and access files or directories they shouldn't.

Extended Description

At its core, this issue is about inconsistent path handling. Many file systems and APIs treat a path like 'public/data' and 'public/data/' as equivalent, pointing to the same directory. However, an application's custom security logic—like an allowlist or a path traversal check—might only validate the first version. When the system later resolves the trailing slash version to its canonical form, it could access a resource that bypassed the initial validation. To prevent this, developers should always normalize paths before performing any security operations. This means stripping trailing slashes (or adding them consistently) and converting the path to a single, standard format. Rely on well-tested library functions for path canonicalization instead of custom string checks, and apply all authorization rules after normalization to ensure the validated path is the same one the operating system ultimately uses.

Common Consequences 1
Scope: ConfidentialityIntegrity

Impact: Read Files or DirectoriesModify Files or Directories

Observed Examples 6
CVE-2002-0253Overlaps infoleak
CVE-2001-0446Application server allows remote attackers to read source code for .jsp files by appending a / to the requested URL.
CVE-2004-0334Bypass Basic Authentication for files using trailing "/"
CVE-2001-0893Read sensitive files with trailing "/"
CVE-2001-0892Web server allows remote attackers to view sensitive files under the document root (such as .htpasswd) via a GET request with a trailing /.
CVE-2004-1814Directory traversal vulnerability in server allows remote attackers to read protected files via .. (dot dot) sequences in an HTTP request.
Applicable Platforms
Languages:
Not Language-Specific : Undetermined
Modes of Introduction
Implementation
Operation
Functional Areas
  1. File Processing
Affected Resources
  1. File or Directory
Taxonomy Mapping
  • PLOVER
  • Software Fault Patterns