Business logic directory traversal attacks
Before we go over payloads, let's look at motivation—both in CTFs and beyond. Path traversal isn't an end in itself, but an entry point for an escalation chain. Read .env— received the password for the database. Read the SSH key from /home/user/.ssh/id_rsa— logged into the server without a password. Read the application's source code and found a hardcoded API token or a hidden endpoint without authentication. According to IBM X-Force, more than 6,000 new accounts appear on the dark web every day, and a significant portion are leaked through config reading. For more details, see our detailed analysis of creating CTF tasks .
In MITRE ATT&CK terms, the chain is:
Exploit Public- Facing Application (T1190, Initial Access)
Reading Local Files - Data from Local System (T1005, Collection)
Extracting credentials from config files — Credentials In Files (T1552.001, Credential Access)
SSH Key Theft - Private Keys (T1552.004, Credential Access)
Obtaining hashes /etc/shadow — OS Credential Dumping: /etc/passwd and /etc/shadow (T1003.008, Credential Access)
On CTFs, the chain is compressed: traversal → config reading → flag. But if the task requires RCE, everything works exactly the same—the scale is smaller, the logic is the same. Understanding the business logic helps select the right files first: not /etc/passwd, A .env, config.php, database.yml- files with real secrets.
Reconnaissance: How to Find a Vulnerable Parameter in CTF Web Tasks
The first step in reconnoitering a web task is to look for parameters that accept file names. According to OWASP and HackTricks, typical vulnerable parameters are: page, file, template, path, doc, folder, include, view, content, layout, mod, conf, action, show, locateThis list covers most CTF tasks, but in real events, the parameter can be named anything—look for any argument whose value resembles the file name.
Three groups of vulnerable patterns
Templatization is the most common pattern in CTFs. Request ?page=about or ?view=newssubstitutes the file name into include() or file_get_contents(). If the suffix .phpadded automatically, requires null byte injection path traversal (PHP < 5.3.4) or wrapper for bypass.
File uploads - endpoints /download?file=report.pdf or /export?name=data.csvTraversal often works directly here: the backend returns the content without executing it.
API requests —the web application directory traversal is hidden in the POST body. According to YesWeHack research, in modern APIs, path traversal is more common in JSON parameters than in the query string. Request {"filename": "../../../etc/passwd"}or a nested structure in GraphQL ( readFile(path: "../../../../.env")) may be vulnerable even if front-end validation is in place.
Internal request forwarding in microservice architectures is a separate story. According to YesWeHack, the server can generate an internal API path from user input. If you send {"user_id": "../../admin/roles"}instead of a regular ID, an internal query POST /api/v1/users/../../admin/rolesresolve into /api/v1/admin/roles— an endpoint with elevated privileges. In CTFs, this vector is encountered in tasks with multiple related services.
Methodology requested
The main tool is manual brute force in Burp Repeater. You send the original request, insert ../into a suspicious parameter and look at the response. Repeater saves the history of attempts—after a dozen checks, a filtering pattern becomes visible: which characters are blocked, which are allowed, how the response length changes.
If rate limiting is disabled, connect ffufwith wordlist from SecLists ( Fuzzing/LFI/LFI-Jhaddix.txt):
ffuf -u "http://target/page.php?file=FUZZ" -w LFI-Jhaddix.txt -fc 403 -fs 0
Filters out 403 responses and empty bodies, leaving variants with real content. On CTF platforms with protection against automatic scanning, ffuf can cause an IP ban—in that case, revert to Repeater . Alternatively, use Burp Intruder with the predefined payload list "Fuzzing - path traversal," which contains encoded variants of traversal sequences.
Bypassing Filters: A Table of Path Traversal Exploitation Techniques
Most CTF web tasks of medium difficulty filter input. Naive checks remove ../From a string, substring locking—they almost always work around it. The question is which technique will work. Below is a complete table with specific path traversal payloads and preconditions, without which each technique is useless.
Technique Payload Prerequisite When it DOESN'T work
Basic traversal ../../../etc/passwd No filtering Any filter on ../
Nested sequences ....//....//....//etc/passwd One-time str_replace; quantity ....//= path depth from the current directory to the root Recursive filtering or regex
URL encoding %2e%2e%2fetc%2fpasswd Decoding after verification The filter is applied after decoding.
Double URL encoding %252e%252e%252f Two layers (nginx -> app) One layer of processing
Null byte injection ../../../etc/passwd%00.php PHP < 5.3.4 or legacy C libraries PHP 5.3.4+
Absolute path /etc/passwd There is no prefix or we bypass the prefix realpath()+ base directory check
Mixed separators ..\/..\/etc/passwd Windows or a tolerant parser Strict Unix system
Overlong UTF-8 %c0%ae%c0%ae%c0%af Legacy parsers Modern servers
NGINX + Tomcat ..;/ ..;/..;/admin/ NGINX before Tomcat No Tomcat in the stack
Checking order in Burp Repeater
It takes three to five minutes. Start simple—it saves time:
../../../etc/passwd— If it worked, there are no filters, proceed to reading valuable files
....//....//....//etc/passwd- non-recursive traversal str_replace
%2e%2e%2fetc%2fpasswd- single URL encoding
%252e%252e%252fetc%252fpasswd— double URL encoding
/etc/passwd— absolute path directly
....\/....\/etc/passwd— mixed separators
..;/..;/..;/etc/passwd— Tomcat-specific bypass
None of them caught on? The filtering is serious (canonization through realpath(), chroot) or a vulnerability in another parameter. Don't focus on one endpoint.
How does non-recursive filtering bypass work?
A classic example from real-world CTF tasks. Vulnerable endpoint code:
$file_path = str_replace('../', '', $_GET['download']);
$full_path = $projects_dir . $file_path;
include($full_path);
Filter str_replaceremoves all occurrences ../from the line, but exactly once. You pass ....//- removal of internal ../leaves ../Exactly what I needed. Payload ....//....//....//flag.txtafter filtration it turns into ../../../flag.txtAccording to PortSwigger Web Security Academy, nested sequences like ....// or ....\/— one of the most common bypasses in both CTF and bug bounty.
Double URL encoding in real CVEs
Double encoding occurs when a request passes through multiple layers of processing. The first layer transforms %252e%252e%252f V %2e%2e%2f, the second one is in ../The filter at the first layer does not see traversal sequences because it checks the string before the second decoding.
worked This is exactly how CVE-2018-1271 in Spring MVC (CVSS 5.9, MEDIUM): the vulnerability affected Spring Framework versions 5.0–5.0.5 and 4.3–4.3.15 when serving static resources on Windows. Payload: /static/%255c%255c..%255c/..%255c/windows/win.iniEPSS 0.3034 — Top 5% by exploitability probability. There is a ready-made Nuclei template for this CVE in the ProjectDiscovery repository.
The ..;/ trick for NGINX + Tomcat
A separate technique specific to a particular stack. NGINX interprets ..;/as a regular directory. Tomcat handles this as ../Directory traversal passes through NGINX undetected.
This is how CVE-2021-45967 worked in Pascom Cloud Phone System (CVSS 9.8, CRITICAL, vector AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H): payload /services/pluginscript/..;/..;/..;/getFaviconallowed an unauthenticated attacker to reach internal endpoints. EPSS 0.2080, Top 5%. A similar scheme is encountered in CTF tasks with multi-layer architectures—if you see Tomcat in the response headers, ..;/It's worth trying first.
Before we go over payloads, let's look at motivation—both in CTFs and beyond. Path traversal isn't an end in itself, but an entry point for an escalation chain. Read .env— received the password for the database. Read the SSH key from /home/user/.ssh/id_rsa— logged into the server without a password. Read the application's source code and found a hardcoded API token or a hidden endpoint without authentication. According to IBM X-Force, more than 6,000 new accounts appear on the dark web every day, and a significant portion are leaked through config reading. For more details, see our detailed analysis of creating CTF tasks .
In MITRE ATT&CK terms, the chain is:
Exploit Public- Facing Application (T1190, Initial Access)
Reading Local Files - Data from Local System (T1005, Collection)
Extracting credentials from config files — Credentials In Files (T1552.001, Credential Access)
SSH Key Theft - Private Keys (T1552.004, Credential Access)
Obtaining hashes /etc/shadow — OS Credential Dumping: /etc/passwd and /etc/shadow (T1003.008, Credential Access)
On CTFs, the chain is compressed: traversal → config reading → flag. But if the task requires RCE, everything works exactly the same—the scale is smaller, the logic is the same. Understanding the business logic helps select the right files first: not /etc/passwd, A .env, config.php, database.yml- files with real secrets.
Reconnaissance: How to Find a Vulnerable Parameter in CTF Web Tasks
The first step in reconnoitering a web task is to look for parameters that accept file names. According to OWASP and HackTricks, typical vulnerable parameters are: page, file, template, path, doc, folder, include, view, content, layout, mod, conf, action, show, locateThis list covers most CTF tasks, but in real events, the parameter can be named anything—look for any argument whose value resembles the file name.
Three groups of vulnerable patterns
Templatization is the most common pattern in CTFs. Request ?page=about or ?view=newssubstitutes the file name into include() or file_get_contents(). If the suffix .phpadded automatically, requires null byte injection path traversal (PHP < 5.3.4) or wrapper for bypass.
File uploads - endpoints /download?file=report.pdf or /export?name=data.csvTraversal often works directly here: the backend returns the content without executing it.
API requests —the web application directory traversal is hidden in the POST body. According to YesWeHack research, in modern APIs, path traversal is more common in JSON parameters than in the query string. Request {"filename": "../../../etc/passwd"}or a nested structure in GraphQL ( readFile(path: "../../../../.env")) may be vulnerable even if front-end validation is in place.
Internal request forwarding in microservice architectures is a separate story. According to YesWeHack, the server can generate an internal API path from user input. If you send {"user_id": "../../admin/roles"}instead of a regular ID, an internal query POST /api/v1/users/../../admin/rolesresolve into /api/v1/admin/roles— an endpoint with elevated privileges. In CTFs, this vector is encountered in tasks with multiple related services.
Methodology requested
The main tool is manual brute force in Burp Repeater. You send the original request, insert ../into a suspicious parameter and look at the response. Repeater saves the history of attempts—after a dozen checks, a filtering pattern becomes visible: which characters are blocked, which are allowed, how the response length changes.
If rate limiting is disabled, connect ffufwith wordlist from SecLists ( Fuzzing/LFI/LFI-Jhaddix.txt):
ffuf -u "http://target/page.php?file=FUZZ" -w LFI-Jhaddix.txt -fc 403 -fs 0
Filters out 403 responses and empty bodies, leaving variants with real content. On CTF platforms with protection against automatic scanning, ffuf can cause an IP ban—in that case, revert to Repeater . Alternatively, use Burp Intruder with the predefined payload list "Fuzzing - path traversal," which contains encoded variants of traversal sequences.
Bypassing Filters: A Table of Path Traversal Exploitation Techniques
Most CTF web tasks of medium difficulty filter input. Naive checks remove ../From a string, substring locking—they almost always work around it. The question is which technique will work. Below is a complete table with specific path traversal payloads and preconditions, without which each technique is useless.
Technique Payload Prerequisite When it DOESN'T work
Basic traversal ../../../etc/passwd No filtering Any filter on ../
Nested sequences ....//....//....//etc/passwd One-time str_replace; quantity ....//= path depth from the current directory to the root Recursive filtering or regex
URL encoding %2e%2e%2fetc%2fpasswd Decoding after verification The filter is applied after decoding.
Double URL encoding %252e%252e%252f Two layers (nginx -> app) One layer of processing
Null byte injection ../../../etc/passwd%00.php PHP < 5.3.4 or legacy C libraries PHP 5.3.4+
Absolute path /etc/passwd There is no prefix or we bypass the prefix realpath()+ base directory check
Mixed separators ..\/..\/etc/passwd Windows or a tolerant parser Strict Unix system
Overlong UTF-8 %c0%ae%c0%ae%c0%af Legacy parsers Modern servers
NGINX + Tomcat ..;/ ..;/..;/admin/ NGINX before Tomcat No Tomcat in the stack
Checking order in Burp Repeater
It takes three to five minutes. Start simple—it saves time:
../../../etc/passwd— If it worked, there are no filters, proceed to reading valuable files
....//....//....//etc/passwd- non-recursive traversal str_replace
%2e%2e%2fetc%2fpasswd- single URL encoding
%252e%252e%252fetc%252fpasswd— double URL encoding
/etc/passwd— absolute path directly
....\/....\/etc/passwd— mixed separators
..;/..;/..;/etc/passwd— Tomcat-specific bypass
None of them caught on? The filtering is serious (canonization through realpath(), chroot) or a vulnerability in another parameter. Don't focus on one endpoint.
How does non-recursive filtering bypass work?
A classic example from real-world CTF tasks. Vulnerable endpoint code:
$file_path = str_replace('../', '', $_GET['download']);
$full_path = $projects_dir . $file_path;
include($full_path);
Filter str_replaceremoves all occurrences ../from the line, but exactly once. You pass ....//- removal of internal ../leaves ../Exactly what I needed. Payload ....//....//....//flag.txtafter filtration it turns into ../../../flag.txtAccording to PortSwigger Web Security Academy, nested sequences like ....// or ....\/— one of the most common bypasses in both CTF and bug bounty.
Double URL encoding in real CVEs
Double encoding occurs when a request passes through multiple layers of processing. The first layer transforms %252e%252e%252f V %2e%2e%2f, the second one is in ../The filter at the first layer does not see traversal sequences because it checks the string before the second decoding.
worked This is exactly how CVE-2018-1271 in Spring MVC (CVSS 5.9, MEDIUM): the vulnerability affected Spring Framework versions 5.0–5.0.5 and 4.3–4.3.15 when serving static resources on Windows. Payload: /static/%255c%255c..%255c/..%255c/windows/win.iniEPSS 0.3034 — Top 5% by exploitability probability. There is a ready-made Nuclei template for this CVE in the ProjectDiscovery repository.
The ..;/ trick for NGINX + Tomcat
A separate technique specific to a particular stack. NGINX interprets ..;/as a regular directory. Tomcat handles this as ../Directory traversal passes through NGINX undetected.
This is how CVE-2021-45967 worked in Pascom Cloud Phone System (CVSS 9.8, CRITICAL, vector AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H): payload /services/pluginscript/..;/..;/..;/getFaviconallowed an unauthenticated attacker to reach internal endpoints. EPSS 0.2080, Top 5%. A similar scheme is encountered in CTF tasks with multi-layer architectures—if you see Tomcat in the response headers, ..;/It's worth trying first.