-template-..-2f..-2f..-2f..-2froot-2f
This payload attempts to navigate from the current working directory, then down into /root/ .
: In regular file notation, ../ instructs the operating system to step up one level in the directory hierarchy. Many basic firewalls or naive code filters search explicitly for the string ../ to block attacks. By utilizing hex-encoded variations like ..-2F or double-encoding schemes, attackers trick web servers into passing the string past the filter before it is decoded by the file-rendering system.
: This usually represents a legitimate parameter or directory used by a web application to load specific UI templates or files. ..-2F : This is a URL-encoded version of ../ . .. is the command to "go up one directory" in file systems.
2F is the Hexadecimal/URL-encoded version of the forward slash ( / ). When decoded by a server, ..-2F becomes ../ . -template-..-2F..-2F..-2F..-2Froot-2F
/load-css?theme=-template-..-2F..-2F..-2F..-2Fconfig-2Fdatabase.ini
: Repeating the traversal sequence multiple times ensures the application escapes the nested public folders (e.g., /var/www/html/app/templates/ ) and climbs all the way up to the fundamental system roof—the root directory.
: "Vulnerability Detected: The application does not properly sanitize the -template- This payload attempts to navigate from the current
const path = require('path');
template_key = request.GET.get('template') if template_key in allowed_templates: include(allowed_templates[template_key]) else: # error or default
Understanding Path Traversal and Directory Traversal Vulnerabilities By utilizing hex-encoded variations like
However, if an attacker inputs index.php?file=../../../../root/.bash_history , the operating system resolves the path as follows: /var/www/html/templates/ ../ -> /var/www/html/ ../ -> /var/www/ ../ -> / (The system root) ../ -> / (Stays at root; cannot go higher) root/.bash_history -> /root/.bash_history
The server then reads and prints the root user's command history directly to the attacker's browser. High-Value Targets for Attackers
How to prevent a path traversal attack. The most effective way to prevent path traversal vulnerabilities is to avoid passing user- PortSwigger Path Traversal | OWASP Foundation
Path traversal, also known as directory traversal, occurs when an application accepts user input and plugs it directly into a file system operation without validation.