Challenge Web & API Security +50 XP

Simple Directory Traversal

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! 🎯

85% solve it 34 hackers played 1 flag Updated Oct 21, 2026 First blood Malekith
Directory TraversalPath InjectionFile System SecurityWeb SecurityInput ValidationPath Manipulation
Start Your Challenge
  1. 1Create a free account, then click "Start Lab"You'll get your own private machine with an IP address
  2. 2Explore the targetOpen the IP in your browser and look for vulnerabilities
  3. 3Find and submit flagsFlags are secret text strings hidden in the system - paste them below to score
  • ~1-2 min setup
  • Private instance
  • 30 min per session. Restart it for free, as often as you like.

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