Siunam's Website

My personal website

Home About Blog Writeups Projects E-Portfolio

File path traversal, validation of start of path | Dec 12, 2022

Introduction

Welcome to my another writeup! In this Portswigger Labs lab, you’ll learn: File path traversal, validation of start of path! Without further ado, let’s dive in.

Background

This lab contains a file path traversal vulnerability in the display of product images.

The application transmits the full file path via a request parameter, and validates that the supplied path starts with the expected folder.

To solve the lab, retrieve the contents of the /etc/passwd file.

Exploitation

Home page:

In the previous labs, we found that there is a file path trvaersal vulnerability in the display of product images:

Also, in the lab background, it said:

The application transmits the full file path via a request parameter, and validates that the supplied path starts with the expected folder.

To bypass that, we must go back to the / root file system:

/image?filename=/var/www/images/../../../etc/passwd

What we’ve learned:

  1. File path traversal, validation of start of path