Dev.to Security 🔐 Cybersecurity 👁 0 📖 5 min read

TryHackMe — Lo-Fi: Exploiting Path Traversal Vulnerability with Burp Suite

TryHackMe Lo-Fi: Exploiting a Path Traversal Vulnerability with Burp Suite 1. Introduction In this write-up, I will document my experience completing the Lo-Fi room on TryHackMe, focusing on identifying and

TryHackMe Lo-Fi: Exploiting a Path Traversal Vulnerability with Burp Suite

1. Introduction

In this write-up, I will document my experience completing the Lo-Fi room on TryHackMe, focusing on identifying and exploiting a Path Traversal vulnerability in a web application.

During this challenge, I used Burp Suite to intercept and manipulate HTTP requests, investigate how the application handled file paths, and exploit insufficient input validation to access files outside the intended web directory.

The primary objective was to understand how Path Traversal vulnerabilities work in real-world web applications and how attackers can abuse them to access sensitive files on a server.

Tools used:

  • TryHackMe — Lo-Fi room
  • Burp Suite Community Edition
  • Web Browser
  • HTTP request interception and manipulation

2. Understanding Path Traversal

Path Traversal, also known as Directory Traversal, is a web application vulnerability that allows an attacker to access files and directories outside the application's intended directory.

This vulnerability commonly occurs when an application accepts user-controlled input to construct file paths without properly validating or sanitizing the input.

For example, consider a web application that retrieves files using a parameter:

http://target.com/image?file=logo.png

If the application directly uses the supplied filename to access a file on the server, an attacker may manipulate the parameter to navigate outside the intended directory.

A typical Path Traversal payload is:

../../../etc/passwd

Understanding the payload

Component Explanation
../ Moves one directory level up
../../ Moves two directory levels up
../../../ Moves three directory levels up
/etc/passwd Linux file containing local user account information

The vulnerability becomes exploitable when the application does not prevent directory traversal sequences.

3. Reconnaissance and Initial Investigation

After starting the TryHackMe machine, I accessed the target web application through the provided browser.

The first step was to explore the application's functionality and identify potential entry points.

During this process, I paid attention to:

  • URL parameters.
  • File-loading functionality.
  • HTTP GET requests.
  • Parameters that appeared to reference images or other resources.

One important observation was that the application appeared to retrieve resources based on user-controlled input.

This behavior suggested a potential attack surface for Path Traversal.

4. Exploitation Using Burp Suite

To investigate and exploit the suspected Path Traversal vulnerability, I used Burp Suite Intruder to automate HTTP request manipulation and test different directory traversal payloads.

Step 1: Intercept the HTTP Request

First, I accessed the target web application through my browser with Burp Suite Proxy enabled.

I intercepted the HTTP request and identified the parameter responsible for retrieving files from the server.

After identifying the potentially vulnerable parameter, I sent the request to Burp Suite Intruder.

Step 2: Configure Payload Positions

Inside the Intruder tab, I selected the parameter value that I wanted to test and configured it as a payload insertion position.

This allowed me to dynamically replace the original parameter value with different traversal payloads.

Step 3: Configure Path Traversal Payloads

I configured a list of directory traversal payloads to test whether the application properly restricted access to its filesystem.

Example payloads:

../
../../
../../../
../../../../
../../../../../etc/passwd

These payloads were designed to navigate through parent directories and attempt to access files outside the application's intended directory.

Step 4: Execute the Intruder Attack

After configuring the payload positions and payload list, I launched the Intruder attack.

Burp Suite automatically generated and sent multiple HTTP requests, replacing the selected parameter with each configured payload.

This helped me efficiently test different traversal patterns without manually modifying every request.

Step 5: Analyze HTTP Responses

After the attack completed, I examined the response results to identify differences between the requests.

I focused on:

  • HTTP status codes.
  • Response lengths.
  • Response bodies.
  • Differences in server behavior.

A response containing the contents of an unauthorized file would indicate successful exploitation of the Path Traversal vulnerability.

This demonstrated how automated HTTP request testing can help identify weaknesses in web application file-handling mechanisms.

5. Technical Analysis: Why Did the Vulnerability Work?

The root cause of Path Traversal is generally insecure file-handling logic.

Consider the following vulnerable Python example:

from flask import request, send_file

@app.route("/download")
def download():
    filename = request.args.get("file")
    return send_file("/var/www/files/" + filename)

The application directly concatenates user input with a predefined directory.

An attacker could provide:

../../../etc/passwd

The resulting path could point outside the intended directory.

The key security issue is the absence of proper path validation and access restrictions.

6. Security Impact

Path Traversal can have several security implications depending on the application's permissions and implementation.

Potential impacts include:

  1. Sensitive Information Disclosure: Unauthorized access to configuration files, application source code, credentials, or system files.
  2. Credential Exposure: Access to files containing usernames, passwords, API keys, or other sensitive information.
  3. Application Compromise: Disclosure of configuration details that may help attackers identify further vulnerabilities.
  4. Privilege Escalation Opportunities: Exposed information may assist attackers in conducting additional attacks.

The actual impact depends on which files are accessible and the privileges of the application process.

7. Mitigation and Prevention

Developers should implement multiple layers of protection to prevent Path Traversal vulnerabilities.

Method 1. Input Validation

Validate user input and reject unexpected path separators or traversal sequences when they are not required.

Method 2. Canonicalize File Paths

Resolve paths to their canonical form and verify that the resulting path remains within the intended directory.

Method 3. Use Allowlisting

Instead of accepting arbitrary filenames, map user-provided identifiers to predefined files.

Method 4. Apply Least Privilege

Ensure that the web application runs with restricted filesystem permissions and cannot access unnecessary sensitive files.

Method 5. Secure File Handling

Use safe file-handling APIs and enforce directory boundaries before accessing files.

8. Key Takeaways

Completing the Lo-Fi room helped me better understand the practical exploitation of Path Traversal vulnerabilities.

The most important lessons I learned were:

  • How to identify potentially vulnerable file-handling parameters.
  • How to intercept HTTP requests using Burp Suite Proxy.
  • How to manipulate requests with Burp Suite Intruder.
  • How directory traversal sequences can bypass intended directory boundaries.
  • How to analyze HTTP responses to validate a suspected vulnerability.
  • Why proper input validation and filesystem access restrictions are essential.

9. Conclusion

This challenge provided practical experience with one of the fundamental vulnerabilities in web application security.

More importantly, it demonstrated how a seemingly simple file-loading functionality can introduce a serious security risk when user-controlled input is not properly validated.

I will continue improving my practical penetration-testing skills through TryHackMe challenges and hands-on security labs, with a particular focus on web application vulnerabilities and security testing methodologies.

Lab: TryHackMe — Lo-Fi

Category: Web Application Security

Vulnerability: Path Traversal / Directory Traversal

Exploitation Tool: Burp Suite (Proxy and Intruder)

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.