What it is: Path Equivalence (CWE-43) occurs when a product accepts path input in the form of multiple trailing dots without appropriate validation.
Why it matters: This can lead to ambiguous path resolution and allow an attacker to traverse the file system to unintended locations or access arbitrary files, resulting in unauthorized access to sensitive data, modification of critical files, and disruption of business operations.
How to fix it: You can fix a Path Equivalence vulnerability by validating path input, using secure libraries and frameworks, and implementing robust error handling mechanisms.
TL;DR: A Path Equivalence (CWE-43) vulnerability occurs when a product accepts path input in the form of multiple trailing dots without appropriate validation, leading to ambiguous path resolution and allowing an attacker to traverse the file system to unintended locations or access arbitrary files.
| Field | Value |
|---|---|
| CWE ID | CWE-43 |
| OWASP Category | Not directly mapped |
| CAPEC | None known |
| Typical Severity | Medium |
| Affected Technologies | Path construction, file systems |
| Detection Difficulty | Moderate |
| Last Updated | 2026-07-27 |
What is Path Equivalence?
Path Equivalence (CWE-43) is a type of vulnerability that occurs when a product accepts path input in the form of multiple trailing dots without appropriate validation, leading to ambiguous path resolution and allowing an attacker to traverse the file system to unintended locations or access arbitrary files. As defined by the MITRE Corporation under CWE-43; it is not directly mapped to a specific OWASP Top 10:2025 category. Path Equivalence is a critical vulnerability that can have severe consequences for businesses.
Quick Summary
Path Equivalence (CWE-43) occurs when a product accepts path input in the form of multiple trailing dots without appropriate validation. This can lead to ambiguous path resolution and allow an attacker to traverse the file system to unintended locations or access arbitrary files, resulting in unauthorized access to sensitive data, modification of critical files, and disruption of business operations.
Jump to: Quick Summary · Path Equivalence Overview · How Path Equivalence Works · Business Impact of Path Equivalence · Path Equivalence Attack Scenario · How to Detect Path Equivalence · How to Fix Path Equivalence · Framework-Specific Fixes for Path Equivalence · How to Ask AI to Check Your Code for Path Equivalence · Path Equivalence Best Practices Checklist · Path Equivalence FAQ · Vulnerabilities Related to Path Equivalence · References · Scan Your Own Site
Path Equivalence Overview
What: Path Equivalence (CWE-43) occurs when a product accepts path input in the form of multiple trailing dots without appropriate validation.
Why it matters: This can lead to ambiguous path resolution and allow an attacker to traverse the file system to unintended locations or access arbitrary files, resulting in unauthorized access to sensitive data, modification of critical files, and disruption of business operations.
Where it occurs: Path Equivalence (CWE-43) can occur in any product that accepts path input from external sources, including web applications, mobile apps, and operating systems.
Who is affected: Any user who interacts with a product that has a Path Equivalence (CWE-43) vulnerability may be affected.
How Path Equivalence Works
Root Cause
Path Equivalence (CWE-43) occurs when a product accepts path input in the form of multiple trailing dots without appropriate validation. This can lead to ambiguous path resolution and allow an attacker to traverse the file system to unintended locations or access arbitrary files.
Attack Flow
- An attacker sends a malicious path input to the vulnerable product.
- The product accepts the path input without validating it properly.
- The attacker is able to traverse the file system to unintended locations or access arbitrary files.
Prerequisites to Exploit
- The product must accept path input from external sources.
- The product must not validate the path input properly.
Vulnerable Code
import os
path = '/home/user/../file.txt'
os.chdir(path)
This code is vulnerable because it does not validate the path input properly. An attacker can send a malicious path input to traverse the file system to unintended locations or access arbitrary files.
Secure Code
import os
path = '/home/user/./file.txt'
if os.path.abspath(path).startswith('/home'):
os.chdir(path)
else:
raise ValueError('Invalid path')
This code is secure because it validates the path input properly before allowing it to change the current directory.
Business Impact of Path Equivalence
Confidentiality: Unauthorized access to sensitive data can lead to confidentiality breaches, resulting in financial losses and damage to reputation.
Integrity: Modification of critical files can lead to integrity breaches, resulting in financial losses and disruption of business operations.
Availability: Disruption of business operations can lead to availability breaches, resulting in financial losses and damage to reputation.
Path Equivalence Attack Scenario
- An attacker sends a malicious path input to the vulnerable product.
- The product accepts the path input without validating it properly.
- The attacker is able to traverse the file system to unintended locations or access arbitrary files.
- The attacker modifies critical files or accesses sensitive data.
How to Detect Path Equivalence
Manual Testing
- Review code for path input validation
- Test product with malicious path inputs
- Verify that product handles errors properly
Automated Scanners (SAST/DAST)
Automated scanners can detect Path Equivalence vulnerabilities by analyzing code and identifying potential issues.
PenScan Detection
PenScan’s scanner engines actively test for this issue.
False Positive Guidance
False positives may occur when a legitimate path input is misinterpreted as malicious. To avoid false positives, ensure that product handles errors properly and provides clear feedback to users.
How to Fix Path Equivalence
- Validate path input properly
- Use secure libraries and frameworks
- Implement robust error handling mechanisms
Framework-Specific Fixes for Path Equivalence
Java
import java.io.File;
String path = '/home/user/../file.txt';
File file = new File(path);
if (file.getAbsoluteFile().startsWith("/home")) {
// Proceed with caution
} else {
throw new IllegalArgumentException("Invalid path");
}
Node.js
const fs = require('fs');
let path = '/home/user/../file.txt';
if (path.startsWith('/home')) {
// Proceed with caution
} else {
throw new Error('Invalid path');
}
How to Ask AI to Check Your Code for Path Equivalence
Review the following Node.js code block for potential CWE-43 Path Equivalence vulnerabilities and rewrite it using primary fix technique: path = '/home/user/../file.txt'; if (path.startsWith('/home')) { // Proceed with caution } else { throw new Error('Invalid path'); }
Path Equivalence Best Practices Checklist
✅ Validate path input properly ✅ Use secure libraries and frameworks ✅ Implement robust error handling mechanisms
Path Equivalence FAQ
How does Path Equivalence occur?
Path Equivalence occurs when a product accepts path input in the form of multiple trailing dots without appropriate validation, leading to ambiguous path resolution and allowing an attacker to traverse the file system to unintended locations or access arbitrary files.
What are the consequences of a Path Equivalence vulnerability?
The consequences of a Path Equivalence vulnerability include unauthorized access to sensitive data, modification of critical files, and disruption of business operations.
How can I detect Path Equivalence vulnerabilities in my code?
You can detect Path Equivalence vulnerabilities using manual testing, automated scanners (SAST/DAST), or PenScan’s detection capabilities.
What are the best practices for preventing Path Equivalence vulnerabilities?
The best practices for preventing Path Equivalence vulnerabilities include validating path input, using secure libraries and frameworks, and implementing robust error handling mechanisms.
How can I fix a Path Equivalence vulnerability in my code?
You can fix a Path Equivalence vulnerability by validating path input, using secure libraries and frameworks, and implementing robust error handling mechanisms.
What are the related weaknesses to Path Equivalence?
The related weaknesses to Path Equivalence include CWE-42 (Path Equivalence: ‘filename.’ (Trailing Dot)) and CWE-163 (Improper Neutralization of Multiple Trailing Special Elements).
Where can I find more information about Path Equivalence?
You can find more information about Path Equivalence on the MITRE website, OWASP website, or CAPEC website.
Vulnerabilities Related to Path Equivalence
| CWE | Name | Relationship |
|---|---|---|
| CWE-42 | Path Equivalence: ‘filename.’ (Trailing Dot) | ChildOf |
| CWE-163 | Improper Neutralization of Multiple Trailing Special Elements | ChildOf |
References
Scan Your Own Site
Manual code review catches what you know to look for. An automated scan catches what you didn’t. Scan your own website using PenScan to find Path Equivalence and other risks before an attacker does.