scanrub
Path Traversal (dir/../filename variant)

Path Traversal (dir/../filename variant)

3 min read 1 reports analyzed ScanRub Research
Share
Live Playground · Powered by this research
Path Traversal Checker
Traversal sequences (../)2
Encoded traversalNo
Decoded path../../etc/passwd
Normalized path/etc/passwd
Path escapes intended directory. Server must reject this input.
Payloads from this research (2 total)
dir/../../../etc/passwd
dir/../../../../windows/win.ini
These payloads were synthesized from real HackerOne disclosures. Click any payload to copy it, then paste it into the tester above to see how our detection classifies it.

Summary

This is CWE-27, "Path Traversal: dir/../../filename", one of a family of MITRE CWE entries that catalog path traversal by the exact character pattern used rather than by a distinct exploitation technique. CWE-23 covers relative traversal generally, while CWE-27 and its siblings (CWE-29 through CWE-31, covering backslash variants and leading-slash variants) exist because some validation logic historically tried to filter path traversal by checking for specific substrings, like a bare ../ at the very start of a string, and could be defeated by a payload that embeds the traversal sequence after a legitimate-looking directory name instead. dir/../../etc/passwd still resolves to the same place ../../etc/passwd does once the filesystem processes the .. segments, but a filter looking only for traversal at the start of the string, or expecting a fixed number of segments, can miss it.

◈ flow diagram
User RequestFile Path Pa…Directory Tr…File System …Sensitive Fi…

Top Affected Components / Targets

  • File-serving or file-inclusion parameters with validation logic that checks the start of the input string rather than resolving the full path
  • Legacy or custom-written path-sanitization functions predating well-tested library-based path resolution

Common Attack Vectors

  • Where a bare ../../../etc/passwd payload is rejected or sanitized, retry with a legitimate-looking directory prefix in front of the traversal sequence, since filters keyed on the string's start position or a fixed traversal-segment count can behave differently depending on exactly where the .. sequences sit in the string
  • Combine with different segment counts and a mix of real and fake leading directory names to probe for validation logic with an inconsistent or incomplete traversal check

Common Payloads

  • dir/../../../etc/passwd
  • dir/../../../../windows/win.ini
  • assets/../../../etc/passwd using a plausible, real-looking directory name as the prefix

Detection Strategy

Where a canonical ../../../etc/passwd-style payload is rejected, this variant is worth testing as a follow-up specifically because it targets validation logic with a different, narrower assumption about where traversal sequences appear in the input. The confirmation signal is the same as any path traversal test: the target file's known content (such as the structure of /etc/passwd or win.ini) appearing in the response.

Tip: Testing tools that run these checks in parallel across every discovered endpoint can cut the time required substantially compared to fully manual testing, as long as they confirm findings with more than one signal to keep the false-positive rate down.

False-Positive Notes

As with any path traversal probe, a response that merely echoes the submitted path back without revealing target file content isn't a confirmed finding; the response needs to contain content genuinely consistent with the requested system file.

How to Test

Manual Testing Methodology

Here is a systematic approach to identifying Path Traversal (dir/../filename variant) vulnerabilities in a target application.

Step 1: Reconnaissance and Surface Mapping

Before testing, map all input vectors that could be affected. Identify parameters, headers, cookies, and request bodies that interact with the vulnerable component. A proxy such as Burp Suite or OWASP ZAP, paired with normal browsing of the target, is usually enough to build this list.

Step 2: Baseline Request

Send a legitimate request and record the normal response: status code, content length, response time, and any identifying tokens. This baseline matters because it's what you'll compare later responses against once payloads are involved.

Step 3: Payload Injection

Inject test payloads into each identified input vector one at a time. Start with benign detection payloads before escalating to anything that could actually trigger the vulnerability. For Path Traversal (dir/../filename variant) specifically, submit ../ sequences of increasing depth (../etc/passwd, ../../etc/passwd, and so on) alongside URL-encoded (%2e%2e%2f), double-encoded, and null-byte variants against every file-path parameter, and try both forward- and back-slash separators since one is sometimes filtered while the other isn't.

Step 4: Response Analysis

Compare the response against your baseline, looking specifically for the actual contents of a known system file (/etc/passwd, win.ini) appearing in the response, or a distinct error message (a different exception type or path echoed back) between a valid relative path and a traversal attempt.

Step 5: Confirmation

Once a potential vulnerability is detected, confirm it with at least a few independent test cases to rule out coincidence. Document the exact request and response as proof. For Path Traversal (dir/../filename variant), a confirmed finding typically means showing that attacker-controlled input changes the application's behavior in a way that matters for security, not just that a payload was reflected somewhere harmless.

Real-World Impact

Real-World Impact

Path traversal lets attackers read, and sometimes write, files outside the directory an application intended to expose, usually by slipping ../ sequences into a file path parameter. Successful exploitation can expose source code, configuration files containing database credentials and API keys, and system files like /etc/passwd. In write scenarios, it can lead directly to code execution through a planted web shell.

In containerized environments, path traversal can escape an application's own file namespace to read secrets, environment variables, and mounted volumes belonging to other services entirely. In cloud deployments, it can expose provider-specific metadata files too.

This bug class becomes especially dangerous when combined with file inclusion. Reading a file is an information disclosure on its own, but if that file gets executed, the finding becomes remote code execution.

Prevention & Remediation

Prevention and Secure Coding

Preventing Path Traversal (dir/../filename variant) takes a defense-in-depth approach — no single control below is sufficient alone, but together they close off both the primary path and the most common bypasses.

Canonicalize and verify containment. Resolve the requested path to its canonical absolute form and check that it still falls inside an allowlisted base directory before touching the filesystem — check this after resolving symlinks and encoded sequences, not before.

Map to an internal ID, not a raw path. Where feasible, have user input select from a server-side allowlist or database record (an internal file ID) rather than being used as any part of a filesystem path directly.

Reject traversal sequences outright. Reject requests containing ../, .., URL-encoded variants (%2e%2e%2f), and null bytes rather than trying to strip them — stripping is a common source of filter-bypass bugs when done with a single non-recursive replace.

Least-privilege filesystem access. Run the file-serving process under an account with read access to only the directories it legitimately needs, so a traversal that gets past the application-layer check still hits an OS-level permission wall.

Disable directory listing and dangerous parsers. Serve static content through a web server configuration that has autoindexing disabled and doesn't execute uploaded files as scripts.

Frequently Asked Questions

What is Path Traversal (dir/../filename variant)?
This is CWE-27, "Path Traversal: dir/../../filename", one of a family of MITRE CWE entries that catalog path traversal by the exact character pattern used rather than by a distinct exploitation technique.
How common is Path Traversal (dir/../filename variant) in bug bounty reports?
Scanrub's research corpus for this playbook is built from 1 disclosed HackerOne report in this category, synthesized for detection and prevention guidance rather than reproduced verbatim.
How do I test for Path Traversal (dir/../filename variant)?
Map every input vector, record a baseline response, then inject targeted test payloads one field at a time and compare the response for timing, length, error, or reflection differences from that baseline. The "How to Test" section above walks through the full methodology for this specific vulnerability class.
What is the single most effective fix for Path Traversal (dir/../filename variant)?
Resolve every file-path input to its canonical absolute form and verify it stays inside an allowlisted base directory before any filesystem operation.
Weekly security research

New vulnerability playbooks, tool updates, and bug bounty insights - delivered to your inbox. No spam.

Unsubscribe anytime. We respect your inbox.
Press ⌘K to search×