Contents

🌐 File path traversal, traversal sequences blocked with absolute path bypass

Detailed analysis of the lab 'File path traversal, traversal sequences blocked with absolute path bypass' from the PortSwigger Academy Path Traversal series

/images/PortSwiggerLabs/PathTraversal/Second/lab_overview.png
Lab Overview

📊 Lab Overview

Field Details Additional Info
🏢 Lab Series Path Traversal Lab URL
🗂️ Category Web 🌐
🆔 Lab ID 2 Unique Identifier
⭐ Difficulty 🟡 Practitioner PortSwigger Rating
👤 Author Unknown Credits if available
💡 Hints Used No Assistance utilized
📅 Date 30-03-2025 Date of execution
👨‍💻 Solved By mH4ck3r0n3 User who solved the lab

📝 Lab Information

This lab contains a path traversal vulnerability in the display of product images. The application blocks traversal sequences but treats the supplied filename as being relative to a default working directory. To solve the lab, retrieve the contents of the /etc/passwd file.

🔧 Lab Setup & Files

Files and Environment

1
Files: None

🔍 Initial Analysis

First Steps

Since the analysis was already done for the previous lab, take that as a reference because it involves the same vulnerable parameter: File path traversal, simple case. The only difference from the previous challenge is the introduction of a filter on the filename parameter for the characters: ../.

🔬 Vulnerability Analysis

Potential Attack Vectors

  • Path Traversal

🎯 Solution Path

Step-by-Step Guide

Exploitation

We are told that any directory passed as a filename will be used as the working directory. Therefore, we simply need to pass the absolute path and not the “relative” one of passwd. That is, since we know it is located in the / directory, we need to directly pass /etc/passwd, forming the final payload: https://0a2a003f047ff99480c9bd2800fa0044.web-security-academy.net/image?filename=/etc/passwd. By visiting the page and viewing the response in the WebDevTools:

/images/PortSwiggerLabs/PathTraversal/Second/passwd.png
Passwd

We can see that instead of an image, we are served the /etc/passwd file. The alternative is always to do it with Burp:

Solution Confirmation

/images/PortSwiggerLabs/PathTraversal/Second/lab_solution.png
BurpSuite Lab Solution

🛠️ Exploitation Process

Technical Approach

The automatic exploit makes a GET request with the parameter filename=/etc/passwd and prints the response text.

🚩 Lab Outcome

1
Lab solved successfully!

Proof of Execution

/images/PortSwiggerLabs/PathTraversal/Second/proof_of_exploit.png
Proof Of Exploit
Screenshot or log showing successful exploitation

🔧 Tools & Resources

Primary Arsenal

Tool Purpose
Python Exploit
Burp Suite Traffic analysis and manipulation
Web Browser/DevTools Testing and navigation

💡 Key Learnings

Personal Improvements

  • Web Exploitation

📚 References & Resources

Official Documentation

Learning Resources


📊 Final Statistics

Metric Value Notes
Time to Solve 00:01 Total time taken
Lab ID 2 Lab Identifier

Created: 30-03-2025 • Last Modified: 30-03-2025
Author: mH4ck3r0n3