Lab Icon

Simple Directory Traversal

📁 Can you escape the directory and access restricted files?

Challenge Updated 21 Jun 2026 Solution (Pro)
Directory Traversal Path Injection File System Security Web Security Input Validation Path Manipulation File Access

This simple file viewer uses direct string concatenation to build file paths, creating the perfect opportunity for directory traversal attacks. 📁 Directory traversal is a fundamental web vulnerability that allows attackers to access files outside the intended directory, potentially exposing sensitive system files and configuration data. The application trusts user input without validation - a classic mistake that opens the door to file system exploitation! 🎯

1
Flags
50
XP
84%
Success Rate

Directory traversal (also known as path traversal) is a fundamental web security vulnerability that allows attackers to access files and directories outside the intended scope of the application. By manipulating file path inputs with special character sequences, attackers can read sensitive system files, application source code, and configuration files containing credentials. This vulnerability type has been consistently present in web security assessments for decades.

How Directory Traversal Works

Web applications frequently serve files based on user-supplied input - whether through URL parameters, form fields, or API requests. When the application constructs file paths by directly concatenating user input without proper validation, attackers can use ../ (dot-dot-slash) sequences to traverse up the directory tree and access files outside the web root. For example, requesting ../../etc/passwd would attempt to read the Linux password file by climbing two directories above the application's file serving directory.

Common Attack Patterns and Bypass Techniques

Basic directory traversal uses simple ../ sequences, but real-world exploitation often requires bypass techniques. URL encoding (%2e%2e%2f), double URL encoding (%252e%252e%252f), and using backslashes on Windows systems (..\) can evade basic input filters. Some applications strip ../ sequences once, which can be bypassed with ....// (the remaining characters form ../ after stripping). Null byte injection (%00) has historically been used to truncate file extensions. Understanding these techniques is essential for thorough security testing.

Real-World Impact and Defense

Directory traversal vulnerabilities have been discovered in web servers, content management systems, file sharing applications, and cloud platforms. Successful exploitation can reveal database credentials, API keys, SSL certificates, and other sensitive configuration data. In severe cases, attackers combine directory traversal with file upload vulnerabilities to achieve remote code execution. Defense requires proper input validation, canonicalization of file paths before use, chroot jails or containerization, and the principle of least privilege for application file system access.

What You Will Learn

  • Understand how path traversal vulnerabilities arise from unsafe file path construction
  • Learn to use ../ sequences and encoding techniques to access restricted files
  • Practice identifying common target files on Linux systems (/etc/passwd, configuration files)
  • Study bypass techniques for input filters and path validation
  • Recognize secure coding patterns that prevent directory traversal

Prerequisites

Basic understanding of web applications Familiarity with Linux file system structure Knowledge of HTTP requests and URL parameters

Ready to hack this lab?

Create a free account and start practicing cybersecurity hands-on.

Start Hacking - It's Free
Start Your Challenge
~1-2 min setup
Dedicated server
Private instance
Standard power
New here? Here's what to do
1
Click "Start Lab" above You'll get your own private machine with an IP address
2
Explore the target Open the IP in your browser and look for vulnerabilities
3
Find and submit flags Flags are secret text strings hidden in the system - paste them below to score

Ready to hack this lab?

Create a free account to start your own dedicated server, submit flags, and earn XP on the leaderboard.

Start Hacking Free
13,000+ Hackers 100+ Labs & Courses Free
Start Hacking Free